unload BGA for screens that don't have a background

This commit is contained in:
Chris Danford
2004-12-11 10:22:42 +00:00
parent 7d26f28dee
commit 083db90df8
+15 -11
View File
@@ -355,20 +355,24 @@ retry:
} }
// Load shared BGAnimation // Load shared BGAnimation
CString sNewBGA;
if( pNewScreen->UsesBackground() ) if( pNewScreen->UsesBackground() )
sNewBGA = THEME->GetPathToB(sScreenName+" background");
if( sNewBGA.empty() )
{ {
CString sNewBGA = THEME->GetPathToB(sScreenName+" background"); m_pSharedBGA->Unload();
if( m_sLastLoadedBackground != sNewBGA ) m_sLastLoadedBackground = "";
{ }
// Create the new background before deleting the previous so that we keep else if( m_sLastLoadedBackground != sNewBGA )
// any common textures loaded. {
BGAnimation *pNewBGA = new BGAnimation; // Create the new background before deleting the previous so that we keep
pNewBGA->LoadFromAniDir( sNewBGA ); // any common textures loaded.
SAFE_DELETE( m_pSharedBGA ); BGAnimation *pNewBGA = new BGAnimation;
m_pSharedBGA = pNewBGA; pNewBGA->LoadFromAniDir( sNewBGA );
SAFE_DELETE( m_pSharedBGA );
m_pSharedBGA = pNewBGA;
m_sLastLoadedBackground = sNewBGA; m_sLastLoadedBackground = sNewBGA;
}
} }
bool bWasOnSystemMenu = GAMESTATE->m_bIsOnSystemMenu; bool bWasOnSystemMenu = GAMESTATE->m_bIsOnSystemMenu;