@@ -230,7 +230,7 @@ static df::building * popInvalidTasks(color_ostream &out, Bucket &task_queue,
230230
231231
232232static int distance (df::coord pos1, df::coord pos2) {
233- return std::max (abs (pos1.x - pos2.x ), abs (pos1.y - pos2.y ) + abs (pos1.z - pos2.z ) );
233+ return std::max (abs (pos1.x - pos2.x ), abs (pos1.y - pos2.y )) + abs (pos1.z - pos2.z );
234234}
235235
236236static void doVector (color_ostream &out, df::job_item_vector_id vector_id,
@@ -285,7 +285,7 @@ static void doVector(color_ostream &out, df::job_item_vector_id vector_id,
285285 pb.heat_safety ,
286286 pb.item_filters [rev_filter_idx],
287287 pb.specials ))
288- matching.emplace_back (item-> pos ,item);
288+ matching.emplace_back (Items::getPosition ( item) ,item);
289289
290290 num_matching = matching.size ();
291291 first_task = false ;
@@ -324,7 +324,8 @@ static void doVector(color_ostream &out, df::job_item_vector_id vector_id,
324324 // items so if buildingplan is turned off, the building will
325325 // be completed with the correct number of items.
326326 --jitems[filter_idx]->quantity ;
327- // invaldate attached item
327+ // null the item* component in vector of matching items
328+ // ensures we don't try to attach this item to another job
328329 closest->second = nullptr ;
329330 --num_matching;
330331 // try to finalize building
0 commit comments