Re #209 Make it simpler to inhibit unloading of graphics module when exiting Race Select menu or even the game

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3960 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: b840ce1e14522d5525aebe076feb96978c0ed35b
Former-commit-id: 8cc51542cac22522ac8fc4364774644c34a929cb
This commit is contained in:
pouillot 2011-10-09 10:11:40 +00:00
parent aaefb2e991
commit b8392473c1
3 changed files with 15 additions and 11 deletions

View file

@ -96,7 +96,7 @@ void LegacyMenu::shutdown()
unloadCarsGraphics();
shutdownGraphicsView();
unloadTrackGraphics();
shutdownGraphics();
shutdownGraphics(/*bUnloadModule=*/true);
}
}
@ -430,22 +430,25 @@ void LegacyMenu::shutdownGraphicsView()
}
}
void LegacyMenu::shutdownGraphics()
void LegacyMenu::shutdownGraphics(bool bUnloadModule)
{
// Do nothing if the module has already been unloaded.
if (!_piGraphicsEngine)
return;
// Unload the graphics module.
GfModule* pmodGrEngine = dynamic_cast<GfModule*>(_piGraphicsEngine);
GfModule::unload(pmodGrEngine);
if (bUnloadModule)
{
// Unload the graphics module.
GfModule* pmodGrEngine = dynamic_cast<GfModule*>(_piGraphicsEngine);
GfModule::unload(pmodGrEngine);
// And remember it was.
_piGraphicsEngine = 0;
// And remember it was.
_piGraphicsEngine = 0;
}
// A little consistency check.
if (_bfGraphicsState)
GfLogWarning("Graphics engine shutdown procedure not smartly completed (state = 0x%x)\n",
GfLogWarning("Graphics shutdown procedure not smartly completed (state = 0x%x)\n",
_bfGraphicsState);
}

View file

@ -52,7 +52,7 @@ extern "C" int LEGACYMENU_API closeGfModule();
// The module main class (inherits GfModule, and implements IUserInterface).
class LEGACYMENU_API LegacyMenu : public GfModule, public IUserInterface
{
// Implementation of IUserInterface.
// Implementation of IUserInterface.
public:
//! Activation of the user interface (splash if any, main menu ...).
@ -97,6 +97,7 @@ public:
// Setter for the race engine.
virtual void setRaceEngine(IRaceEngine& raceEngine);
// Other services.
public:
// Accessor to the singleton.
@ -107,7 +108,7 @@ public:
// Graphics engine control.
void redrawGraphicsView(struct Situation* pSituation);
void shutdownGraphics();
void shutdownGraphics(bool bUnloadModule = true);
// Loading screen management.
virtual void activateLoadingScreen();

View file

@ -61,7 +61,7 @@ rmOnRaceSelectShutdown(void *prevMenu)
LmRaceEngine().cleanup();
LegacyMenu::self().shutdownGraphics();
LegacyMenu::self().shutdownGraphics(/*bUnloadModule=*/true);
}