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

Function propagate_if_material_match

plugins/dig.cpp:318–349  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

316//
317
318static void propagate_if_material_match(color_ostream& out, MapExtras::MapCache & mc,
319 int16_t mat, bool warm, bool damp, const df::coord & pos)
320{
321 auto block = Maps::getTileBlock(pos);
322 if (!block)
323 return;
324
325 INFO(log,out).print("testing adjacent tile at ({},{},{}), mat:{}",
326 pos.x, pos.y, pos.z, mc.veinMaterialAt(pos));
327
328 if (mat != mc.veinMaterialAt(pos))
329 return;
330
331 auto des = Maps::getTileDesignation(pos);
332 auto occ = Maps::getTileOccupancy(pos);
333 if (!des || !occ || !is_wall(pos))
334 return;
335
336 if (des->bits.hidden && ((warm && is_warm(pos)) || (damp && is_damp(pos)))) {
337 des->bits.dig = df::tile_dig_designation::Default;
338 occ->bits.dig_auto = true;
339 }
340
341 if (warm) {
342 if (auto warm_mask = World::getPersistentTilemask(warm_config, block, true))
343 warm_mask->setassignment(pos, true);
344 }
345 if (damp) {
346 if (auto damp_mask = World::getPersistentTilemask(damp_config, block, true))
347 damp_mask->setassignment(pos, true);
348 }
349}
350
351static void do_autodig(color_ostream& out, bool warm, bool damp, const df::coord & pos) {
352 MapExtras::MapCache mc;

Callers 1

do_autodigFunction · 0.85

Calls 7

getTileBlockFunction · 0.85
getTileDesignationFunction · 0.85
getTileOccupancyFunction · 0.85
is_warmFunction · 0.85
is_dampFunction · 0.85
is_wallFunction · 0.70
printMethod · 0.45

Tested by

no test coverage detected