summaryrefslogtreecommitdiff
path: root/plugins/reveal.cpp
diff options
context:
space:
mode:
authorPetr Mrázek2011-07-07 09:49:58 +0200
committerPetr Mrázek2011-07-07 09:49:58 +0200
commit8b298f8d91ed97dd3651ffdb607ea43fbc19e88f (patch)
tree1cb7a36612b4d738cda3be49a500edaaacab4174 /plugins/reveal.cpp
parent4ff5db06be01fa2c9baba9968fcc087939b4b03e (diff)
downloaddfhack-8b298f8d91ed97dd3651ffdb607ea43fbc19e88f.tar.gz
dfhack-8b298f8d91ed97dd3651ffdb607ea43fbc19e88f.tar.bz2
dfhack-8b298f8d91ed97dd3651ffdb607ea43fbc19e88f.tar.xz
More maps tweaks, function for block event removal, added cleanmap version that nukes spatter objects instead of rewriting their
bitmaps.
Diffstat (limited to 'plugins/reveal.cpp')
-rw-r--r--plugins/reveal.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/plugins/reveal.cpp b/plugins/reveal.cpp
index 452ceb10..1f1165ac 100644
--- a/plugins/reveal.cpp
+++ b/plugins/reveal.cpp
@@ -96,7 +96,6 @@ DFhackCExport command_result plugin_shutdown ( Core * c )
DFhackCExport command_result reveal(DFHack::Core * c, std::vector<std::string> & params)
{
- DFHack::designations40d designations;
bool no_hell = false;
if(params[0] == "safe")
{
@@ -142,7 +141,8 @@ DFhackCExport command_result reveal(DFHack::Core * c, std::vector<std::string> &
{
for(uint32_t z = 0; z< z_max;z++)
{
- if(Maps->isValidBlock(x,y,z))
+ df_block *block = Maps->getBlock(x,y,z);
+ if(block)
{
// in 'no-hell'/'safe' mode, don't reveal blocks with hell and adamantine
if (no_hell && !isSafe(x, y, z, Maps))
@@ -151,17 +151,16 @@ DFhackCExport command_result reveal(DFHack::Core * c, std::vector<std::string> &
hb.x = x;
hb.y = y;
hb.z = z;
- // read block designations
- Maps->ReadDesignations(x,y,z, &designations);
- // change the hidden flag to 0
+ DFHack::designations40d & designations = block->designation;
+ // for each tile in block
for (uint32_t i = 0; i < 16;i++) for (uint32_t j = 0; j < 16;j++)
{
+ // save hidden state of tile
hb.hiddens[i][j] = designations[i][j].bits.hidden;
+ // set to revealed
designations[i][j].bits.hidden = 0;
}
hidesaved.push_back(hb);
- // write the designations back
- Maps->WriteDesignations(x,y,z, &designations);
}
}
}
@@ -178,7 +177,7 @@ DFhackCExport command_result reveal(DFHack::Core * c, std::vector<std::string> &
c->Resume();
dfout << "Map revealed." << std::endl;
if(!no_hell)
- dfout << "Unpausing can unleash the forces of hell, so it has beed temporarily disabled!" << std::endl;
+ dfout << "Unpausing can unleash the forces of hell, so it has been temporarily disabled!" << std::endl;
dfout << "Run 'unreveal' to revert to previous state." << std::endl;
return CR_OK;
}
@@ -225,12 +224,11 @@ DFhackCExport command_result unreveal(DFHack::Core * c, std::vector<std::string>
for(size_t i = 0; i < hidesaved.size();i++)
{
hideblock & hb = hidesaved[i];
- Maps->ReadDesignations(hb.x,hb.y,hb.z, &designations);
+ df_block * b = Maps->getBlock(hb.x,hb.y,hb.z);
for (uint32_t i = 0; i < 16;i++) for (uint32_t j = 0; j < 16;j++)
{
- designations[i][j].bits.hidden = hb.hiddens[i][j];
+ b->designation[i][j].bits.hidden = hb.hiddens[i][j];
}
- Maps->WriteDesignations(hb.x,hb.y,hb.z, &designations);
}
// give back memory.
hidesaved.clear();