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

Function reveal

plugins/reveal.cpp:229–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229command_result reveal(color_ostream &out, vector<string> & params) {
230 bool no_hell = true;
231 bool pause = false;
232 for (auto & param : params) {
233 if (param == "hell") {
234 no_hell = false;
235 pause = true;
236 } else if (param == "demon") {
237 out.printerr("`reveal demon` is currently disabled to prevent a hang due to a bug in the base game\n");
238 return CR_FAILURE;
239 //no_hell = false;
240 //pause = false;
241 }
242 else if (param == "help" || param == "?")
243 return CR_WRONG_USAGE;
244 }
245
246 if (revealed != NOT_REVEALED) {
247 out.printerr("Map is already revealed.\n");
248 return CR_FAILURE;
249 }
250
251 if (!Maps::IsValid()) {
252 out.printerr("Map is not available!\n");
253 return CR_FAILURE;
254 }
255
256 if (no_hell) {
257 size_t initial_buckets = 2 * (world->event.encased_horrors.size() + world->event.divine_treasures.size() + world->event.deep_vein_hollows.size());
258 trigger_cache.reserve(initial_buckets);
259 initialize_trigger_cache();
260 }
261
262 out.print("Map revealed.\n\n");
263 if (World::isAdventureMode()) {
264 do_reveal_adventure(out, no_hell);
265 is_active = true;
266 } else if (World::isFortressMode()) {
267 do_reveal_fort(out, no_hell);
268
269 if (Screen::inGraphicsMode()) {
270 out.print("Note that in graphics mode, tiles that are not adjacent to open\n"
271 "space will not render but can still be examined by hovering over\n"
272 "them with the mouse. Switching to text mode (in the game settings)\n"
273 "will allow the display of the revealed tiles.\n\n");
274 }
275
276 if (pause)
277 out.print("Unpausing can unleash the forces of hell, so it has been temporarily disabled.\n\n");
278 out.print("Run 'unreveal' to revert to previous state.\n");
279 } else {
280 out.printerr("Can only reveal in adventure or fortress mode.\n");
281 return CR_FAILURE;
282 }
283
284 if (no_hell)
285 revealed = SAFE_REVEALED;
286 else {

Callers 1

revtoggleFunction · 0.85

Calls 7

initialize_trigger_cacheFunction · 0.85
do_reveal_adventureFunction · 0.85
do_reveal_fortFunction · 0.85
SetPauseStateFunction · 0.85
reserveMethod · 0.80
sizeMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected