diff --git a/dfhack/DFHackAPI.cpp b/dfhack/DFHackAPI.cpp index 7b45b5a17..b023ccbd6 100644 --- a/dfhack/DFHackAPI.cpp +++ b/dfhack/DFHackAPI.cpp @@ -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; } diff --git a/tools/reveal.cpp b/tools/reveal.cpp index 127923f43..82da1b2fe 100644 --- a/tools/reveal.cpp +++ b/tools/reveal.cpp @@ -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];