fix backgrounds put back in prepared list when they should be deleted

This commit is contained in:
Glenn Maynard
2006-06-24 05:07:04 +00:00
parent 08146691e7
commit d27b40598e
+19 -6
View File
@@ -632,12 +632,21 @@ void ScreenManager::SetNewScreen( const RString &sScreenName )
* activated. */ * activated. */
bool ScreenManager::ActivatePreparedScreenAndBackground( const RString &sScreenName ) bool ScreenManager::ActivatePreparedScreenAndBackground( const RString &sScreenName )
{ {
bool bLoadedBoth = true;
// //
// Find the prepped screen. // Find the prepped screen.
// //
LoadedScreen ls; LoadedScreen ls;
if( !GetPreppedScreen(sScreenName, ls) ) if( !GetPreppedScreen(sScreenName, ls) )
return false; {
bLoadedBoth = false;
}
else
{
LOG->Trace("... PushScreen");
PushLoadedScreen( ls );
}
// Find the prepared shared background (if any), and activate it. // Find the prepared shared background (if any), and activate it.
RString sNewBGA = THEME->GetPathB(sScreenName,"background"); RString sNewBGA = THEME->GetPathB(sScreenName,"background");
@@ -660,7 +669,14 @@ bool ScreenManager::ActivatePreparedScreenAndBackground( const RString &sScreenN
} }
} }
} }
ASSERT( pNewBGA != NULL );
/* If the BGA isn't loaded yet, load a dummy actor. If we're not going to use the same
* BGA for the new screen, always move the old BGA back to g_vPreparedBackgrounds now. */
if( pNewBGA == NULL )
{
bLoadedBoth = false;
pNewBGA = new Actor;
}
/* Move the old background back to the prepared list, or delete it if /* Move the old background back to the prepared list, or delete it if
* it's a blank actor. */ * it's a blank actor. */
@@ -672,10 +688,7 @@ bool ScreenManager::ActivatePreparedScreenAndBackground( const RString &sScreenN
g_pSharedBGA->PlayCommand( "On" ); g_pSharedBGA->PlayCommand( "On" );
} }
LOG->Trace("... PushScreen"); return bLoadedBoth;
PushLoadedScreen( ls );
return true;
} }
void ScreenManager::LoadDelayedScreen() void ScreenManager::LoadDelayedScreen()