| 774 | } |
| 775 | |
| 776 | static bool removeItemOnGround(df::item *item) |
| 777 | { // Replaces the MapCache fn |
| 778 | auto block = Maps::getTileBlock(item->pos); |
| 779 | if (!block) |
| 780 | return false; |
| 781 | |
| 782 | erase_from_vector(block->items, item->id); |
| 783 | |
| 784 | for (auto b_item : block->items) |
| 785 | { |
| 786 | auto other_item = df::item::find(b_item); |
| 787 | if (other_item && other_item->pos == item->pos) |
| 788 | return true; // Don't touch occupancy |
| 789 | } |
| 790 | |
| 791 | auto &occ = index_tile(block->occupancy, item->pos); |
| 792 | occ.bits.item = false; |
| 793 | |
| 794 | if (occ.bits.building == tile_building_occ::Planned) |
| 795 | if (auto bld = Buildings::findAtTile(item->pos)) |
| 796 | { // TODO: Maybe recheck other tiles like the game does. |
| 797 | bld->flags.bits.site_blocked = false; |
| 798 | } |
| 799 | return true; |
| 800 | } |
| 801 | |
| 802 | static void resetUnitInvFlags(df::unit *unit, df::unit_inventory_item *inv_item) { |
| 803 | if (inv_item->mode == df::inv_item_role_type::Worn || |
no test coverage detected