cleanup options comparison

This commit is contained in:
Chris Danford
2004-01-11 04:33:21 +00:00
parent 1d7983cdaa
commit 2767e78218
5 changed files with 13 additions and 15 deletions
+3 -9
View File
@@ -28,7 +28,6 @@ void ModeChoice::Init()
m_bInvalid = true;
}
bool ComparePlayerOptions( const PlayerOptions &po1, const PlayerOptions &po2 );
bool CompareSongOptions( const SongOptions &so1, const SongOptions &so2 );
bool ModeChoice::DescribesCurrentModeForAllPlayers() const
@@ -66,14 +65,9 @@ bool ModeChoice::DescribesCurrentMode( PlayerNumber pn ) const
po.FromString( m_sModifiers );
so.FromString( m_sModifiers );
/* Did anything change? */
bool Changed = false;
if( !ComparePlayerOptions(po, GAMESTATE->m_PlayerOptions[pn]) )
Changed = true;
if( !CompareSongOptions(so, GAMESTATE->m_SongOptions) )
Changed = true;
if( Changed )
if( po != GAMESTATE->m_PlayerOptions[pn] )
return false;
if( so != GAMESTATE->m_SongOptions )
return false;
}
+2 -3
View File
@@ -465,9 +465,9 @@ float PlayerOptions::GetReversePercentForColumn( int iCol )
return f;
}
bool ComparePlayerOptions( const PlayerOptions &po1, const PlayerOptions &po2 )
bool PlayerOptions::operator==( const PlayerOptions &other )
{
#define COMPARE(x) { if( po1.x != po2.x ) return false; }
#define COMPARE(x) { if( x != other.x ) return false; }
COMPARE(m_bTimeSpacing);
COMPARE(m_fScrollSpeed);
COMPARE(m_fScrollBPM);
@@ -492,6 +492,5 @@ bool ComparePlayerOptions( const PlayerOptions &po1, const PlayerOptions &po2 )
for( i = 0; i < PlayerOptions::NUM_TRANSFORMS; ++i )
COMPARE(m_bTransforms[i]);
#undef COMPARE
return true;
}
+3
View File
@@ -20,6 +20,9 @@ struct PlayerOptions
void FromString( CString sOptions );
void ChooseRandomMofifiers();
bool operator==( const PlayerOptions &other );
bool operator!=( const PlayerOptions &other ) { return !operator==(other); }
enum Accel {
ACCEL_BOOST,
+2 -3
View File
@@ -126,9 +126,9 @@ void SongOptions::FromString( CString sOptions )
}
}
bool CompareSongOptions( const SongOptions &so1, const SongOptions &so2 )
bool SongOptions::operator==( const SongOptions &other )
{
#define COMPARE(x) { if( so1.x != so2.x ) return false; }
#define COMPARE(x) { if( x != other.x ) return false; }
COMPARE( m_LifeType );
COMPARE( m_DrainType );
COMPARE( m_iBatteryLives );
@@ -138,6 +138,5 @@ bool CompareSongOptions( const SongOptions &so1, const SongOptions &so2 )
COMPARE( m_bAutoSync );
COMPARE( m_bSaveScore );
#undef COMPARE
return true;
}
+3
View File
@@ -29,6 +29,9 @@ struct SongOptions
void Init();
CString GetString() const;
void FromString( CString sOptions );
bool operator==( const SongOptions &other );
bool operator!=( const SongOptions &other ) { return !operator==(other); }
};
#endif