don't DQ because of forced mods

This commit is contained in:
Chris Danford
2006-03-26 17:48:39 +00:00
parent fc3312f9be
commit ee8329cee6
6 changed files with 24 additions and 11 deletions
+12 -4
View File
@@ -1038,10 +1038,14 @@ void GameState::ApplyModifiers( PlayerNumber pn, RString sModifiers )
void GameState::StoreSelectedOptions()
{
FOREACH_PlayerNumber( pn )
{
m_pPlayerState[pn]->m_StoredPlayerOptions = m_pPlayerState[pn]->m_PlayerOptions;
m_StoredSongOptions = m_SongOptions;
}
void GameState::StoreStageOptions()
{
FOREACH_PlayerNumber( pn )
m_pPlayerState[pn]->m_StagePlayerOptions = m_pPlayerState[pn]->m_PlayerOptions;
}
m_StoredSongOptions = m_SongOptions;
}
@@ -1078,15 +1082,19 @@ bool GameState::IsDisqualified( PlayerNumber pn )
if( !GAMESTATE->IsHumanPlayer(pn) )
return false;
const PlayerOptions &po = GAMESTATE->m_pPlayerState[pn]->m_StoredPlayerOptions;
// Check the stored player options for disqualify. Don't disqualify because
// of mods that were forced.
if( GAMESTATE->IsCourseMode() )
{
return GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.IsEasierForCourseAndTrail(
return po.IsEasierForCourseAndTrail(
GAMESTATE->m_pCurCourse,
GAMESTATE->m_pCurTrail[pn] );
}
else
{
return GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.IsEasierForSongAndSteps(
return po.IsEasierForSongAndSteps(
GAMESTATE->m_pCurSong,
GAMESTATE->m_pCurSteps[pn] );
}
+1
View File
@@ -208,6 +208,7 @@ public:
void GetDefaultSongOptions( SongOptions &so );
void ApplyModifiers( PlayerNumber pn, RString sModifiers );
void StoreSelectedOptions();
void StoreStageOptions();
void RestoreSelectedOptions();
void RestoreStageOptions();
void ResetCurrentOptions();
+2 -2
View File
@@ -574,7 +574,7 @@ bool PlayerOptions::operator==( const PlayerOptions &other ) const
return true;
}
bool PlayerOptions::IsEasierForSongAndSteps( Song* pSong, Steps* pSteps )
bool PlayerOptions::IsEasierForSongAndSteps( Song* pSong, Steps* pSteps ) const
{
if( m_fTimeSpacing && pSong->HasSignificantBpmChangesOrStops() )
return true;
@@ -606,7 +606,7 @@ bool PlayerOptions::IsEasierForSongAndSteps( Song* pSong, Steps* pSteps )
return false;
}
bool PlayerOptions::IsEasierForCourseAndTrail( Course* pCourse, Trail* pTrail )
bool PlayerOptions::IsEasierForCourseAndTrail( Course* pCourse, Trail* pTrail ) const
{
ASSERT( pCourse );
ASSERT( pTrail );
+2 -2
View File
@@ -157,8 +157,8 @@ public:
// return true if any mods being used will make the song(s) easier
bool IsEasierForSongAndSteps( Song* pSong, Steps* pSteps );
bool IsEasierForCourseAndTrail( Course* pCourse, Trail* pTrail );
bool IsEasierForSongAndSteps( Song* pSong, Steps* pSteps ) const;
bool IsEasierForCourseAndTrail( Course* pCourse, Trail* pTrail ) const;
};
#endif
+6 -3
View File
@@ -378,8 +378,14 @@ void ScreenGameplay::Init( bool bUseSongBackgroundAndForeground )
this->FillPlayerInfo( m_vPlayerInfo );
ASSERT_M( !m_vPlayerInfo.empty(), "m_vPlayerInfo must be filled by FillPlayerInfo" );
/* Save selected options before we change them in ScreenInitCommand. */
GAMESTATE->StoreSelectedOptions();
ScreenWithMenuElements::Init();
/* Save selected stage options now that we've changed them in ScreenInitCommand. */
GAMESTATE->StoreStageOptions();
/* Pause MEMCARDMAN. If a memory card is removed, we don't want to interrupt the
* player by making a noise until the game finishes. */
if( !GAMESTATE->m_bDemonstrationOrJukebox )
@@ -398,9 +404,6 @@ void ScreenGameplay::Init( bool bUseSongBackgroundAndForeground )
if( GAMESTATE->m_pCurSong == NULL && GAMESTATE->m_pCurCourse == NULL )
return; // ScreenDemonstration will move us to the next screen. We just need to survive for one update without crashing.
/* Save selected options before we change them. */
GAMESTATE->StoreSelectedOptions();
/* Save settings to the profile now. Don't do this on extra stages, since the
* user doesn't have full control; saving would force profiles to DIFFICULTY_HARD
* and save over their default modifiers every time someone got an extra stage.
+1
View File
@@ -160,6 +160,7 @@ void ScreenPlayerOptions::UpdateDisqualified( int row, PlayerNumber pn )
vector<PlayerNumber> v;
v.push_back( pn );
ExportOptions( row, v );
GAMESTATE->StoreSelectedOptions();
bool bRowCausesDisqualified = GAMESTATE->IsDisqualified( pn );
m_bRowCausesDisqualified[pn][row] = bRowCausesDisqualified;