From 25f5db1b4c7ec6c7b700a438288233d1a6b549a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Mon, 19 Apr 2010 14:14:37 +0200 Subject: [PATCH] Invalidate all modules on Detach(), fix reveal. --- dfhack/DFHackAPI.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++ tools/reveal.cpp | 4 +++- 2 files changed, 59 insertions(+), 1 deletion(-) 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];