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

Method scan_one

plugins/channel-safely/channel-groups.cpp:156–174  ·  view source on GitHub ↗

scans a single tile for channel designations

Source from the content-addressed store, hash-verified

154
155// scans a single tile for channel designations
156void ChannelGroups::scan_one(const df::coord &map_pos) {
157 df::map_block* block = Maps::getTileBlock(map_pos);
158 int16_t lx = map_pos.x % 16;
159 int16_t ly = map_pos.y % 16;
160 if (is_dig_designation(block->designation[lx][ly])) {
161 for (df::block_square_event* event: block->block_events) {
162 if (auto evT = virtual_cast<df::block_square_event_designation_priorityst>(event)) {
163 // we want to let the user keep some designations free of being managed
164 if (evT->priority[lx][ly] < 1000 * config.ignore_threshold) {
165 TRACE(groups).print(" adding (" COORD ")\n", COORDARGS(map_pos));
166 add(map_pos);
167 }
168 }
169 }
170 } else if (TileCache::Get().hasChanged(map_pos, block->tiletype[lx][ly])) {
171 TileCache::Get().uncache(map_pos);
172 remove(map_pos);
173 }
174}
175
176// builds groupings of adjacent channel designations
177void ChannelGroups::scan(bool full_scan) {

Callers 1

manage_groupMethod · 0.80

Calls 5

getTileBlockFunction · 0.85
is_dig_designationFunction · 0.85
hasChangedMethod · 0.80
uncacheMethod · 0.80
printMethod · 0.45

Tested by

no test coverage detected