From 1044dcd86d669b4e3147ea53356250f0ed20a611 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Thu, 24 Jan 2013 23:25:28 -0500 Subject: [PATCH] Another goto replace with a fake infinite. --- src/PaneDisplay.cpp | 251 +++++++++++++++++++++++--------------------- 1 file changed, 129 insertions(+), 122 deletions(-) diff --git a/src/PaneDisplay.cpp b/src/PaneDisplay.cpp index 2fa4b047f5..7c9ef624e9 100644 --- a/src/PaneDisplay.cpp +++ b/src/PaneDisplay.cpp @@ -126,138 +126,145 @@ void PaneDisplay::SetContent( PaneCategory c ) const Profile *pProfile = PROFILEMAN->IsPersistentProfile(m_PlayerNumber) ? PROFILEMAN->GetProfile(m_PlayerNumber) : NULL; bool bIsPlayerEdit = pSteps && pSteps->IsAPlayerEdit(); - if(GAMESTATE->IsCourseMode() && !pTrail) + for (;;) { - if( (g_Contents[c].req&NEED_PROFILE) ) - str = NOT_AVAILABLE; - + if(GAMESTATE->IsCourseMode() && !pTrail) { - switch( c ) + if( (g_Contents[c].req&NEED_PROFILE) ) + str = NOT_AVAILABLE; + { - case PaneCategory_MachineHighName: - str = EMPTY_MACHINE_HIGH_SCORE_NAME; - break; - case PaneCategory_MachineHighScore: - case PaneCategory_ProfileHighScore: - str = NOT_AVAILABLE; - break; - default: break; - } - } - - goto done; - } - else if(!GAMESTATE->IsCourseMode() && !pSong) - { - if( (g_Contents[c].req&NEED_PROFILE) ) - str = NOT_AVAILABLE; - - { - switch( c ) - { - case PaneCategory_MachineHighName: - str = EMPTY_MACHINE_HIGH_SCORE_NAME; - break; - case PaneCategory_MachineHighScore: - case PaneCategory_ProfileHighScore: - str = NOT_AVAILABLE; - break; - default: break; - } - } - - goto done; - } - - if( (g_Contents[c].req&NEED_NOTES) && !pSteps && !pTrail ) - goto done; - if( (g_Contents[c].req&NEED_PROFILE) && !pProfile ) - { - str = NOT_AVAILABLE; - goto done; - } - - { - RadarValues rv; - HighScoreList *pHSL = NULL; - ProfileSlot slot = ProfileSlot_Machine; - switch( c ) - { - case PaneCategory_ProfileHighScore: - slot = (ProfileSlot) m_PlayerNumber; - default: break; - } - - if( pSteps ) - { - rv = pSteps->GetRadarValues( m_PlayerNumber ); - pHSL = &PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(pSong, pSteps); - } - else if( pTrail ) - { - rv = pTrail->GetRadarValues(); - pHSL = &PROFILEMAN->GetProfile(slot)->GetCourseHighScoreList(pCourse, pTrail); - } - - switch( c ) - { - case PaneCategory_NumSteps: val = rv[RadarCategory_TapsAndHolds]; break; - case PaneCategory_Jumps: val = rv[RadarCategory_Jumps]; break; - case PaneCategory_Holds: val = rv[RadarCategory_Holds]; break; - case PaneCategory_Rolls: val = rv[RadarCategory_Rolls]; break; - case PaneCategory_Mines: val = rv[RadarCategory_Mines]; break; - case PaneCategory_Hands: val = rv[RadarCategory_Hands]; break; - case PaneCategory_Lifts: val = rv[RadarCategory_Lifts]; break; - case PaneCategory_Fakes: val = rv[RadarCategory_Fakes]; break; - case PaneCategory_ProfileHighScore: - case PaneCategory_MachineHighName: // set val for color - case PaneCategory_MachineHighScore: - CHECKPOINT; - val = pHSL->GetTopScore().GetPercentDP(); - break; - default: break; - }; - - if( val != RADAR_VAL_UNKNOWN ) - { - switch( c ) - { - case PaneCategory_MachineHighName: - if( pHSL->vHighScores.empty() ) - { + switch( c ) + { + case PaneCategory_MachineHighName: str = EMPTY_MACHINE_HIGH_SCORE_NAME; - } - else - { - str = pHSL->GetTopScore().GetName(); - if( str.empty() ) - str = "????"; - } - break; - case PaneCategory_MachineHighScore: - case PaneCategory_ProfileHighScore: - // Don't show or save machine high scores for edits loaded from a player profile. - if( bIsPlayerEdit ) + break; + case PaneCategory_MachineHighScore: + case PaneCategory_ProfileHighScore: str = NOT_AVAILABLE; - else - str = PlayerStageStats::FormatPercentScore( val ); - break; - case PaneCategory_NumSteps: - case PaneCategory_Jumps: - case PaneCategory_Holds: - case PaneCategory_Rolls: - case PaneCategory_Mines: - case PaneCategory_Hands: - case PaneCategory_Lifts: - case PaneCategory_Fakes: - str = ssprintf( COUNT_FORMAT.GetValue(), val ); - break; + break; + default: break; + } + } + + break; + } + + if(!GAMESTATE->IsCourseMode() && !pSong) + { + if( (g_Contents[c].req&NEED_PROFILE) ) + str = NOT_AVAILABLE; + + { + switch( c ) + { + case PaneCategory_MachineHighName: + str = EMPTY_MACHINE_HIGH_SCORE_NAME; + break; + case PaneCategory_MachineHighScore: + case PaneCategory_ProfileHighScore: + str = NOT_AVAILABLE; + break; + default: break; + } + } + + break; + } + + if( (g_Contents[c].req&NEED_NOTES) && !pSteps && !pTrail ) + { + break; + } + if( (g_Contents[c].req&NEED_PROFILE) && !pProfile ) + { + str = NOT_AVAILABLE; + break; + } + + // Is this standalone block needed? + { + RadarValues rv; + HighScoreList *pHSL = NULL; + ProfileSlot slot = ProfileSlot_Machine; + switch( c ) + { + case PaneCategory_ProfileHighScore: + slot = (ProfileSlot) m_PlayerNumber; default: break; } + + if( pSteps ) + { + rv = pSteps->GetRadarValues( m_PlayerNumber ); + pHSL = &PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(pSong, pSteps); + } + else if( pTrail ) + { + rv = pTrail->GetRadarValues(); + pHSL = &PROFILEMAN->GetProfile(slot)->GetCourseHighScoreList(pCourse, pTrail); + } + + switch( c ) + { + case PaneCategory_NumSteps: val = rv[RadarCategory_TapsAndHolds]; break; + case PaneCategory_Jumps: val = rv[RadarCategory_Jumps]; break; + case PaneCategory_Holds: val = rv[RadarCategory_Holds]; break; + case PaneCategory_Rolls: val = rv[RadarCategory_Rolls]; break; + case PaneCategory_Mines: val = rv[RadarCategory_Mines]; break; + case PaneCategory_Hands: val = rv[RadarCategory_Hands]; break; + case PaneCategory_Lifts: val = rv[RadarCategory_Lifts]; break; + case PaneCategory_Fakes: val = rv[RadarCategory_Fakes]; break; + case PaneCategory_ProfileHighScore: + case PaneCategory_MachineHighName: // set val for color + case PaneCategory_MachineHighScore: + CHECKPOINT; + val = pHSL->GetTopScore().GetPercentDP(); + break; + default: break; + }; + + if( val != RADAR_VAL_UNKNOWN ) + { + switch( c ) + { + case PaneCategory_MachineHighName: + if( pHSL->vHighScores.empty() ) + { + str = EMPTY_MACHINE_HIGH_SCORE_NAME; + } + else + { + str = pHSL->GetTopScore().GetName(); + if( str.empty() ) + str = "????"; + } + break; + case PaneCategory_MachineHighScore: + case PaneCategory_ProfileHighScore: + // Don't show or save machine high scores for edits loaded from a player profile. + if( bIsPlayerEdit ) + str = NOT_AVAILABLE; + else + str = PlayerStageStats::FormatPercentScore( val ); + break; + case PaneCategory_NumSteps: + case PaneCategory_Jumps: + case PaneCategory_Holds: + case PaneCategory_Rolls: + case PaneCategory_Mines: + case PaneCategory_Hands: + case PaneCategory_Lifts: + case PaneCategory_Fakes: + str = ssprintf( COUNT_FORMAT.GetValue(), val ); + break; + default: break; + } + } } + break; } -done: m_textContents[c].SetText( str ); Lua *L = LUA->Get();