| 992 | } |
| 993 | |
| 994 | static void markBuildingTiles(df::building *bld, bool remove) |
| 995 | { |
| 996 | bool use_extents = bld->room.extents && bld->isExtentShaped(); |
| 997 | bool stockpile = (bld->getType() == building_type::Stockpile); |
| 998 | bool complete = (bld->getBuildStage() >= bld->getMaxBuildStage()); |
| 999 | |
| 1000 | if (remove) |
| 1001 | stockpile = complete = false; |
| 1002 | |
| 1003 | for (int tx = bld->x1; tx <= bld->x2; tx++) { |
| 1004 | for (int ty = bld->y1; ty <= bld->y2; ty++) { |
| 1005 | df::coord tile(tx, ty, bld->z); |
| 1006 | |
| 1007 | if (use_extents) { |
| 1008 | df::building_extents_type *etile = getExtentTile(bld->room, tile); |
| 1009 | if (!etile || !*etile) |
| 1010 | continue; |
| 1011 | } |
| 1012 | |
| 1013 | df::map_block *block = Maps::getTileBlock(tile); |
| 1014 | df::coord2d btile = df::coord2d(tile) & 15; |
| 1015 | |
| 1016 | auto &des = block->designation[btile.x][btile.y]; |
| 1017 | |
| 1018 | des.bits.pile = stockpile; |
| 1019 | if (!remove) |
| 1020 | des.bits.dig = tile_dig_designation::No; |
| 1021 | |
| 1022 | if (complete) |
| 1023 | bld->updateOccupancy(tx, ty); |
| 1024 | else { |
| 1025 | auto &occ = block->occupancy[btile.x][btile.y]; |
| 1026 | |
| 1027 | if (remove) { |
| 1028 | occ.bits.building = tile_building_occ::None; |
| 1029 | block->flags.bits.update_liquid = true; |
| 1030 | block->flags.bits.update_liquid_twice = true; |
| 1031 | } |
| 1032 | else { |
| 1033 | occ.bits.building = tile_building_occ::Planned; |
| 1034 | } |
| 1035 | } |
| 1036 | } |
| 1037 | } |
| 1038 | } |
| 1039 | |
| 1040 | static void linkBuilding(df::building *bld) |
| 1041 | { |
no test coverage detected