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 -5
View File
@@ -24,17 +24,20 @@
REGISTER_SCREEN_CLASS( ScreenAttract );
ScreenAttract::ScreenAttract( CString sName, bool bResetGameState ) : Screen( sName )
{
LOG->Trace( "ScreenAttract::ScreenAttract(%s)", m_sName.c_str() );
if( bResetGameState )
GAMESTATE->Reset();
// increment times through attract count
if( m_sName == INITIAL_SCREEN.GetValue() )
GAMESTATE->m_iNumTimesThroughAttract++;
}
if( bResetGameState )
GAMESTATE->Reset();
void ScreenAttract::Init()
{
LOG->Trace( "ScreenAttract::ScreenAttract(%s)", m_sName.c_str() );
Screen::Init();
// We have to do initialization in the first update because this->GetElementName() won't
// work until the object has been fully constructed.
m_In.Load( THEME->GetPathB(m_sName,"in") );
m_In.StartTransitioning();
m_In.SetDrawOrder( DRAW_ORDER_TRANSITIONS );