Simplify logic in createitem, to avoid similar errors in the future

develop
Quietust 2017-12-16 15:40:39 -06:00
parent f59a91a0db
commit bbd823f5b0
1 changed files with 3 additions and 6 deletions

@ -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)
{