style cleanup: use FOREACH_ENUM( X, x ) everywhere instead of FOREACH_X( x ) for consistency

The FOREACH_X defines are not very useful, and they were created back before FOREACH_ENUM was convenient.
This commit is contained in:
Chris Danford
2007-02-23 22:29:42 +00:00
parent 808a5d2b2c
commit 0160e23705
33 changed files with 92 additions and 108 deletions
+5 -5
View File
@@ -117,7 +117,7 @@ void CatalogXml::Save( LoadingWindow *loading_window )
iNumStepsInGroupAndStepsType[pSteps->GetDifficulty()]++;
}
}
FOREACH_Difficulty( dc )
FOREACH_ENUM( Difficulty, dc )
p3->AppendChild( DifficultyToString(dc), iNumStepsInGroupAndStepsType[dc] );
}
@@ -299,7 +299,7 @@ void CatalogXml::Save( LoadingWindow *loading_window )
{
XNode* pNode2 = pNode->AppendChild( "PlayMode" );
FOREACH_PlayMode( pm )
FOREACH_ENUM( PlayMode, pm )
{
if( !SHOW_PLAY_MODE(pm) )
continue;
@@ -343,7 +343,7 @@ void CatalogXml::Save( LoadingWindow *loading_window )
{
XNode* pNode2 = pNode->AppendChild( "TapNoteScore" );
FOREACH_TapNoteScore( tns )
FOREACH_ENUM( TapNoteScore, tns )
{
XNode* pNode3 = pNode2->AppendChild( "TapNoteScore", TapNoteScoreToString(tns) );
pNode3->AppendAttr( "DisplayAs", TapNoteScoreToLocalizedString(tns) );
@@ -352,7 +352,7 @@ void CatalogXml::Save( LoadingWindow *loading_window )
{
XNode* pNode2 = pNode->AppendChild( "HoldNoteScore" );
FOREACH_HoldNoteScore( hns )
FOREACH_ENUM( HoldNoteScore, hns )
{
XNode* pNode3 = pNode2->AppendChild( "HoldNoteScore", HoldNoteScoreToString(hns) );
pNode3->AppendAttr( "DisplayAs", HoldNoteScoreToLocalizedString(hns) );
@@ -361,7 +361,7 @@ void CatalogXml::Save( LoadingWindow *loading_window )
{
XNode* pNode2 = pNode->AppendChild( "RadarValue" );
FOREACH_RadarCategory( rc )
FOREACH_ENUM( RadarCategory, rc )
{
XNode* pNode3 = pNode2->AppendChild( "RadarValue", RadarCategoryToString(rc) );
pNode3->AppendAttr( "DisplayAs", RadarCategoryToLocalizedString(rc) );
+4 -4
View File
@@ -206,7 +206,7 @@ void Course::Init()
m_bRepeat = false;
m_bShuffle = false;
m_iLives = -1;
FOREACH_Difficulty(dc)
FOREACH_ENUM( Difficulty,dc)
m_iCustomMeter[dc] = -1;
m_bSortByMeter = false;
@@ -691,7 +691,7 @@ void Course::Invalidate( const Song *pStaleSong )
// If we find a Trail that contains this song, then it's part of a
// non-fixed entry. So, regenerating the Trail will force different
// songs to be chosen.
FOREACH_StepsType( st )
FOREACH_ENUM( StepsType,st )
{
FOREACH_ShownCourseDifficulty( cd )
{
@@ -860,9 +860,9 @@ bool Course::ShowInDemonstrationAndRanking() const
void Course::CalculateRadarValues()
{
FOREACH_StepsType( st )
FOREACH_ENUM( StepsType,st )
{
FOREACH_CourseDifficulty( cd )
FOREACH_ENUM( CourseDifficulty,cd )
{
// For courses that aren't fixed, the radar values are meaningless.
// Makes non-fixed courses have unknown radar values.
+1 -1
View File
@@ -29,7 +29,7 @@ const char *g_CRSDifficultyNames[] =
static CourseDifficulty CRSStringToDifficulty( const RString& s )
{
FOREACH_Difficulty(i)
FOREACH_ENUM( Difficulty,i)
if( !s.CompareNoCase(g_CRSDifficultyNames[i]) )
return i;
return Difficulty_Invalid;
+2 -2
View File
@@ -206,7 +206,7 @@ void CourseUtil::AutogenEndlessFromGroup( const RString &sGroupName, Difficulty
out.m_bRepeat = true;
out.m_bShuffle = true;
out.m_iLives = -1;
FOREACH_Difficulty(dc)
FOREACH_ENUM( Difficulty,dc)
out.m_iCustomMeter[dc] = -1;
if( sGroupName == "" )
@@ -257,7 +257,7 @@ void CourseUtil::AutogenOniFromArtist( const RString &sArtistName, RString sArti
out.m_bSortByMeter = true;
out.m_iLives = 4;
FOREACH_Difficulty(cd)
FOREACH_ENUM( Difficulty,cd)
out.m_iCustomMeter[cd] = -1;
ASSERT( sArtistName != "" );
+1 -1
View File
@@ -45,7 +45,7 @@ bool CourseWriterCRS::Write( const Course &course, RageFileBasic &f, bool bSavin
if( course.m_iLives != -1 )
f.PutLine( ssprintf("#LIVES:%i;", course.m_iLives) );
FOREACH_CourseDifficulty( cd )
FOREACH_ENUM( CourseDifficulty,cd )
{
if( course.m_iCustomMeter[cd] == -1 )
continue;
+1 -1
View File
@@ -56,7 +56,7 @@ const RString &CourseDifficultyToLocalizedString( CourseDifficulty x )
static auto_ptr<LocalizedString> g_CourseDifficultyName[NUM_Difficulty];
if( g_CourseDifficultyName[0].get() == NULL )
{
FOREACH_Difficulty(i)
FOREACH_ENUM( Difficulty,i)
{
auto_ptr<LocalizedString> ap( new LocalizedString("CourseDifficulty", DifficultyToString(i)) );
g_CourseDifficultyName[i] = ap;
+1 -2
View File
@@ -17,7 +17,6 @@ enum Difficulty
NUM_Difficulty,
Difficulty_Invalid
};
#define FOREACH_Difficulty( dc ) FOREACH_ENUM( Difficulty, dc )
const RString& DifficultyToString( Difficulty dc );
const RString& DifficultyToLocalizedString( Difficulty dc );
Difficulty StringToDifficulty( const RString& sDC );
@@ -25,7 +24,7 @@ LuaDeclareType( Difficulty );
typedef Difficulty CourseDifficulty;
#define FOREACH_CourseDifficulty FOREACH_Difficulty
const int NUM_CourseDifficulty = NUM_Difficulty;
#define FOREACH_ShownCourseDifficulty( cd ) for( Difficulty cd=GetNextShownCourseDifficulty((CourseDifficulty)-1); cd!=Difficulty_Invalid; cd=GetNextShownCourseDifficulty(cd) )
const RString& CourseDifficultyToLocalizedString( Difficulty dc );
+2 -2
View File
@@ -398,7 +398,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
m_vpSteps.clear();
FOREACH_Difficulty( dc )
FOREACH_ENUM( Difficulty, dc )
{
if( dc == Difficulty_Edit )
{
@@ -507,7 +507,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
m_vpSourceSteps.clear();
m_vpSourceSteps.push_back( StepsAndDifficulty(NULL,Difficulty_Invalid) ); // "blank"
FOREACH_Difficulty( dc )
FOREACH_ENUM( Difficulty, dc )
{
// fill in m_vpSourceSteps
if( dc != Difficulty_Edit )
-14
View File
@@ -32,7 +32,6 @@ enum RadarCategory
NUM_RadarCategory, // leave this at the end
RadarCategory_Invalid
};
#define FOREACH_RadarCategory( rc ) FOREACH_ENUM( RadarCategory, rc )
const RString& RadarCategoryToString( RadarCategory cat );
const RString& RadarCategoryToLocalizedString( RadarCategory cat );
LuaDeclareType( RadarCategory );
@@ -73,7 +72,6 @@ enum StepsType
NUM_StepsType, // leave this at the end
StepsType_Invalid,
};
#define FOREACH_StepsType( st ) FOREACH_ENUM( StepsType, st )
LuaDeclareType( StepsType );
//
@@ -90,7 +88,6 @@ enum PlayMode
NUM_PlayMode,
PlayMode_Invalid
};
#define FOREACH_PlayMode( pm ) FOREACH_ENUM( PlayMode, pm )
const RString& PlayModeToString( PlayMode pm );
const RString& PlayModeToLocalizedString( PlayMode pm );
PlayMode StringToPlayMode( const RString& s );
@@ -123,7 +120,6 @@ enum SortOrder
SortOrder_Invalid
};
const SortOrder MAX_SELECTABLE_SORT = (SortOrder)(SORT_ROULETTE-1);
#define FOREACH_SortOrder( so ) FOREACH_ENUM( SortOrder, so )
const RString& SortOrderToString( SortOrder so );
SortOrder StringToSortOrder( const RString& str );
LuaDeclareType( SortOrder );
@@ -147,7 +143,6 @@ enum TapNoteScore {
NUM_TapNoteScore,
TapNoteScore_Invalid,
};
#define FOREACH_TapNoteScore( tns ) FOREACH_ENUM( TapNoteScore, tns )
const RString& TapNoteScoreToString( TapNoteScore tns );
const RString& TapNoteScoreToLocalizedString( TapNoteScore tns );
TapNoteScore StringToTapNoteScore( const RString& str );
@@ -162,7 +157,6 @@ enum HoldNoteScore
NUM_HoldNoteScore,
HoldNoteScore_Invalid,
};
#define FOREACH_HoldNoteScore( hns ) FOREACH_ENUM( HoldNoteScore, hns )
const RString& HoldNoteScoreToString( HoldNoteScore hns );
const RString& HoldNoteScoreToLocalizedString( HoldNoteScore hns );
HoldNoteScore StringToHoldNoteScore( const RString& str );
@@ -220,7 +214,6 @@ enum ProfileSlot
NUM_ProfileSlot,
ProfileSlot_Invalid
};
#define FOREACH_ProfileSlot( slot ) FOREACH_ENUM( ProfileSlot, slot )
enum MemoryCardState
@@ -250,7 +243,6 @@ enum RankingCategory
NUM_RankingCategory,
RankingCategory_Invalid
};
#define FOREACH_RankingCategory( rc ) FOREACH_ENUM( RankingCategory, rc )
const RString& RankingCategoryToString( RankingCategory rc );
RankingCategory StringToRankingCategory( const RString& rc );
@@ -315,7 +307,6 @@ enum CoinMode
NUM_CoinMode,
CoinMode_Invalid
};
#define FOREACH_CoinMode( i ) FOREACH_ENUM( CoinMode, i )
const RString& CoinModeToString( CoinMode cm );
LuaDeclareType( CoinMode );
@@ -331,7 +322,6 @@ enum Premium
NUM_Premium,
Premium_Invalid
};
#define FOREACH_Premium( i ) FOREACH_ENUM( Premium, i )
const RString& PremiumToString( Premium p );
LuaDeclareType( Premium );
@@ -355,7 +345,6 @@ enum PerDifficultyAward
NUM_PerDifficultyAward,
PerDifficultyAward_Invalid,
};
#define FOREACH_PerDifficultyAward( pma ) FOREACH_ENUM( PerDifficultyAward, pma )
const RString& PerDifficultyAwardToString( PerDifficultyAward pma );
const RString& PerDifficultyAwardToLocalizedString( PerDifficultyAward pma );
PerDifficultyAward StringToPerDifficultyAward( const RString& pma );
@@ -377,7 +366,6 @@ enum PeakComboAward
NUM_PeakComboAward,
PeakComboAward_Invalid,
};
#define FOREACH_PeakComboAward( pca ) FOREACH_ENUM( PeakComboAward, pca )
const RString& PeakComboAwardToString( PeakComboAward pma );
const RString& PeakComboAwardToLocalizedString( PeakComboAward pma );
PeakComboAward StringToPeakComboAward( const RString& pma );
@@ -416,7 +404,6 @@ enum GoalType
NUM_GoalType,
GoalType_Invalid,
};
#define FOREACH_GoalType( gt ) FOREACH_ENUM( GoalType, gt )
const RString& GoalTypeToString( GoalType gt );
GoalType StringToGoalType( const RString& s );
LuaDeclareType( GoalType );
@@ -454,7 +441,6 @@ enum Stage
NUM_Stage,
Stage_Invalid,
};
#define FOREACH_Stage( s ) FOREACH_ENUM( Stage, s )
const RString& StageToString( Stage s );
LuaDeclareType( Stage );
+1 -1
View File
@@ -2293,7 +2293,7 @@ const Style* GameManager::GetEditorStyleForStepsType( StepsType st ) const
void GameManager::GetStepsTypesForGame( const Game *pGame, vector<StepsType>& aStepsTypeAddTo ) const
{
FOREACH_StepsType( st )
FOREACH_ENUM( StepsType, st )
{
bool found = false;
for( unsigned s=0; !found && s<NUM_STYLES; s++ )
+2 -2
View File
@@ -1446,7 +1446,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
// Find Machine Category Records
FOREACH_RankingCategory( rc )
FOREACH_ENUM( RankingCategory, rc )
{
HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetCategoryHighScoreList( st, rc );
for( unsigned j=0; j<hsl.vHighScores.size(); j++ )
@@ -1467,7 +1467,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
}
// Find Personal Category Records
FOREACH_RankingCategory( rc )
FOREACH_ENUM( RankingCategory, rc )
{
if( pProf )
{
-1
View File
@@ -53,7 +53,6 @@ RString GradeToOldString( Grade g ); // "AAA", "B", etc for backward compatibili
RString GradeToLocalizedString( Grade g );
Grade StringToGrade( const RString &s );
LuaDeclareType( Grade );
#define FOREACH_Grade( g ) FOREACH_ENUM( Grade, g )
#define FOREACH_UsedGrade( g ) FOREACH_ENUM_N( Grade, THEME->GetMetricI("PlayerStageStats","NumGradeTiersUsed"), g )
#endif
+6 -6
View File
@@ -48,9 +48,9 @@ bool HighScoreImpl::operator==( const HighScoreImpl& other ) const
COMPARE( sPlayerGuid );
COMPARE( sMachineGuid );
COMPARE( iProductID );
FOREACH_TapNoteScore( tns )
FOREACH_ENUM( TapNoteScore, tns )
COMPARE( iTapNoteScores[tns] );
FOREACH_HoldNoteScore( hns )
FOREACH_ENUM( HoldNoteScore, hns )
COMPARE( iHoldNoteScores[hns] );
COMPARE( radarValues );
COMPARE( fLifeRemainingSeconds );
@@ -95,11 +95,11 @@ XNode *HighScoreImpl::CreateNode() const
pNode->AppendChild( "MachineGuid", sMachineGuid );
pNode->AppendChild( "ProductID", iProductID );
XNode* pTapNoteScores = pNode->AppendChild( "TapNoteScores" );
FOREACH_TapNoteScore( tns )
FOREACH_ENUM( TapNoteScore, tns )
if( tns != TNS_None ) // HACK: don't save meaningless "none" count
pTapNoteScores->AppendChild( TapNoteScoreToString(tns), iTapNoteScores[tns] );
XNode* pHoldNoteScores = pNode->AppendChild( "HoldNoteScores" );
FOREACH_HoldNoteScore( hns )
FOREACH_ENUM( HoldNoteScore, hns )
if( hns != HNS_None ) // HACK: don't save meaningless "none" count
pHoldNoteScores->AppendChild( HoldNoteScoreToString(hns), iHoldNoteScores[hns] );
pNode->AppendChild( radarValues.CreateNode(bWriteSimpleValues, bWriteComplexValues) );
@@ -127,11 +127,11 @@ void HighScoreImpl::LoadFromNode( const XNode *pNode )
pNode->GetChildValue( "ProductID", iProductID );
const XNode* pTapNoteScores = pNode->GetChild( "TapNoteScores" );
if( pTapNoteScores )
FOREACH_TapNoteScore( tns )
FOREACH_ENUM( TapNoteScore, tns )
pTapNoteScores->GetChildValue( TapNoteScoreToString(tns), iTapNoteScores[tns] );
const XNode* pHoldNoteScores = pNode->GetChild( "HoldNoteScores" );
if( pHoldNoteScores )
FOREACH_HoldNoteScore( hns )
FOREACH_ENUM( HoldNoteScore, hns )
pHoldNoteScores->GetChildValue( HoldNoteScoreToString(hns), iHoldNoteScores[hns] );
const XNode* pRadarValues = pNode->GetChild( "RadarValues" );
if( pRadarValues )
+2 -2
View File
@@ -108,7 +108,7 @@ void MusicWheel::Load( RString sType )
RString times;
/* Build all of the wheel item data. Do this after selecting
* the extra stage, so it knows to always display it. */
FOREACH_SortOrder( so )
FOREACH_ENUM( SortOrder, so )
{
BuildWheelItemDatas( m_WheelItemDatas[so], so );
times += ssprintf( "%i:%.3f ", so, timer.GetDeltaTime() );
@@ -187,7 +187,7 @@ void MusicWheel::BeginScreen()
MusicWheel::~MusicWheel()
{
FOREACH_SortOrder( so )
FOREACH_ENUM( SortOrder, so )
FOREACH( WheelItemData*, m_WheelItemDatas[so], i )
delete *i;
}
+1 -1
View File
@@ -682,7 +682,7 @@ void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds,
{
// The for loop and the assert are used to ensure that all fields of
// RadarValue get set in here.
FOREACH_RadarCategory( rc )
FOREACH_ENUM( RadarCategory, rc )
{
switch( rc )
{
+1 -1
View File
@@ -255,7 +255,7 @@ void NoteDataWithScoring::GetActualRadarValues( const NoteData &in, const Player
{
// The for loop and the assert are used to ensure that all fields of
// RadarValue get set in here.
FOREACH_RadarCategory( rc )
FOREACH_ENUM( RadarCategory, rc )
{
switch( rc )
{
+2 -2
View File
@@ -930,9 +930,9 @@ static void SlideDuplicateDifficulties( Song &p )
* difficulties slid upwards due to (for example) having two beginner steps.
* We do a second pass in Song::TidyUpData to eliminate any remaining duplicates
* after this. */
FOREACH_StepsType( st )
FOREACH_ENUM( StepsType,st )
{
FOREACH_Difficulty( dc )
FOREACH_ENUM( Difficulty, dc )
{
if( dc == Difficulty_Edit )
continue;
+1 -1
View File
@@ -52,7 +52,7 @@ static void LoadFromSMTokens(
{
RadarValues v[NUM_PLAYERS];
FOREACH_PlayerNumber( pn )
FOREACH_RadarCategory( rc )
FOREACH_ENUM( RadarCategory, rc )
v[pn][rc] = StringToFloat( saValues[pn*NUM_RadarCategory + rc] );
out.SetCachedRadarValues( v );
}
+1 -1
View File
@@ -178,7 +178,7 @@ static RString GetSMNotesTag( const Song &song, const Steps &in, bool bSavingCac
FOREACH_PlayerNumber( pn )
{
const RadarValues &rv = in.GetRadarValues( pn );
FOREACH_RadarCategory( rc )
FOREACH_ENUM( RadarCategory, rc )
asRadarValues.push_back( ssprintf("%.3f", rv[rc]) );
}
lines.push_back( ssprintf( " %s:", join(",",asRadarValues).c_str() ) );
+1 -1
View File
@@ -480,7 +480,7 @@ public:
if( GAMESTATE->m_pCurSong )
{
FOREACH_Difficulty( dc )
FOREACH_ENUM( Difficulty, dc )
{
if( dc == Difficulty_Edit )
continue;
+8 -8
View File
@@ -136,7 +136,7 @@ Grade GetGradeFromPercent( float fPercent, bool bMerciful )
Grade grade = Grade_Failed;
FOREACH_Grade(g)
FOREACH_ENUM( Grade,g)
{
if( fPercent >= GRADE_PERCENT_TIER(g) )
{
@@ -160,14 +160,14 @@ Grade PlayerStageStats::GetGrade() const
if( m_vpPlayedSteps.size() && !GAMESTATE->IsCourseMode() )
bIsBeginner = m_vpPlayedSteps[0]->GetDifficulty() == Difficulty_Beginner;
FOREACH_TapNoteScore( tns )
FOREACH_ENUM( TapNoteScore, tns )
{
int iTapScoreValue = ScoreKeeperNormal::TapNoteScoreToGradePoints( tns, bIsBeginner );
fActual += m_iTapNoteScores[tns] * iTapScoreValue;
LOG->Trace( "GetGrade actual: %i * %i", m_iTapNoteScores[tns], iTapScoreValue );
}
FOREACH_HoldNoteScore( hns )
FOREACH_ENUM( HoldNoteScore, hns )
{
int iHoldScoreValue = ScoreKeeperNormal::HoldNoteScoreToGradePoints( hns, bIsBeginner );
fActual += m_iHoldNoteScores[hns] * iHoldScoreValue;
@@ -253,7 +253,7 @@ int PlayerStageStats::GetLessonScoreActual() const
{
int iScore = 0;
FOREACH_TapNoteScore( tns )
FOREACH_ENUM( TapNoteScore, tns )
{
switch( tns )
{
@@ -268,7 +268,7 @@ int PlayerStageStats::GetLessonScoreActual() const
}
}
FOREACH_HoldNoteScore( hns )
FOREACH_ENUM( HoldNoteScore, hns )
{
switch( hns )
{
@@ -295,9 +295,9 @@ void PlayerStageStats::ResetScoreForLesson()
{
m_iCurPossibleDancePoints = 0;
m_iActualDancePoints = 0;
FOREACH_TapNoteScore( tns )
FOREACH_ENUM( TapNoteScore, tns )
m_iTapNoteScores[tns] = 0;
FOREACH_HoldNoteScore( hns )
FOREACH_ENUM( HoldNoteScore, hns )
m_iHoldNoteScores[hns] = 0;
m_iCurCombo = 0;
m_iMaxCombo = 0;
@@ -600,7 +600,7 @@ void PlayerStageStats::CalcAwards( PlayerNumber p, bool bGaveUp, bool bUsedAutop
int iComboAtStartOfStage = GetComboAtStartOfStage();
int iPeakCombo = GetMaxCombo().m_cnt;
FOREACH_PeakComboAward( pca )
FOREACH_ENUM( PeakComboAward,pca )
{
int iLevel = 1000 * (pca+1);
bool bCrossedLevel = iComboAtStartOfStage < iLevel && iPeakCombo >= iLevel;
+19 -19
View File
@@ -128,10 +128,10 @@ void Profile::InitGeneralData()
m_iTotalMines = 0;
m_iTotalHands = 0;
FOREACH_PlayMode( i )
FOREACH_ENUM( PlayMode, i )
m_iNumSongsPlayedByPlayMode[i] = 0;
m_iNumSongsPlayedByStyle.clear();
FOREACH_Difficulty( i )
FOREACH_ENUM( Difficulty, i )
m_iNumSongsPlayedByDifficulty[i] = 0;
for( int i=0; i<MAX_METER+1; i++ )
m_iNumSongsPlayedByMeter[i] = 0;
@@ -152,8 +152,8 @@ void Profile::InitCourseScores()
void Profile::InitCategoryScores()
{
FOREACH_StepsType( st )
FOREACH_RankingCategory( rc )
FOREACH_ENUM( StepsType,st )
FOREACH_ENUM( RankingCategory,rc )
m_CategoryHighScores[st][rc].Init();
}
@@ -232,7 +232,7 @@ float Profile::GetCaloriesBurnedToday() const
int Profile::GetTotalNumSongsPassed() const
{
int iTotal = 0;
FOREACH_PlayMode( i )
FOREACH_ENUM( PlayMode, i )
iTotal += m_iNumStagesPassedByPlayMode[i];
return iTotal;
}
@@ -448,12 +448,12 @@ float Profile::GetSongsAndCoursesPercentCompleteAllDifficulties( StepsType st )
{
float fActual = 0;
float fPossible = 0;
FOREACH_Difficulty( d )
FOREACH_ENUM( Difficulty, d )
{
fActual += GetSongsActual(st,d);
fPossible += GetSongsPossible(st,d);
}
FOREACH_CourseDifficulty( d )
FOREACH_ENUM( CourseDifficulty, d )
{
fActual += GetCoursesActual(st,d);
fPossible += GetCoursesPossible(st,d);
@@ -646,7 +646,7 @@ void Profile::GetGrades( const Song* pSong, StepsType st, int iCounts[NUM_Grade]
if( hsSong == NULL )
return;
FOREACH_Grade(g)
FOREACH_ENUM( Grade,g)
{
FOREACHM_CONST( StepsID, HighScoresForASteps, hsSong->m_StepsHighScores, it )
{
@@ -761,7 +761,7 @@ HighScoreList& Profile::GetCategoryHighScoreList( StepsType st, RankingCategory
int Profile::GetCategoryNumTimesPlayed( StepsType st ) const
{
int iNumTimesPlayed = 0;
FOREACH_RankingCategory( rc )
FOREACH_ENUM( RankingCategory,rc )
iNumTimesPlayed += m_CategoryHighScores[st][rc].GetNumTimesPlayed();
return iNumTimesPlayed;
}
@@ -1092,7 +1092,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
{
XNode* pNumSongsPlayedByPlayMode = pGeneralDataNode->AppendChild("NumSongsPlayedByPlayMode");
FOREACH_PlayMode( pm )
FOREACH_ENUM( PlayMode, pm )
{
/* Don't save unplayed PlayModes. */
if( !m_iNumSongsPlayedByPlayMode[pm] )
@@ -1117,7 +1117,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
{
XNode* pNumSongsPlayedByDifficulty = pGeneralDataNode->AppendChild("NumSongsPlayedByDifficulty");
FOREACH_Difficulty( dc )
FOREACH_ENUM( Difficulty, dc )
{
if( !m_iNumSongsPlayedByDifficulty[dc] )
continue;
@@ -1139,7 +1139,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
{
XNode* pNumStagesPassedByPlayMode = pGeneralDataNode->AppendChild("NumStagesPassedByPlayMode");
FOREACH_PlayMode( pm )
FOREACH_ENUM( PlayMode, pm )
{
/* Don't save unplayed PlayModes. */
if( !m_iNumStagesPassedByPlayMode[pm] )
@@ -1150,7 +1150,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
{
XNode* pNumStagesPassedByGrade = pGeneralDataNode->AppendChild("NumStagesPassedByGrade");
FOREACH_Grade( g )
FOREACH_ENUM( Grade, g )
{
if( !m_iNumStagesPassedByGrade[g] )
continue;
@@ -1263,7 +1263,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
{
const XNode* pNumSongsPlayedByPlayMode = pNode->GetChild("NumSongsPlayedByPlayMode");
if( pNumSongsPlayedByPlayMode )
FOREACH_PlayMode( pm )
FOREACH_ENUM( PlayMode, pm )
pNumSongsPlayedByPlayMode->GetChildValue( PlayModeToString(pm), m_iNumSongsPlayedByPlayMode[pm] );
}
@@ -1290,7 +1290,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
{
const XNode* pNumSongsPlayedByDifficulty = pNode->GetChild("NumSongsPlayedByDifficulty");
if( pNumSongsPlayedByDifficulty )
FOREACH_Difficulty( dc )
FOREACH_ENUM( Difficulty, dc )
pNumSongsPlayedByDifficulty->GetChildValue( DifficultyToString(dc), m_iNumSongsPlayedByDifficulty[dc] );
}
@@ -1306,14 +1306,14 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
{
const XNode* pNumStagesPassedByGrade = pNode->GetChild("NumStagesPassedByGrade");
if( pNumStagesPassedByGrade )
FOREACH_Grade( g )
FOREACH_ENUM( Grade, g )
pNumStagesPassedByGrade->GetChildValue( GradeToString(g), m_iNumStagesPassedByGrade[g] );
}
{
const XNode* pNumStagesPassedByPlayMode = pNode->GetChild("NumStagesPassedByPlayMode");
if( pNumStagesPassedByPlayMode )
FOREACH_PlayMode( pm )
FOREACH_ENUM( PlayMode, pm )
pNumStagesPassedByPlayMode->GetChildValue( PlayModeToString(pm), m_iNumStagesPassedByPlayMode[pm] );
}
@@ -1533,7 +1533,7 @@ XNode* Profile::SaveCategoryScoresCreateNode() const
XNode* pNode = new XNode( "CategoryScores" );
FOREACH_StepsType( st )
FOREACH_ENUM( StepsType,st )
{
// skip steps types that have never been played
if( pProfile->GetCategoryNumTimesPlayed( st ) == 0 )
@@ -1542,7 +1542,7 @@ XNode* Profile::SaveCategoryScoresCreateNode() const
XNode* pStepsTypeNode = pNode->AppendChild( "StepsType" );
pStepsTypeNode->AppendAttr( "Type", GameManager::StepsTypeToString(st) );
FOREACH_RankingCategory( rc )
FOREACH_ENUM( RankingCategory,rc )
{
// skip steps types/categories that have never been played
if( pProfile->GetCategoryHighScoreList(st,rc).GetNumTimesPlayed() == 0 )
+5 -5
View File
@@ -12,13 +12,13 @@ RadarValues::RadarValues()
void RadarValues::MakeUnknown()
{
FOREACH_RadarCategory( rc )
FOREACH_ENUM( RadarCategory, rc )
m_Values.f[rc] = RADAR_VAL_UNKNOWN;
}
void RadarValues::Zero()
{
FOREACH_RadarCategory( rc )
FOREACH_ENUM( RadarCategory, rc )
m_Values.f[rc] = 0;
}
@@ -27,7 +27,7 @@ XNode* RadarValues::CreateNode( bool bIncludeSimpleValues, bool bIncludeComplexV
XNode* pNode = new XNode( "RadarValues" );
// TRICKY: Don't print a remainder for the integer values.
FOREACH_RadarCategory( rc )
FOREACH_ENUM( RadarCategory, rc )
{
if( rc >= RadarCategory_TapsAndHolds )
{
@@ -50,7 +50,7 @@ void RadarValues::LoadFromNode( const XNode* pNode )
Zero();
FOREACH_RadarCategory( rc )
FOREACH_ENUM( RadarCategory, rc )
pNode->GetChildValue( RadarCategoryToString(rc), m_Values.f[rc] );
}
@@ -80,7 +80,7 @@ void RadarValues::FromString( RString sRadarValues )
return;
}
FOREACH_RadarCategory(rc)
FOREACH_ENUM( RadarCategory, rc )
m_Values.f[rc] = StringToFloat( saValues[rc] );
}
+2 -2
View File
@@ -41,13 +41,13 @@ struct RadarValues
RadarValues& operator+=( const RadarValues& other )
{
FOREACH_RadarCategory( rc )
FOREACH_ENUM( RadarCategory, rc )
m_Values.f[rc] += other.m_Values.f[rc];
return *this;
}
bool operator==( const RadarValues& other ) const
{
FOREACH_RadarCategory( rc )
FOREACH_ENUM( RadarCategory, rc )
{
if( m_Values.f[rc] != other.m_Values.f[rc] )
return false;
+2 -2
View File
@@ -39,13 +39,13 @@ void ScoreDisplayLifeTime::Init( const PlayerState* pPlayerState, const PlayerSt
this->AddChild( &m_textDeltaSeconds );
ActorUtil::LoadAllCommandsAndOnCommand( m_textDeltaSeconds, sType );
FOREACH_TapNoteScore( tns )
FOREACH_ENUM( TapNoteScore, tns )
{
const RString &sCommand = TapNoteScoreToString(tns);
if( !m_textDeltaSeconds.HasCommand( sCommand ) )
ActorUtil::LoadCommand( m_textDeltaSeconds, sType, sCommand );
}
FOREACH_HoldNoteScore( hns )
FOREACH_ENUM( HoldNoteScore, hns )
{
const RString &sCommand = HoldNoteScoreToString(hns);
if( !m_textDeltaSeconds.HasCommand( sCommand ) )
+3 -3
View File
@@ -675,12 +675,12 @@ static HighScore MakeRandomHighScore( float fPercentDP )
hs.SetPlayerGuid( Profile::MakeGuid() );
hs.SetMachineGuid( Profile::MakeGuid() );
hs.SetProductID( RandomInt(10) );
FOREACH_TapNoteScore( tns )
FOREACH_ENUM( TapNoteScore, tns )
hs.SetTapNoteScore( tns, RandomInt(100) );
FOREACH_HoldNoteScore( hns )
FOREACH_ENUM( HoldNoteScore, hns )
hs.SetHoldNoteScore( hns, RandomInt(100) );
RadarValues rv;
FOREACH_RadarCategory( rc )
FOREACH_ENUM( RadarCategory, rc )
rv.m_Values.f[rc] = randomf( 0, 1 );
hs.SetRadarValues( rv );
+1 -1
View File
@@ -2765,7 +2765,7 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
float fMusicSeconds = m_soundMusic.GetLengthSeconds();
g_StepsInformation.rows[difficulty].choices.clear();
FOREACH_Difficulty( dc )
FOREACH_ENUM( Difficulty, dc )
g_StepsInformation.rows[difficulty].choices.push_back( "|" + DifficultyToLocalizedString(pSteps->GetDifficulty()) );
g_StepsInformation.rows[difficulty].iDefaultChoice = pSteps->GetDifficulty();
g_StepsInformation.rows[difficulty].bEnabled = (EDIT_MODE.GetValue() >= EditMode_Full);
+1 -1
View File
@@ -63,7 +63,7 @@ void ScreenJukebox::SetSong()
}
else
{
FOREACH_Difficulty( dc )
FOREACH_ENUM( Difficulty, dc )
vDifficultiesToShow.push_back( dc );
}
}
+6 -6
View File
@@ -77,7 +77,7 @@ Song::~Song()
void Song::DetachSteps()
{
m_vpSteps.clear();
FOREACH_StepsType( st )
FOREACH_ENUM( StepsType, st )
m_vpStepsByType[st].clear();
}
@@ -87,7 +87,7 @@ void Song::Reset()
FOREACH( Steps*, m_vpSteps, s )
SAFE_DELETE( *s );
m_vpSteps.clear();
FOREACH_StepsType( st )
FOREACH_ENUM( StepsType, st )
m_vpStepsByType[st].clear();
Song empty;
@@ -288,7 +288,7 @@ bool Song::ReloadFromSongDir( RString sDir )
// Now we wipe out the new pointers, which were shallow copied and not deep copied...
m_vpSteps.clear();
FOREACH_StepsType( i )
FOREACH_ENUM( StepsType, i )
m_vpStepsByType[i].clear();
// Then we copy as many Steps as possible on top of the old pointers.
@@ -889,7 +889,7 @@ void Song::AddAutoGenNotes()
HasNotes[st] = true;
}
FOREACH_StepsType( stMissing )
FOREACH_ENUM( StepsType, stMissing )
{
if( HasNotes[stMissing] )
continue;
@@ -907,7 +907,7 @@ void Song::AddAutoGenNotes()
StepsType stBestMatch = StepsType_Invalid;
int iBestTrackDifference = INT_MAX;
FOREACH_StepsType( st )
FOREACH_ENUM( StepsType, st )
{
if( !HasNotes[st] )
continue;
@@ -945,7 +945,7 @@ void Song::AutoGen( StepsType ntTo, StepsType ntFrom )
void Song::RemoveAutoGenNotes()
{
FOREACH_StepsType(st)
FOREACH_ENUM( StepsType, st )
{
for( int j=m_vpStepsByType[st].size()-1; j>=0; j-- )
{
+2 -2
View File
@@ -1300,13 +1300,13 @@ void SongManager::UpdatePopular()
SongUtil::SortSongPointerArrayByTitle( apBestSongs );
vector<Course*> apBestCourses[NUM_CourseType];
FOREACH_CourseType( ct )
FOREACH_ENUM( CourseType, ct )
{
GetCourses( ct, apBestCourses[ct], PREFSMAN->m_bAutogenGroupCourses );
CourseUtil::SortCoursePointerArrayByTitle( apBestCourses[ct] );
}
FOREACH_ProfileSlot( i )
FOREACH_ENUM( ProfileSlot, i )
{
m_pPopularSongs[i] = apBestSongs;
+2 -2
View File
@@ -228,9 +228,9 @@ Steps* SongUtil::GetClosestNotes( const Song *pSong, StepsType st, Difficulty dc
* on this; see BMSLoader::SlideDuplicateDifficulties.) */
void SongUtil::AdjustDuplicateSteps( Song *pSong )
{
FOREACH_StepsType( st )
FOREACH_ENUM( StepsType, st )
{
FOREACH_Difficulty( dc )
FOREACH_ENUM( Difficulty, dc )
{
if( dc == Difficulty_Edit )
continue;
+2 -2
View File
@@ -170,9 +170,9 @@ void StageStats::CommitScores( bool bSummary )
hs.SetPlayerGuid( PROFILEMAN->IsPersistentProfile(p) ? PROFILEMAN->GetProfile(p)->m_sGuid : RString("") );
hs.SetMachineGuid( PROFILEMAN->GetMachineProfile()->m_sGuid );
hs.SetProductID( PREFSMAN->m_iProductID );
FOREACH_TapNoteScore( tns )
FOREACH_ENUM( TapNoteScore, tns )
hs.SetTapNoteScore( tns, m_player[p].m_iTapNoteScores[tns] );
FOREACH_HoldNoteScore( hns )
FOREACH_ENUM( HoldNoteScore, hns )
hs.SetHoldNoteScore( hns, m_player[p].m_iHoldNoteScores[hns] );
hs.SetRadarValues( m_player[p].m_radarActual );
hs.SetLifeRemainingSeconds( m_player[p].m_fLifeRemainingSeconds );
+4 -4
View File
@@ -208,7 +208,7 @@ static float GetArcadePoints( const Profile *pProfile )
{
float fAP = 0;
FOREACH_Grade(g)
FOREACH_ENUM( Grade, g )
{
switch(g)
{
@@ -223,7 +223,7 @@ static float GetArcadePoints( const Profile *pProfile )
}
}
FOREACH_PlayMode(pm)
FOREACH_ENUM( PlayMode, pm )
{
switch(pm)
{
@@ -243,7 +243,7 @@ static float GetSongPoints( const Profile *pProfile )
{
float fSP = 0;
FOREACH_Grade(g)
FOREACH_ENUM( Grade, g )
{
switch( g )
{
@@ -261,7 +261,7 @@ static float GetSongPoints( const Profile *pProfile )
}
}
FOREACH_PlayMode(pm)
FOREACH_ENUM( PlayMode, pm )
{
switch(pm)
{