Fix ScreenJukebox when there are no matching steps

Also makes minor tweaks to the SetSong function and adds a SystemMessage to
display that no steps have been found.  When this happens, the ScreenJukebox
will return to its PrevScreen.
This commit is contained in:
Devin J. Pohly
2013-06-09 17:22:43 -04:00
parent 8d50a47d49
commit ec23a019e2
4 changed files with 13 additions and 6 deletions
+7 -4
View File
@@ -41,6 +41,10 @@ void ScreenJukebox::SetSong()
if ( vSongs.size() == 0 )
vSongs = SONGMAN->GetSongs( GAMESTATE->m_sPreferredSongGroup );
// Still nothing?
if( vSongs.size() == 0 )
return;
// Calculate what difficulties to show
vector<Difficulty> vDifficultiesToShow;
@@ -68,9 +72,6 @@ void ScreenJukebox::SetSong()
// Search for a Song and Steps to play during the demo.
for( int i=0; i<1000; i++ )
{
if( vSongs.size() == 0 )
return;
Song* pSong = vSongs[RandomInt(vSongs.size())];
ASSERT( pSong != NULL );
@@ -169,6 +170,7 @@ ScreenJukebox::ScreenJukebox()
m_pCourseEntry = NULL;
}
static LocalizedString NO_MATCHING_STEPS("ScreenJukebox", "NoMatchingSteps");
void ScreenJukebox::Init()
{
// ScreenJukeboxMenu must set this
@@ -228,7 +230,8 @@ void ScreenJukebox::Init()
if( GAMESTATE->m_pCurSong == NULL ) // we didn't find a song.
{
this->PostScreenMessage( SM_GoToNextScreen, 0 ); // Abort demonstration.
SCREENMAN->SystemMessage( NO_MATCHING_STEPS );
this->PostScreenMessage( SM_GoToPrevScreen, 0 ); // Abort demonstration.
return;
}