From 0e34a1497a0cc41597572150b1590dcb3eccb98a Mon Sep 17 00:00:00 2001 From: Charles Lohr Date: Tue, 26 Oct 2004 19:28:29 +0000 Subject: [PATCH] Fix: Strange difficulty inselectability. --- stepmania/src/ScreenNetSelectMusic.cpp | 78 ++++++++++++++++++-------- 1 file changed, 54 insertions(+), 24 deletions(-) diff --git a/stepmania/src/ScreenNetSelectMusic.cpp b/stepmania/src/ScreenNetSelectMusic.cpp index 9a76b5380c..bbf208526c 100644 --- a/stepmania/src/ScreenNetSelectMusic.cpp +++ b/stepmania/src/ScreenNetSelectMusic.cpp @@ -17,7 +17,6 @@ #include "NetworkSyncManager.h" #include "StepsUtil.h" #include "RageUtil.h" -#include "RageLog.h" #define CHATINPUT_WIDTH THEME->GetMetricF("ScreenNetSelectMusic","ChatInputBoxWidth") #define CHATINPUT_HEIGHT THEME->GetMetricF("ScreenNetSelectMusic","ChatInputBoxHeight") @@ -498,15 +497,20 @@ void ScreenNetSelectMusic::MenuLeft( PlayerNumber pn, const InputEventType type else { int i; - for ( i=0; i<(int)MultiSteps.size(); ++i ) - if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] ) - break; + bool dcs[NUM_DIFFICULTIES]; - if ( i == (int)MultiSteps.size() ) - m_DC[pn] = MultiSteps[i-1]->GetDifficulty(); - else - if (i > 0) //If we are at the easiest difficulty, do nothign - m_DC[pn] = MultiSteps[i-1]->GetDifficulty(); + for ( i=0; iGetDifficulty()] = true; + + for ( i=NUM_DIFFICULTIES-1; i>=0; --i ) + if ( (dcs[i]) && (i < m_DC[pn]) ) + { + m_DC[pn] = (Difficulty)i; + break; + } } UpdateDifficulties( pn ); GAMESTATE->m_PreferredDifficulty[pn] = m_DC[pn]; @@ -546,15 +550,25 @@ void ScreenNetSelectMusic::MenuRight( PlayerNumber pn, const InputEventType type else { int i; - for ( i=0; i<(int)MultiSteps.size(); ++i ) - if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] ) - break; - if ( i == (int)MultiSteps.size() ) - m_DC[pn] = MultiSteps[i-1]->GetDifficulty(); - else - if (i < (int)MultiSteps.size() - 1 ) //If we are at the hardest difficulty, do nothign - m_DC[pn] = MultiSteps[i+1]->GetDifficulty(); + bool dcs[NUM_DIFFICULTIES]; + + for ( i=0; iGetDifficulty()] = true; + + for ( i=0; i m_DC[pn]) ) + { + m_DC[pn] = (Difficulty)i; + break; + } + } + + } UpdateDifficulties( pn ); GAMESTATE->m_PreferredDifficulty[pn] = m_DC[pn]; @@ -728,14 +742,30 @@ void ScreenNetSelectMusic::UpdateSongsListPos() m_DC[pn] = NUM_DIFFICULTIES; else { - for ( i=0; i<(int)MultiSteps.size(); ++i ) - if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] ) - break; + int i; + Difficulty Target; - if ( i == (int)MultiSteps.size() ) - m_DC[pn] = MultiSteps[i-1]->GetDifficulty(); - else - m_DC[pn] = MultiSteps[i]->GetDifficulty(); + bool dcs[NUM_DIFFICULTIES]; + + for ( i=0; iGetDifficulty()] = true; + + for ( i=0; i= m_DC[pn] ) + { + m_DC[pn] = (Difficulty)i; + break; + } + } + + if ( i == NUM_DIFFICULTIES ) + m_DC[pn] = Target; } UpdateDifficulties( pn ); }