diff --git a/stepmania/src/ModeChoice.cpp b/stepmania/src/ModeChoice.cpp index ac8f7b84dd..d9e9ae9fd2 100644 --- a/stepmania/src/ModeChoice.cpp +++ b/stepmania/src/ModeChoice.cpp @@ -19,7 +19,30 @@ void ModeChoice::Init() numSidesJoinedToPlay = 1; } -bool ModeChoice::FromString( CString sChoice ) +bool ModeChoice::DescribesCurrentMode() const +{ + if( game != GAME_INVALID && game != GAMESTATE->m_CurGame ) + return false; + if( game != GAME_INVALID && GAMESTATE->m_CurGame != game ) + return false; + if( pm != PLAY_MODE_INVALID && GAMESTATE->m_PlayMode != pm ) + return false; + if( style != STYLE_INVALID && GAMESTATE->m_CurStyle != style ) + return false; + if( dc != DIFFICULTY_INVALID ) + { + for( int pn=0; pnIsHumanPlayer(pn) && GAMESTATE->m_PreferredDifficulty[pn] != dc ) + return false; + } + + if( sAnnouncer != "" && sAnnouncer != ANNOUNCER->GetCurAnnouncerName() ) + return false; + + return true; +} + +bool ModeChoice::FromString( CString sChoice, bool bIgnoreUnknown ) { strncpy( this->name, sChoice, min(sChoice.size()+1, sizeof(this->name)) ); sChoice[sizeof(this->name)-1] = 0; @@ -62,10 +85,13 @@ bool ModeChoice::FromString( CString sChoice ) continue; } - CString sError = ssprintf( "The choice token '%s' is not recognized as a Game, Style, PlayMode, or Difficulty. The choice containing this token will be ignored.", sBit.c_str() ); - LOG->Warn( sError ); - if( DISPLAY->IsWindowed() ) - HOOKS->MessageBoxOK( sError ); + if( !bIgnoreUnknown ) + { + CString sError = ssprintf( "The choice token '%s' is not recognized as a Game, Style, PlayMode, or Difficulty. The choice containing this token will be ignored.", sBit.c_str() ); + LOG->Warn( sError ); + if( DISPLAY->IsWindowed() ) + HOOKS->MessageBoxOK( sError ); + } bChoiceIsInvalid |= true; } diff --git a/stepmania/src/ModeChoice.h b/stepmania/src/ModeChoice.h index c4258d6c3c..0725fd4797 100644 --- a/stepmania/src/ModeChoice.h +++ b/stepmania/src/ModeChoice.h @@ -21,9 +21,10 @@ struct ModeChoice // used in SelectMode ModeChoice() { Init(); } void Init(); - bool FromString( CString str ); + bool FromString( CString str, bool bIgnoreUnknown=false ); void ApplyToAllPlayers(); void Apply( PlayerNumber pn ); + bool DescribesCurrentMode() const; Game game; Style style;