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

Method setAreaAquifer

library/modules/Maps.cpp:1427–1457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1425}
1426
1427int Maps::setAreaAquifer(df::coord pos1, df::coord pos2, bool heavy, std::function<bool(df::coord, df::map_block *)> filter) {
1428 int totalAffectedCount = 0;
1429 cuboid bounds(pos1, pos2);
1430
1431 // Loop through the affected blocks
1432 bounds.forBlock([&](df::map_block *block, cuboid intersect) {
1433 int blockAffectedCount = 0;
1434 // Loop through the affected tiles in the block
1435 intersect.forCoord([&](df::coord pos) {
1436 if (filter(pos, block)) {
1437 blockAffectedCount++;
1438 block->designation[pos.x&15][pos.y&15].bits.water_table = true;
1439 block->occupancy[pos.x&15][pos.y&15].bits.heavy_aquifer = heavy;
1440 }
1441 return true; // Keep iterating tiles
1442 });
1443
1444 // If any tile was set to be an aquifer, update the block
1445 if (blockAffectedCount > 0) {
1446 block->flags.bits.has_aquifer = true;
1447 block->flags.bits.check_aquifer = true;
1448 block->flags.bits.update_liquid = true;
1449 block->flags.bits.update_liquid_twice = true;
1450 totalAffectedCount += blockAffectedCount;
1451 }
1452
1453 return true; // Keep iterating blocks
1454 });
1455
1456 return totalAffectedCount;
1457}
1458
1459bool Maps::removeTileAquifer(int32_t x, int32_t y, int32_t z) {
1460 df::map_block *block = Maps::getTileBlock(x, y, z);

Callers

nothing calls this directly

Calls 3

filterFunction · 0.85
forBlockMethod · 0.80
forCoordMethod · 0.80

Tested by

no test coverage detected