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(); unloadCarsGraphics();
shutdownGraphicsView(); shutdownGraphicsView();
unloadTrackGraphics(); 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. // Do nothing if the module has already been unloaded.
if (!_piGraphicsEngine) if (!_piGraphicsEngine)
return; return;
if (bUnloadModule)
{
// Unload the graphics module. // Unload the graphics module.
GfModule* pmodGrEngine = dynamic_cast<GfModule*>(_piGraphicsEngine); GfModule* pmodGrEngine = dynamic_cast<GfModule*>(_piGraphicsEngine);
GfModule::unload(pmodGrEngine); GfModule::unload(pmodGrEngine);
// And remember it was. // And remember it was.
_piGraphicsEngine = 0; _piGraphicsEngine = 0;
}
// A little consistency check. // A little consistency check.
if (_bfGraphicsState) 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); _bfGraphicsState);
} }

View file

@ -97,6 +97,7 @@ public:
// Setter for the race engine. // Setter for the race engine.
virtual void setRaceEngine(IRaceEngine& raceEngine); virtual void setRaceEngine(IRaceEngine& raceEngine);
// Other services.
public: public:
// Accessor to the singleton. // Accessor to the singleton.
@ -107,7 +108,7 @@ public:
// Graphics engine control. // Graphics engine control.
void redrawGraphicsView(struct Situation* pSituation); void redrawGraphicsView(struct Situation* pSituation);
void shutdownGraphics(); void shutdownGraphics(bool bUnloadModule = true);
// Loading screen management. // Loading screen management.
virtual void activateLoadingScreen(); virtual void activateLoadingScreen();

View file

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