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

Function scan_unit

plugins/fix-occupancy.cpp:126–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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)
128 return;
129 if (auto craw = df::creature_raw::find(unit->race); craw && craw->flags.is_set(df::creature_raw_flags::EQUIPMENT_WAGON)) {
130 for (int y = unit->pos.y - 1; y <= unit->pos.y + 1; ++y) {
131 for (int x = unit->pos.x - 1; x <= unit->pos.x + 1; ++x) {
132 if (auto expected_occ = expected.occ(x, y, unit->pos.z)) {
133 expected_occ->bits.unit = expected_occ->bits.unit || !unit->flags1.bits.on_ground;
134 expected_occ->bits.unit_grounded = expected_occ->bits.unit_grounded || unit->flags1.bits.on_ground;
135 }
136 }
137 }
138 } else if (auto expected_occ = expected.occ(unit->pos)) {
139 expected_occ->bits.unit = expected_occ->bits.unit || !unit->flags1.bits.on_ground;
140 expected_occ->bits.unit_grounded = expected_occ->bits.unit_grounded || unit->flags1.bits.on_ground;
141 }
142}
143
144static void scan_item(df::item * item, Expected & expected) {
145 if (!item->flags.bits.on_ground)

Callers 2

fix_tileFunction · 0.85
fix_mapFunction · 0.85

Calls 3

is_setMethod · 0.80
occMethod · 0.80
findFunction · 0.50

Tested by

no test coverage detected