From d6c88f2c3c2b63105b8cb55602fcb7717046b510 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 31 Jul 2003 22:49:22 +0000 Subject: [PATCH] Fix crash with one character. --- stepmania/src/ScreenHowToPlay.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/stepmania/src/ScreenHowToPlay.cpp b/stepmania/src/ScreenHowToPlay.cpp index b0c5542b01..3ee0aa77a1 100644 --- a/stepmania/src/ScreenHowToPlay.cpp +++ b/stepmania/src/ScreenHowToPlay.cpp @@ -52,15 +52,18 @@ ScreenHowToPlay::ScreenHowToPlay() : ScreenAttract("ScreenHowToPlay") // Display character - int iRnd; - iRnd = rand() % (GAMESTATE->m_pCharacters.size()-1); - if( iRnd != 0 ) + if( GAMESTATE->m_pCharacters.size() ) { - m_mCharacter.LoadMilkshapeAscii( GAMESTATE->m_pCharacters[iRnd]->GetModelPath() ); - m_mCharacter.LoadMilkshapeAsciiBones("howtoplay", GAMESTATE->m_pCharacters[iRnd]->GetHowToPlayAnimationPath() ); - m_mCharacter.SetZoom(20); - m_mCharacter.Command("X,150;Y,300;Zoom,15;RotationY,180;sleep,4.7;linear,1.0;RotationY,360;Zoom,20;X,100;Y,425"); - this->AddChild(&m_mCharacter); + int iRnd; + iRnd = rand() % ( GAMESTATE->m_pCharacters.size() ); + if( iRnd != 0 ) + { + m_mCharacter.LoadMilkshapeAscii( GAMESTATE->m_pCharacters[iRnd]->GetModelPath() ); + m_mCharacter.LoadMilkshapeAsciiBones("howtoplay", GAMESTATE->m_pCharacters[iRnd]->GetHowToPlayAnimationPath() ); + m_mCharacter.SetZoom(20); + m_mCharacter.Command("X,150;Y,300;Zoom,15;RotationY,180;sleep,4.7;linear,1.0;RotationY,360;Zoom,20;X,100;Y,425"); + this->AddChild(&m_mCharacter); + } } // @@ -201,7 +204,7 @@ void ScreenHowToPlay::HandleScreenMessage( const ScreenMessage SM ) { case SM_BeginFadingOut: /* We can't do this in ScreenHowToPlay::~ScreenHowToPlay, since that happens - * after the actor of the next screen; we don't want to mess with its state. */ + * after the ctor of the next screen; we don't want to mess with its state. */ GAMESTATE->m_pCurSong = NULL; break; }