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

Function copyTiles

plugins/burrow.cpp:265–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265static void copyTiles(df::burrow *target, df::burrow *source, bool enable) {
266 CHECK_NULL_POINTER(target);
267 CHECK_NULL_POINTER(source);
268
269 if (source == target) {
270 if (!enable)
271 Burrows::clearTiles(target);
272 return;
273 }
274
275 vector<df::map_block*> pvec;
276 Burrows::listBlocks(&pvec, source);
277
278 for (auto block : pvec) {
279 auto smask = Burrows::getBlockMask(source, block);
280 if (!smask)
281 continue;
282
283 auto tmask = Burrows::getBlockMask(target, block, enable);
284 if (!tmask)
285 continue;
286
287 if (enable) {
288 for (int j = 0; j < 16; j++)
289 tmask->tile_bitmask[j] |= smask->tile_bitmask[j];
290 } else {
291 for (int j = 0; j < 16; j++)
292 tmask->tile_bitmask[j] &= ~smask->tile_bitmask[j];
293
294 if (!tmask->has_assignments())
295 Burrows::deleteBlockMask(target, block, tmask);
296 }
297 }
298}
299
300static void setTilesByDesignation(df::burrow *target, df::tile_designation d_mask,
301 df::tile_designation d_value, bool enable) {

Callers 1

tiles_set_add_removeFunction · 0.85

Calls 1

deleteBlockMaskFunction · 0.85

Tested by

no test coverage detected