| 1200 | } |
| 1201 | |
| 1202 | bool MapExtras::Block::removeItemOnGround(df::item *item) |
| 1203 | { |
| 1204 | if (!block) |
| 1205 | return false; |
| 1206 | |
| 1207 | init_item_counts(); |
| 1208 | |
| 1209 | erase_from_vector(block->items,item->id); |
| 1210 | |
| 1211 | int &count = index_tile(item_counts,item->pos); |
| 1212 | |
| 1213 | if (--count == 0) |
| 1214 | { |
| 1215 | index_tile(occupancy,item->pos).bits.item = false; |
| 1216 | |
| 1217 | auto &occ = index_tile(block->occupancy,item->pos); |
| 1218 | |
| 1219 | occ.bits.item = false; |
| 1220 | |
| 1221 | // Clear the 'site blocked' flag in the building, if any. |
| 1222 | // Otherwise the job would be re-suspended without actually checking items. |
| 1223 | if (occ.bits.building == tile_building_occ::Planned) |
| 1224 | { |
| 1225 | if (auto bld = Buildings::findAtTile(item->pos)) |
| 1226 | { |
| 1227 | // TODO: maybe recheck other tiles like the game does. |
| 1228 | bld->flags.bits.site_blocked = false; |
| 1229 | } |
| 1230 | } |
| 1231 | } |
| 1232 | |
| 1233 | return true; |
| 1234 | } |
| 1235 | |
| 1236 | MapExtras::MapCache::MapCache() |
| 1237 | { |
nothing calls this directly
no test coverage detected