small comment edits

This commit is contained in:
AJ Kelly
2011-02-09 16:31:17 -06:00
parent 76b625ffb4
commit 3220331d56
+12 -20
View File
@@ -649,7 +649,7 @@ void SongUtil::SortSongPointerArrayBySectionName( vector<Song*> &vpSongsInOut, S
{ {
RString val = GetSectionNameFromSongAndSort( vpSongsInOut[i], so ); RString val = GetSectionNameFromSongAndSort( vpSongsInOut[i], so );
/* Make sure 0-9 comes first and OTHER comes last. */ // Make sure 0-9 comes first and OTHER comes last.
if( val == "0-9" ) val = "0"; if( val == "0-9" ) val = "0";
else if( val == sOther ) val = "2"; else if( val == sOther ) val = "2";
else val = "1" + MakeSortString(val); else val = "1" + MakeSortString(val);
@@ -666,25 +666,20 @@ void SongUtil::SortSongPointerArrayByStepsTypeAndMeter( vector<Song*> &vpSongsIn
g_mapSongSortVal.clear(); g_mapSongSortVal.clear();
for(unsigned i = 0; i < vpSongsInOut.size(); ++i) for(unsigned i = 0; i < vpSongsInOut.size(); ++i)
{ {
/* Ignore locked steps. */ // Ignore locked steps.
const Steps* pSteps = GetClosestNotes( vpSongsInOut[i], st, dc, true ); const Steps* pSteps = GetClosestNotes( vpSongsInOut[i], st, dc, true );
RString &s = g_mapSongSortVal[vpSongsInOut[i]]; RString &s = g_mapSongSortVal[vpSongsInOut[i]];
s = ssprintf("%03d", pSteps ? pSteps->GetMeter() : 0); s = ssprintf("%03d", pSteps ? pSteps->GetMeter() : 0);
/* /* pSteps may not be exactly the difficulty we want; for example, we
* pSteps may not be exactly the difficulty we want; for example, we may * may be sorting by Hard difficulty and a song may have no Hard steps.
* be sorting by Hard difficulty and a song may have no Hard steps.
*
* In this case, we can end up with unintuitive ties; for example, pSteps * In this case, we can end up with unintuitive ties; for example, pSteps
* may be Medium with a meter of 5, which will sort it among the 5-meter * may be Medium with a meter of 5, which will sort it among the 5-meter
* Hard songs. Break the tie, by adding the difficulty to the sort as * Hard songs. Break the tie, by adding the difficulty to the sort as
* well. That way, we'll always put Medium 5s before Hard 5s. If all * well. That way, we'll always put Medium 5s before Hard 5s. If all
* songs are using the preferred difficulty (dc), this will be a no-op. * songs are using the preferred difficulty (dc), this will be a no-op. */
*/
s += ssprintf( "%c", (pSteps? pSteps->GetDifficulty():0) + '0' ); s += ssprintf( "%c", (pSteps? pSteps->GetDifficulty():0) + '0' );
// ???: will this cause a crash with player 2 only? -aj
// no, but I'm not sure if it causes problems either...
if( PREFSMAN->m_bSubSortByNumSteps ) if( PREFSMAN->m_bSubSortByNumSteps )
s += ssprintf("%06.0f",pSteps ? pSteps->GetRadarValues(PLAYER_1)[RadarCategory_TapsAndHolds] : 0); s += ssprintf("%06.0f",pSteps ? pSteps->GetRadarValues(PLAYER_1)[RadarCategory_TapsAndHolds] : 0);
} }
@@ -792,11 +787,11 @@ bool SongUtil::ValidateCurrentStepsDescription( const RString &sAnswer, RString
if( sAnswer.empty() ) if( sAnswer.empty() )
return true; return true;
/* Don't allow duplicate edit names within the same StepsType; edit names uniquely /* Don't allow duplicate edit names within the same StepsType; edit names
* identify the edit. */ * uniquely identify the edit. */
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1]; Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
/* If unchanged: */ // If unchanged:
if( pSteps->GetDescription() == sAnswer ) if( pSteps->GetDescription() == sAnswer )
return true; return true;
@@ -867,8 +862,8 @@ void SongUtil::GetPlayableStepsTypes( const Song *pSong, set<StepsType> &vOut )
FOREACH( const Style*, vpPossibleStyles, s ) FOREACH( const Style*, vpPossibleStyles, s )
vStepsTypes.insert( (*s)->m_StepsType ); vStepsTypes.insert( (*s)->m_StepsType );
/* filter out hidden StepsTypes, and remove steps that we don't /* filter out hidden StepsTypes, and remove steps that we don't have enough
* have enough stages left to play. */ * stages left to play. */
// this being const may have caused some problems... -aj // this being const may have caused some problems... -aj
const vector<StepsType> &vstToShow = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue(); const vector<StepsType> &vstToShow = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
FOREACHS( StepsType, vStepsTypes, st ) FOREACHS( StepsType, vStepsTypes, st )
@@ -989,8 +984,8 @@ Song *SongID::ToSong() const
Song *pRet = NULL; Song *pRet = NULL;
if( !m_Cache.Get(&pRet) ) if( !m_Cache.Get(&pRet) )
{ {
// HACK for backwards compatibility: // HACK for backwards compatibility: Re-add the leading "/".
// Re-add the leading "/". 2005/05/21 file layer changes added a leading slash. // 2005/05/21 file layer changes added a leading slash.
RString sDir2 = sDir; RString sDir2 = sDir;
if( sDir2.Left(1) != "/" ) if( sDir2.Left(1) != "/" )
sDir2 = "/" + sDir2; sDir2 = "/" + sDir2;
@@ -1005,9 +1000,7 @@ Song *SongID::ToSong() const
XNode* SongID::CreateNode() const XNode* SongID::CreateNode() const
{ {
XNode* pNode = new XNode( "Song" ); XNode* pNode = new XNode( "Song" );
pNode->AppendAttr( "Dir", sDir ); pNode->AppendAttr( "Dir", sDir );
return pNode; return pNode;
} }
@@ -1060,7 +1053,6 @@ namespace
LUA_REGISTER_NAMESPACE( SongUtil ) LUA_REGISTER_NAMESPACE( SongUtil )
/* /*
* (c) 2001-2004 Chris Danford, Glenn Maynard * (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved. * All rights reserved.