Permalink
Browse files

Invalidate all modules on Detach(), fix reveal.

  • Loading branch information...
1 parent 4bff245 commit 25f5db1b4c7ec6c7b700a438288233d1a6b549a8 @peterix peterix committed Apr 19, 2010
Showing with 59 additions and 1 deletion.
  1. +56 −0 dfhack/DFHackAPI.cpp
  2. +3 −1 tools/reveal.cpp
View
@@ -113,6 +113,62 @@ bool API::Detach()
d->p = NULL;
d->shm_start = 0;
d->offset_descriptor = NULL;
+ // invalidate all modules
+ if(d->creatures)
+ {
+ delete d->creatures;
+ d->creatures = 0;
+ }
+ if(d->creatures)
+ {
+ delete d->creatures;
+ d->creatures = 0;
+ }
+ if(d->maps)
+ {
+ delete d->maps;
+ d->maps = 0;
+ }
+ if(d->gui)
+ {
+ delete d->gui;
+ d->gui = 0;
+ }
+ if(d->position)
+ {
+ delete d->position;
+ d->position = 0;
+ }
+ if(d->materials)
+ {
+ delete d->materials;
+ d->materials = 0;
+ }
+ if(d->gui)
+ {
+ delete d->gui;
+ d->gui = 0;
+ }
+ if(d->translation)
+ {
+ delete d->translation;
+ d->translation = 0;
+ }
+ if(d->vegetation)
+ {
+ delete d->vegetation;
+ d->vegetation = 0;
+ }
+ if(d->constructions)
+ {
+ delete d->constructions;
+ d->constructions = 0;
+ }
+ if(d->translation)
+ {
+ delete d->translation;
+ d->translation = 0;
+ }
return true;
}
View
@@ -85,8 +85,10 @@ int main (void)
cout << "Press any key to unreveal. Don't close DF or unpause in that case!" << endl;
cin.ignore();
cout << "Unrevealing... please wait." << endl;
- DF.Attach();
// FIXME: do some consistency checks here!
+ DF.Attach();
+ Maps = DF.getMaps();
+ Maps->Start();
for(int i = 0; i < hidesaved.size();i++)
{
hideblock & hb = hidesaved[i];

0 comments on commit 25f5db1

Please sign in to comment.