Simplify delayed/undelayed screen load path. Previously, the "delayed"

path would return immediately in SetNewScreen, loading in the next update,
and the "undelayed" path would load under SetNewScreen.  Instead, always
load on the next update, and just change the behavior (with "delayed" deleting
the old screen first).  These two code paths are both criticial, and they were
too different, leading to inconsistent behavior; this way is simpler.
This commit is contained in:
Glenn Maynard
2005-06-19 08:35:12 +00:00
parent 0bc5c2ede4
commit 63cc873fc9
+15 -14
View File
@@ -191,16 +191,23 @@ void ScreenManager::Update( float fDeltaTime )
EmptyDeleteQueue();
if(m_sDelayedScreen.size() != 0)
if( m_sDelayedScreen.size() != 0 )
{
/* We have a screen to display. Delete the current screens and load it. */
ClearScreenStack();
EmptyDeleteQueue();
/* We have a screen to display. Delete the current screens and load it.
* If DelayedScreenLoad is true, clear the old screen first; this lowers
* memory requirements, but results in redundant loads as we unload common
* data. (If we don't unload the old screen here, it'll be deleted when
* we load the new screen.) */
if( PREFSMAN->m_bDelayedScreenLoad )
{
ClearScreenStack();
EmptyDeleteQueue();
/* This is the purpose of delayed screen loads: clear out the texture cache
* now, while there's (mostly) nothing loaded. */
TEXTUREMAN->DeleteCachedTextures();
TEXTUREMAN->DiagnosticOutput();
/* This is the purpose of delayed screen loads: clear out the texture cache
* now, while there's (mostly) nothing loaded. */
TEXTUREMAN->DeleteCachedTextures();
TEXTUREMAN->DiagnosticOutput();
}
LoadDelayedScreen();
}
@@ -370,12 +377,6 @@ void ScreenManager::SetNewScreen( const CString &sScreenName )
{
ASSERT( sScreenName != "" );
m_sDelayedScreen = sScreenName;
/* If we're not delaying screen loads, load it now. Otherwise, we'll load
* it on the next iteration. Only delay if we already have a screen
* loaded; otherwise, there's no reason to delay. */
if(!PREFSMAN->m_bDelayedScreenLoad) // || m_ScreenStack.empty() )
LoadDelayedScreen();
}
void ScreenManager::LoadDelayedScreen()