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

Function aquifer_list

plugins/aquifer.cpp:157–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157static void aquifer_list(color_ostream &out, df::coord pos1, df::coord pos2, int levels, bool leaky) {
158 DEBUG(log,out).print("entering aquifer_list: pos1={}, pos2={}, levels={}, leaky={}\n",
159 pos1, pos2, levels, leaky);
160
161 std::map<int, int, std::greater<int>> light_tiles, heavy_tiles;
162
163 int minz = 0, maxz = -1;
164 get_z_range(out, minz, maxz, pos1, pos2, levels);
165
166 for_block(minz, maxz, pos1, pos2, [&](const df::coord &pos){
167 if (Maps::isTileAquifer(pos) && (!leaky || is_leaky(pos))) {
168 if (Maps::isTileHeavyAquifer(pos))
169 ++heavy_tiles[pos.z];
170 else
171 ++light_tiles[pos.z];
172 }
173 });
174
175 if (light_tiles.empty() && heavy_tiles.empty()) {
176 out.print("No {}aquifer tiles in the specified range.\n", leaky ? "leaking " : "");
177 } else {
178 int elev_off = world->map.region_z - 100;
179 for (int z = maxz; z >= minz; --z) {
180 int lcount = light_tiles.contains(z) ? light_tiles[z] : 0;
181 int hcount = heavy_tiles.contains(z) ? heavy_tiles[z] : 0;
182 if (lcount || hcount)
183 out.print("z-level {} (elevation {}) has {} {}light aquifer tile(s) and {} {}heavy aquifer tile(s)\n",
184 z, z+elev_off, lcount, leaky ? "leaking " : "", hcount, leaky ? "leaking " : "");
185 }
186 }
187}
188
189static int aquifer_drain(color_ostream &out, string aq_type,
190 df::coord pos1, df::coord pos2, int skip_top, int levels, bool leaky)

Callers

nothing calls this directly

Calls 8

get_z_rangeFunction · 0.85
for_blockFunction · 0.85
isTileAquiferFunction · 0.85
is_leakyFunction · 0.85
isTileHeavyAquiferFunction · 0.85
containsMethod · 0.80
printMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected