Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 876bcae

Browse files
committed
changes suggested by @myk002
1 parent 6f6eb7c commit 876bcae

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

plugins/buildingplan/buildingplan_cycle.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ static df::building * popInvalidTasks(color_ostream &out, Bucket &task_queue,
230230

231231

232232
static 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

236236
static 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

Comments
 (0)