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:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user