From bbd823f5b072ce93664f80d7019a78c0fb08c55f Mon Sep 17 00:00:00 2001 From: Quietust Date: Sat, 16 Dec 2017 15:40:39 -0600 Subject: [PATCH] Simplify logic in createitem, to avoid similar errors in the future --- plugins/createitem.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/createitem.cpp b/plugins/createitem.cpp index 18ce7674a..1f2e8a5c4 100644 --- a/plugins/createitem.cpp +++ b/plugins/createitem.cpp @@ -99,24 +99,21 @@ bool makeItem (df::reaction_product_itemst *prod, df::unit *unit, bool second_it for (size_t i = 0; i < out_items.size(); i++) { - bool on_ground = true; if (container) { - on_ground = false; out_items[i]->flags.bits.removed = 1; if (!Items::moveToContainer(mc, out_items[i], container)) out_items[i]->moveToGround(container->pos.x, container->pos.y, container->pos.z); } - if (building) + else if (building) { - on_ground = false; out_items[i]->flags.bits.removed = 1; if (!Items::moveToBuilding(mc, out_items[i], (df::building_actual *)building, 0)) out_items[i]->moveToGround(building->centerx, building->centery, building->z); } - if (move_to_cursor) + else if (move_to_cursor) out_items[i]->moveToGround(cursor->x, cursor->y, cursor->z); - else if (on_ground) + else out_items[i]->moveToGround(unit->pos.x, unit->pos.y, unit->pos.z); if (is_gloves) {