Fix: Strange difficulty inselectability.

This commit is contained in:
Charles Lohr
2004-10-26 19:28:29 +00:00
parent 8befe32ebb
commit 0e34a1497a
+54 -24
View File
@@ -17,7 +17,6 @@
#include "NetworkSyncManager.h" #include "NetworkSyncManager.h"
#include "StepsUtil.h" #include "StepsUtil.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "RageLog.h"
#define CHATINPUT_WIDTH THEME->GetMetricF("ScreenNetSelectMusic","ChatInputBoxWidth") #define CHATINPUT_WIDTH THEME->GetMetricF("ScreenNetSelectMusic","ChatInputBoxWidth")
#define CHATINPUT_HEIGHT THEME->GetMetricF("ScreenNetSelectMusic","ChatInputBoxHeight") #define CHATINPUT_HEIGHT THEME->GetMetricF("ScreenNetSelectMusic","ChatInputBoxHeight")
@@ -498,15 +497,20 @@ void ScreenNetSelectMusic::MenuLeft( PlayerNumber pn, const InputEventType type
else else
{ {
int i; int i;
for ( i=0; i<(int)MultiSteps.size(); ++i ) bool dcs[NUM_DIFFICULTIES];
if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] )
break;
if ( i == (int)MultiSteps.size() ) for ( i=0; i<NUM_DIFFICULTIES; ++i )
m_DC[pn] = MultiSteps[i-1]->GetDifficulty(); dcs[i] = false;
else
if (i > 0) //If we are at the easiest difficulty, do nothign for ( i=0; i<(int)MultiSteps.size(); ++i )
m_DC[pn] = MultiSteps[i-1]->GetDifficulty(); dcs[MultiSteps[i]->GetDifficulty()] = true;
for ( i=NUM_DIFFICULTIES-1; i>=0; --i )
if ( (dcs[i]) && (i < m_DC[pn]) )
{
m_DC[pn] = (Difficulty)i;
break;
}
} }
UpdateDifficulties( pn ); UpdateDifficulties( pn );
GAMESTATE->m_PreferredDifficulty[pn] = m_DC[pn]; GAMESTATE->m_PreferredDifficulty[pn] = m_DC[pn];
@@ -546,15 +550,25 @@ void ScreenNetSelectMusic::MenuRight( PlayerNumber pn, const InputEventType type
else else
{ {
int i; int i;
for ( i=0; i<(int)MultiSteps.size(); ++i )
if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] )
break;
if ( i == (int)MultiSteps.size() ) bool dcs[NUM_DIFFICULTIES];
m_DC[pn] = MultiSteps[i-1]->GetDifficulty();
else for ( i=0; i<NUM_DIFFICULTIES; ++i )
if (i < (int)MultiSteps.size() - 1 ) //If we are at the hardest difficulty, do nothign dcs[i] = false;
m_DC[pn] = MultiSteps[i+1]->GetDifficulty();
for ( i=0; i<(int)MultiSteps.size(); ++i )
dcs[MultiSteps[i]->GetDifficulty()] = true;
for ( i=0; i<NUM_DIFFICULTIES; ++i )
{
if ( (dcs[i]) && (i > m_DC[pn]) )
{
m_DC[pn] = (Difficulty)i;
break;
}
}
} }
UpdateDifficulties( pn ); UpdateDifficulties( pn );
GAMESTATE->m_PreferredDifficulty[pn] = m_DC[pn]; GAMESTATE->m_PreferredDifficulty[pn] = m_DC[pn];
@@ -728,14 +742,30 @@ void ScreenNetSelectMusic::UpdateSongsListPos()
m_DC[pn] = NUM_DIFFICULTIES; m_DC[pn] = NUM_DIFFICULTIES;
else else
{ {
for ( i=0; i<(int)MultiSteps.size(); ++i ) int i;
if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] ) Difficulty Target;
break;
if ( i == (int)MultiSteps.size() ) bool dcs[NUM_DIFFICULTIES];
m_DC[pn] = MultiSteps[i-1]->GetDifficulty();
else for ( i=0; i<NUM_DIFFICULTIES; ++i )
m_DC[pn] = MultiSteps[i]->GetDifficulty(); dcs[i] = false;
for ( i=0; i<(int)MultiSteps.size(); ++i )
dcs[MultiSteps[i]->GetDifficulty()] = true;
for ( i=0; i<NUM_DIFFICULTIES; ++i )
if ( dcs[i] )
{
Target = (Difficulty)i;
if ( i >= m_DC[pn] )
{
m_DC[pn] = (Difficulty)i;
break;
}
}
if ( i == NUM_DIFFICULTIES )
m_DC[pn] = Target;
} }
UpdateDifficulties( pn ); UpdateDifficulties( pn );
} }