From 808643d39bb14d9791be2c42829578c112cddecb Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 17 Aug 2006 01:23:25 +0000 Subject: [PATCH] merge code --- stepmania/src/ScreenSelectMusic.cpp | 77 ++++++++++------------------- 1 file changed, 25 insertions(+), 52 deletions(-) diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 6efb5c7886..d1bf519af3 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -589,47 +589,21 @@ void ScreenSelectMusic::ChangeDifficulty( PlayerNumber pn, int dir ) { case TYPE_SONG: case TYPE_PORTAL: - { - m_iSelection[pn] += dir; - if( CLAMP(m_iSelection[pn],0,m_vpSteps.size()-1) ) - return; - - // the user explicity switched difficulties. Update the preferred difficulty - GAMESTATE->ChangePreferredDifficulty( pn, m_vpSteps[ m_iSelection[pn] ]->GetDifficulty() ); - - vector vpns; - FOREACH_HumanPlayer( p ) - { - if( pn == p || GAMESTATE->DifficultiesLocked() ) - { - m_iSelection[p] = m_iSelection[pn]; - vpns.push_back( p ); - } - } - AfterStepsOrTrailChange( vpns ); - } + m_iSelection[pn] += dir; + if( CLAMP(m_iSelection[pn],0,m_vpSteps.size()-1) ) + return; + + // the user explicity switched difficulties. Update the preferred difficulty + GAMESTATE->ChangePreferredDifficulty( pn, m_vpSteps[ m_iSelection[pn] ]->GetDifficulty() ); break; case TYPE_COURSE: - { - m_iSelection[pn] += dir; - if( CLAMP(m_iSelection[pn],0,m_vpTrails.size()-1) ) - return; + m_iSelection[pn] += dir; + if( CLAMP(m_iSelection[pn],0,m_vpTrails.size()-1) ) + return; - // the user explicity switched difficulties. Update the preferred difficulty - GAMESTATE->ChangePreferredCourseDifficulty( pn, m_vpTrails[ m_iSelection[pn] ]->m_CourseDifficulty ); - - vector vpns; - FOREACH_HumanPlayer( p ) - { - if( pn == p || GAMESTATE->DifficultiesLocked() ) - { - m_iSelection[p] = m_iSelection[pn]; - vpns.push_back( p ); - } - } - AfterStepsOrTrailChange( vpns ); - } + // the user explicity switched difficulties. Update the preferred difficulty + GAMESTATE->ChangePreferredCourseDifficulty( pn, m_vpTrails[ m_iSelection[pn] ]->m_CourseDifficulty ); break; case TYPE_RANDOM: @@ -638,22 +612,10 @@ void ScreenSelectMusic::ChangeDifficulty( PlayerNumber pn, int dir ) /* XXX: We could be on a music or course sort, or even one with both; we don't * really know which difficulty to change. Maybe the two difficulties should be * linked ... */ - { - if( !GAMESTATE->ChangePreferredDifficulty( pn, dir ) ) - return; + if( !GAMESTATE->ChangePreferredDifficulty( pn, dir ) ) + return; + break; - vector vpns; - FOREACH_HumanPlayer( p ) - { - if( pn == p || GAMESTATE->DifficultiesLocked() ) - { - m_iSelection[p] = m_iSelection[pn]; - vpns.push_back( p ); - } - } - AfterStepsOrTrailChange( vpns ); - break; - } case TYPE_SORT: return; default: @@ -661,6 +623,17 @@ void ScreenSelectMusic::ChangeDifficulty( PlayerNumber pn, int dir ) break; } + vector vpns; + FOREACH_HumanPlayer( p ) + { + if( pn == p || GAMESTATE->DifficultiesLocked() ) + { + m_iSelection[p] = m_iSelection[pn]; + vpns.push_back( p ); + } + } + AfterStepsOrTrailChange( vpns ); + if( dir < 0 ) m_soundDifficultyEasier.Play(); else