Allow Reveal to be used in Adventurer mode

develop
Quietust 2012-03-01 22:52:40 -06:00
parent 022822277d
commit 5019af038b
1 changed files with 35 additions and 10 deletions

@ -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;