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

Function unreveal

plugins/reveal.cpp:300–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300command_result unreveal(color_ostream &out, vector<string> & params) {
301 for (auto & param : params) {
302 if (param == "help" || param == "?")
303 return CR_WRONG_USAGE;
304 }
305
306 if (!revealed) {
307 out.printerr("There's nothing to revert!\n");
308 return CR_FAILURE;
309 }
310
311 if (!Maps::IsValid()) {
312 out.printerr("Map is not available!\n");
313 return CR_FAILURE;
314 }
315
316 if (World::isAdventureMode()) {
317 auto unit = World::getAdventurer();
318 df::coord upos;
319 if (unit)
320 upos = Units::getPosition(unit);
321 for (auto & block : world->map.map_blocks) {
322 if (unit && is_vision_block(upos, block->map_pos, -1) && upos.z == block->map_pos.z)
323 continue;
324 designations40d & designations = block->designation;
325 for (uint32_t x = 0; x < 16; x++) for (uint32_t y = 0; y < 16; y++) {
326 designations[x][y].bits.hidden = 1;
327 designations[x][y].bits.pile = 0;
328 }
329 }
330 } else {
331 for (auto & hb : hidesaved) {
332 df::map_block * b = Maps::getTileBlock(hb.c.x, hb.c.y, hb.c.z);
333 for (uint32_t x = 0; x < 16; x++) for (uint32_t y = 0; y < 16; y++) {
334 b->designation[x][y].bits.hidden = hb.hiddens[x][y];
335 }
336 }
337 update_minimap();
338 }
339
340 reset_state();
341
342 out.print("Map hidden!\n");
343 return CR_OK;
344}
345
346command_result revtoggle(color_ostream &out, vector<string> & params) {
347 if (revealed)

Callers 1

revtoggleFunction · 0.85

Calls 5

is_vision_blockFunction · 0.85
getTileBlockFunction · 0.85
update_minimapFunction · 0.85
reset_stateFunction · 0.85
printMethod · 0.45

Tested by

no test coverage detected