diff options
| author | Quietust | 2012-03-01 22:52:40 -0600 |
|---|---|---|
| committer | Quietust | 2012-03-01 22:52:40 -0600 |
| commit | 5019af038bd84ff5a224edb175d1a7def4c99572 (patch) | |
| tree | e044c1173d81ef5e97081fac7ace6dc0692e44d2 /plugins/reveal.cpp | |
| parent | 022822277d80152ca6ba4fad6102d68df35a7adc (diff) | |
| download | dfhack-5019af038bd84ff5a224edb175d1a7def4c99572.tar.gz dfhack-5019af038bd84ff5a224edb175d1a7def4c99572.tar.bz2 dfhack-5019af038bd84ff5a224edb175d1a7def4c99572.tar.xz | |
Allow Reveal to be used in Adventurer mode
Diffstat (limited to 'plugins/reveal.cpp')
| -rw-r--r-- | plugins/reveal.cpp | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/plugins/reveal.cpp b/plugins/reveal.cpp index fd9b65c9..647ad21d 100644 --- a/plugins/reveal.cpp +++ b/plugins/reveal.cpp @@ -120,6 +120,26 @@ command_result nopause (Core * c, std::vector <std::string> & parameters) return CR_OK; } +void revealAdventure(DFHack::Core * c) +{ + for (size_t i = 0; i < world->map.map_blocks.size(); i++) + { + df::map_block *block = world->map.map_blocks[i]; + // in 'no-hell'/'safe' mode, don't reveal blocks with hell and adamantine + if (!isSafe(block->map_pos)) + continue; + DFHack::designations40d & designations = block->designation; + // for each tile in block + for (uint32_t x = 0; x < 16; x++) for (uint32_t y = 0; y < 16; y++) + { + // set to revealed + designations[x][y].bits.hidden = 0; + // and visible + designations[x][y].bits.pile = 1; + } + } + c->con.print("Local map revealed.\n"); +} command_result reveal(DFHack::Core * c, std::vector<std::string> & params) { @@ -157,16 +177,21 @@ command_result reveal(DFHack::Core * c, std::vector<std::string> & params) CoreSuspender suspend(c); DFHack::World *World =c->getWorld(); + if (!Maps::IsValid()) + { + c->con.printerr("Map is not available!\n"); + return CR_FAILURE; + } t_gamemodes gm; World->ReadGameMode(gm); - if(gm.g_mode != GAMEMODE_DWARF) + if(gm.g_mode == GAMEMODE_ADVENTURE) { - con.printerr("Only in fortress mode.\n"); - return CR_FAILURE; + revealAdventure(c); + return CR_OK; } - if (!Maps::IsValid()) + if(gm.g_mode != GAMEMODE_DWARF) { - c->con.printerr("Map is not available!\n"); + con.printerr("Only in fortress mode.\n"); return CR_FAILURE; } @@ -231,6 +256,11 @@ command_result unreveal(DFHack::Core * c, std::vector<std::string> & params) CoreSuspender suspend(c); DFHack::World *World =c->getWorld(); + if (!Maps::IsValid()) + { + c->con.printerr("Map is not available!\n"); + return CR_FAILURE; + } t_gamemodes gm; World->ReadGameMode(gm); if(gm.g_mode != GAMEMODE_DWARF) @@ -238,11 +268,6 @@ command_result unreveal(DFHack::Core * c, std::vector<std::string> & params) con.printerr("Only in fortress mode.\n"); return CR_FAILURE; } - if (!Maps::IsValid()) - { - c->con.printerr("Map is not available!\n"); - return CR_FAILURE; - } // Sanity check: map size uint32_t x_max_b, y_max_b, z_max_b; |
