Use Init() for all screens, so we can set state before the base class

members are loaded--they'll see resets, score finalization, etc.  It
also results in smaller code, due to a g++ bug that causes constructors
to be emitted several times.
This commit is contained in:
Glenn Maynard
2005-02-23 06:29:05 +00:00
parent 1213a2c9b0
commit b51b0cfb4c
100 changed files with 349 additions and 42 deletions
+8 -3
View File
@@ -32,15 +32,20 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName )
{
LOG->Trace("ScreenUnlock::ScreenUnlock()");
unsigned NumUnlocks = NUM_UNLOCKS;
if (UNLOCKMAN->m_SongEntries.size() < NumUnlocks)
NumUnlocks = UNLOCKMAN->m_SongEntries.size();
unsigned NumUnlocks = min( (unsigned) NUM_UNLOCKS, UNLOCKMAN->m_SongEntries.size() );
if (!PREFSMAN->m_bUseUnlockSystem || NumUnlocks == 0)
{
this->HandleScreenMessage( SM_GoToNextScreen );
return;
}
}
void ScreenUnlock::Init()
{
ScreenAttract::Init();
unsigned NumUnlocks = min( (unsigned) NUM_UNLOCKS, UNLOCKMAN->m_SongEntries.size() );
PointsUntilNextUnlock.LoadFromFont( THEME->GetPathF("Common","normal") );
PointsUntilNextUnlock.SetHorizAlign( Actor::align_left );