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

Function setTilesByDesignation

plugins/burrow.cpp:300–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300static void setTilesByDesignation(df::burrow *target, df::tile_designation d_mask,
301 df::tile_designation d_value, bool enable) {
302 CHECK_NULL_POINTER(target);
303
304 auto &blocks = world->map.map_blocks;
305
306 for (auto block : blocks) {
307 df::block_burrow *mask = NULL;
308
309 for (int x = 0; x < 16; x++) {
310 for (int y = 0; y < 16; y++) {
311 if ((block->designation[x][y].whole & d_mask.whole) != d_value.whole)
312 continue;
313
314 if (!mask)
315 mask = Burrows::getBlockMask(target, block, enable);
316 if (!mask)
317 goto next_block;
318
319 mask->setassignment(x, y, enable);
320 }
321 }
322
323 if (mask && !enable && !mask->has_assignments())
324 Burrows::deleteBlockMask(target, block, mask);
325
326 next_block:;
327 }
328}
329
330static bool setTilesByKeyword(df::burrow *target, std::string name, bool enable) {
331 CHECK_NULL_POINTER(target);

Callers 1

setTilesByKeywordFunction · 0.85

Calls 1

deleteBlockMaskFunction · 0.85

Tested by

no test coverage detected