MCPcopy Create free account
hub / github.com/DFHack/dfhack / scan_building

Function scan_building

plugins/fix-occupancy.cpp:102–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100};
101
102static void scan_building(color_ostream &out, df::building * bld, Expected & expected) {
103 for (int y = bld->y1; y <= bld->y2; ++y) {
104 for (int x = bld->x1; x <= bld->x2; ++x) {
105 if (!Buildings::containsTile(bld, df::coord2d(x, y)))
106 continue;
107 auto expected_bld = expected.bld(x, y, bld->z);
108 if (bld->isSettingOccupancy() && expected_bld) {
109 if (*expected_bld) {
110 WARN(log,out).print("Buildings overlap at ({}, {}, {}); please manually remove overlapping building."
111 " Run ':lua dfhack.gui.revealInDwarfmodeMap({}, {}, {}, true, true)' to zoom to the tile.\n",
112 x, y, bld->z, x, y, bld->z);
113 }
114 *expected_bld = bld;
115 }
116 if (auto expected_occ = expected.occ(x, y, bld->z)) {
117 auto bld_occ = df::tile_building_occ::Impassable;
118 if (auto block_occ = Maps::getTileOccupancy(x, y, bld->z))
119 bld_occ = block_occ->bits.building;
120 expected_occ->bits.building = bld_occ;
121 }
122 }
123 }
124}
125
126static void scan_unit(df::unit * unit, Expected & expected) {
127 if (unit->flags1.bits.caged || unit->flags1.bits.inactive || unit->flags1.bits.rider)

Callers 2

fix_tileFunction · 0.85
fix_mapFunction · 0.85

Calls 4

getTileOccupancyFunction · 0.85
bldMethod · 0.80
occMethod · 0.80
printMethod · 0.45

Tested by

no test coverage detected