Invalidate all modules on Detach(), fix reveal.

develop
Petr Mrázek 2010-04-19 14:14:37 +02:00
parent 4bff245ab8
commit 25f5db1b4c
2 changed files with 59 additions and 1 deletions

@ -113,6 +113,62 @@ bool API::Detach()
d->p = NULL; d->p = NULL;
d->shm_start = 0; d->shm_start = 0;
d->offset_descriptor = NULL; 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; return true;
} }

@ -85,8 +85,10 @@ int main (void)
cout << "Press any key to unreveal. Don't close DF or unpause in that case!" << endl; cout << "Press any key to unreveal. Don't close DF or unpause in that case!" << endl;
cin.ignore(); cin.ignore();
cout << "Unrevealing... please wait." << endl; cout << "Unrevealing... please wait." << endl;
DF.Attach();
// FIXME: do some consistency checks here! // FIXME: do some consistency checks here!
DF.Attach();
Maps = DF.getMaps();
Maps->Start();
for(int i = 0; i < hidesaved.size();i++) for(int i = 0; i < hidesaved.size();i++)
{ {
hideblock & hb = hidesaved[i]; hideblock & hb = hidesaved[i];