Rename overloaded methods of Song so that stack traces are more helpful.

This commit is contained in:
Chris Danford
2003-08-10 08:58:11 +00:00
parent 53cbf16bfe
commit 1e514c1c51
12 changed files with 54 additions and 52 deletions
+11 -9
View File
@@ -127,6 +127,8 @@ int Course::GetMeter( int Difficult ) const
void Course::LoadFromCRSFile( CString sPath )
{
LOG->Trace( "Course::LoadFromCRSFile( '%s' )", sPath.c_str() );
m_sPath = sPath; // save path
MsdFile msd;
@@ -464,8 +466,8 @@ static vector<Song*> GetFilteredBestSongs( StepsType nt )
Song* pSong = vSongsByMostPlayed[j];
if( pSong->m_fMusicLengthSeconds > PREFSMAN->m_fLongVerSongSeconds ||
pSong->m_fMusicLengthSeconds > PREFSMAN->m_fMarathonVerSongSeconds ||
!pSong->GetNotes(nt, DIFFICULTY_MEDIUM, PREFSMAN->m_bAutogenMissingTypes) ||
!pSong->GetNotes(nt, DIFFICULTY_HARD, PREFSMAN->m_bAutogenMissingTypes) )
!pSong->GetStepsByDifficulty(nt, DIFFICULTY_MEDIUM, PREFSMAN->m_bAutogenMissingTypes) ||
!pSong->GetStepsByDifficulty(nt, DIFFICULTY_HARD, PREFSMAN->m_bAutogenMissingTypes) )
vSongsByMostPlayed.erase( vSongsByMostPlayed.begin()+j );
}
@@ -516,9 +518,9 @@ void Course::GetCourseInfo( StepsType nt, vector<Course::Info> &ci, int Difficul
if( pSong )
{
if( e.difficulty == DIFFICULTY_INVALID )
pNotes = pSong->GetNotes( nt, low_meter, high_meter, PREFSMAN->m_bAutogenMissingTypes );
pNotes = pSong->GetStepsByMeter( nt, low_meter, high_meter, PREFSMAN->m_bAutogenMissingTypes );
else
pNotes = pSong->GetNotes( nt, e.difficulty, PREFSMAN->m_bAutogenMissingTypes );
pNotes = pSong->GetStepsByDifficulty( nt, e.difficulty, PREFSMAN->m_bAutogenMissingTypes );
}
break;
case Entry::random:
@@ -538,9 +540,9 @@ void Course::GetCourseInfo( StepsType nt, vector<Course::Info> &ci, int Difficul
continue; /* wrong group */
if( e.difficulty == DIFFICULTY_INVALID )
pNotes = pSong->GetNotes( nt, low_meter, high_meter, PREFSMAN->m_bAutogenMissingTypes );
pNotes = pSong->GetStepsByMeter( nt, low_meter, high_meter, PREFSMAN->m_bAutogenMissingTypes );
else
pNotes = pSong->GetNotes( nt, e.difficulty, PREFSMAN->m_bAutogenMissingTypes );
pNotes = pSong->GetStepsByDifficulty( nt, e.difficulty, PREFSMAN->m_bAutogenMissingTypes );
if( pNotes ) // found a match
break; // stop searching
@@ -575,9 +577,9 @@ void Course::GetCourseInfo( StepsType nt, vector<Course::Info> &ci, int Difficul
}
if( e.difficulty == DIFFICULTY_INVALID )
pNotes = pSong->GetNotes( nt, low_meter, high_meter, PREFSMAN->m_bAutogenMissingTypes );
pNotes = pSong->GetStepsByMeter( nt, low_meter, high_meter, PREFSMAN->m_bAutogenMissingTypes );
else
pNotes = pSong->GetNotes( nt, e.difficulty, PREFSMAN->m_bAutogenMissingTypes );
pNotes = pSong->GetStepsByDifficulty( nt, e.difficulty, PREFSMAN->m_bAutogenMissingTypes );
if( pNotes == NULL )
pNotes = pSong->GetClosestNotes( nt, DIFFICULTY_MEDIUM );
@@ -600,7 +602,7 @@ void Course::GetCourseInfo( StepsType nt, vector<Course::Info> &ci, int Difficul
if(dc < DIFFICULTY_CHALLENGE)
{
dc = Difficulty(dc + 1);
Steps* pNewNotes = pSong->GetNotes( nt, dc, PREFSMAN->m_bAutogenMissingTypes );
Steps* pNewNotes = pSong->GetStepsByDifficulty( nt, dc, PREFSMAN->m_bAutogenMissingTypes );
if(pNewNotes)
pNotes = pNewNotes;
}
+2 -2
View File
@@ -314,10 +314,10 @@ void EditMenu::OnRowValueChanged( Row row )
Steps* EditMenu::GetSelectedNotes()
{
return GetSelectedSong()->GetNotes(GetSelectedNotesType(),GetSelectedDifficulty(), false);
return GetSelectedSong()->GetStepsByDifficulty(GetSelectedNotesType(),GetSelectedDifficulty(), false);
}
Steps* EditMenu::GetSelectedSourceNotes()
{
return GetSelectedSong()->GetNotes(GetSelectedSourceNotesType(),GetSelectedSourceDifficulty(), false);
return GetSelectedSong()->GetStepsByDifficulty(GetSelectedSourceNotesType(),GetSelectedSourceDifficulty(), false);
}
+1 -1
View File
@@ -65,7 +65,7 @@ void GrooveGraph::SetFromSong( Song* pSong )
{
for( int i=0; i<NUM_DIFFICULTIES; i++ )
{
Steps* pNotes = pSong->GetNotes( GAMESTATE->GetCurrentStyleDef()->m_StepsType, (Difficulty)i );
Steps* pNotes = pSong->GetStepsByDifficulty( GAMESTATE->GetCurrentStyleDef()->m_StepsType, (Difficulty)i );
const float* fRadarValues = pNotes ? pNotes->GetRadarValues() : NULL;
for( int j=0; j<NUM_RADAR_CATEGORIES; j++ )
fValues[j][i] = fRadarValues ? fRadarValues[j] : 0;
+4 -4
View File
@@ -333,7 +333,7 @@ void MusicWheel::GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CStrin
continue;
vector<Steps*> arraySteps;
pSong->GetNotes( arraySteps, GAMESTATE->GetCurrentStyleDef()->m_StepsType, DIFFICULTY_INVALID, -1, -1, "", PREFSMAN->m_bAutogenMissingTypes );
pSong->GetSteps( arraySteps, GAMESTATE->GetCurrentStyleDef()->m_StepsType, DIFFICULTY_INVALID, -1, -1, "", PREFSMAN->m_bAutogenMissingTypes );
if( !arraySteps.empty() )
arraySongs.push_back( pSong );
@@ -1429,21 +1429,21 @@ CString MusicWheel::GetSectionNameFromSongAndSort( const Song* pSong, SongSortOr
}
case SORT_EASY_METER:
{
Steps* pNotes = pSong->GetNotes(GAMESTATE->GetCurrentStyleDef()->m_StepsType,DIFFICULTY_EASY);
Steps* pNotes = pSong->GetStepsByDifficulty(GAMESTATE->GetCurrentStyleDef()->m_StepsType,DIFFICULTY_EASY);
if( pNotes )
return ssprintf("%02d", pNotes->GetMeter() );
return "N/A";
}
case SORT_MEDIUM_METER:
{
Steps* pNotes = pSong->GetNotes(GAMESTATE->GetCurrentStyleDef()->m_StepsType,DIFFICULTY_MEDIUM);
Steps* pNotes = pSong->GetStepsByDifficulty(GAMESTATE->GetCurrentStyleDef()->m_StepsType,DIFFICULTY_MEDIUM);
if( pNotes )
return ssprintf("%02d", pNotes->GetMeter() );
return "N/A";
}
case SORT_HARD_METER:
{
Steps* pNotes = pSong->GetNotes(GAMESTATE->GetCurrentStyleDef()->m_StepsType,DIFFICULTY_HARD);
Steps* pNotes = pSong->GetStepsByDifficulty(GAMESTATE->GetCurrentStyleDef()->m_StepsType,DIFFICULTY_HARD);
if( pNotes )
return ssprintf("%02d", pNotes->GetMeter() );
return "N/A";
+1 -1
View File
@@ -125,7 +125,7 @@ CString NoteSkinManager::GetMetric( PlayerNumber pn, CString sButtonName, CStrin
if( data.metrics.GetValue( sButtonName, sValue, sReturn ) )
return sReturn;
if( !data.metrics.GetValue( "NoteDisplay", sValue, sReturn ) )
RageException::Throw( "Could not read metric '%s - %s' or 'NoteDisplay - %s' in '%s'",
RageException::Throw( "Could not read metric '[%s] %s' or '[NoteDisplay] %s' in '%s'",
sButtonName.c_str(), sValue.c_str(), sValue.c_str(), sNoteSkinName.c_str() );
return sReturn;
}
+1 -1
View File
@@ -610,7 +610,7 @@ void ScreenEz2SelectMusic::MusicChanged()
for( pn = 0; pn < NUM_PLAYERS; ++pn)
{
pSong->GetNotes( m_arrayNotes[pn], GAMESTATE->GetCurrentStyleDef()->m_StepsType );
pSong->GetSteps( m_arrayNotes[pn], GAMESTATE->GetCurrentStyleDef()->m_StepsType );
SortNotesArrayByDifficulty( m_arrayNotes[pn] );
}
+2 -2
View File
@@ -49,11 +49,11 @@ bool ScreenJukebox::SetSong()
Difficulty dc = GAMESTATE->m_PreferredDifficulty[PLAYER_1];
Steps* pNotes = NULL;
if( dc != DIFFICULTY_INVALID )
pNotes = pSong->GetNotes( GAMESTATE->GetCurrentStyleDef()->m_StepsType, GAMESTATE->m_PreferredDifficulty[PLAYER_1] );
pNotes = pSong->GetStepsByDifficulty( GAMESTATE->GetCurrentStyleDef()->m_StepsType, GAMESTATE->m_PreferredDifficulty[PLAYER_1] );
else // "all difficulties"
{
vector<Steps*> vNotes;
pSong->GetNotes( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
pSong->GetSteps( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
if( vNotes.size() > 0 )
pNotes = vNotes[rand()%vNotes.size()];
}
+3 -3
View File
@@ -115,7 +115,7 @@ void ScreenPlayerOptions::ImportOptions()
else
{
vector<Steps*> vNotes;
GAMESTATE->m_pCurSong->GetNotes( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
GAMESTATE->m_pCurSong->GetSteps( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
SortNotesArrayByDifficulty( vNotes );
for( unsigned i=0; i<vNotes.size(); i++ )
{
@@ -230,7 +230,7 @@ void ScreenPlayerOptions::ImportOptions()
else
{
vector<Steps*> vNotes;
GAMESTATE->m_pCurSong->GetNotes( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
GAMESTATE->m_pCurSong->GetSteps( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
SortNotesArrayByDifficulty( vNotes );
for( unsigned i=0; i<vNotes.size(); i++ )
{
@@ -353,7 +353,7 @@ void ScreenPlayerOptions::ExportOptions()
else
{
vector<Steps*> vNotes;
GAMESTATE->m_pCurSong->GetNotes( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
GAMESTATE->m_pCurSong->GetSteps( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
SortNotesArrayByDifficulty( vNotes );
GAMESTATE->m_pCurNotes[p] = vNotes[ m_iSelectedOption[p][PO_STEP] ];
}
+1 -1
View File
@@ -975,7 +975,7 @@ void ScreenSelectMusic::AfterMusicChange()
m_fSampleStartSeconds = pSong->m_fMusicSampleStartSeconds;
m_fSampleLengthSeconds = pSong->m_fMusicSampleLengthSeconds;
pSong->GetNotes( m_arrayNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
pSong->GetSteps( m_arrayNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
SortNotesArrayByDifficulty( m_arrayNotes );
m_Banner.LoadFromSong( pSong );
+21 -21
View File
@@ -830,7 +830,7 @@ void Song::ReCalculateRadarValuesAndLastBeat()
}
}
void Song::GetNotes( vector<Steps*>& arrayAddTo, StepsType nt, Difficulty dc, int iMeterLow, int iMeterHigh, CString sDescription, bool bIncludeAutoGen ) const
void Song::GetSteps( vector<Steps*>& arrayAddTo, StepsType nt, Difficulty dc, int iMeterLow, int iMeterHigh, CString sDescription, bool bIncludeAutoGen ) const
{
for( unsigned i=0; i<m_apNotes.size(); i++ ) // for each of the Song's Steps
{
@@ -849,30 +849,30 @@ void Song::GetNotes( vector<Steps*>& arrayAddTo, StepsType nt, Difficulty dc, in
}
}
Steps* Song::GetNotes( StepsType nt, Difficulty dc, bool bIncludeAutoGen ) const
Steps* Song::GetStepsByDifficulty( StepsType nt, Difficulty dc, bool bIncludeAutoGen ) const
{
vector<Steps*> vNotes;
GetNotes( vNotes, nt, dc, -1, -1, "", bIncludeAutoGen );
GetSteps( vNotes, nt, dc, -1, -1, "", bIncludeAutoGen );
if( vNotes.size() == 0 )
return NULL;
else
return vNotes[0];
}
Steps* Song::GetNotes( StepsType nt, int iMeterLow, int iMeterHigh, bool bIncludeAutoGen ) const
Steps* Song::GetStepsByMeter( StepsType nt, int iMeterLow, int iMeterHigh, bool bIncludeAutoGen ) const
{
vector<Steps*> vNotes;
GetNotes( vNotes, nt, DIFFICULTY_INVALID, iMeterLow, iMeterHigh, "", bIncludeAutoGen );
GetSteps( vNotes, nt, DIFFICULTY_INVALID, iMeterLow, iMeterHigh, "", bIncludeAutoGen );
if( vNotes.size() == 0 )
return NULL;
else
return vNotes[0];
}
Steps* Song::GetNotes( StepsType nt, CString sDescription, bool bIncludeAutoGen ) const
Steps* Song::GetStepsByDescription( StepsType nt, CString sDescription, bool bIncludeAutoGen ) const
{
vector<Steps*> vNotes;
GetNotes( vNotes, nt, DIFFICULTY_INVALID, -1, -1, sDescription, bIncludeAutoGen );
GetSteps( vNotes, nt, DIFFICULTY_INVALID, -1, -1, sDescription, bIncludeAutoGen );
if( vNotes.size() == 0 )
return NULL;
else
@@ -884,27 +884,27 @@ Steps* Song::GetClosestNotes( StepsType nt, Difficulty dc, bool bIncludeAutoGen
{
Difficulty newDC = dc;
Steps* pNotes;
pNotes = GetNotes( nt, newDC, bIncludeAutoGen );
pNotes = GetStepsByDifficulty( nt, newDC, bIncludeAutoGen );
if( pNotes )
return pNotes;
newDC = (Difficulty)(dc-1);
CLAMP( (int&)newDC, 0, NUM_DIFFICULTIES-1 );
pNotes = GetNotes( nt, newDC, bIncludeAutoGen );
pNotes = GetStepsByDifficulty( nt, newDC, bIncludeAutoGen );
if( pNotes )
return pNotes;
newDC = (Difficulty)(dc+1);
CLAMP( (int&)newDC, 0, NUM_DIFFICULTIES-1 );
pNotes = GetNotes( nt, newDC, bIncludeAutoGen );
pNotes = GetStepsByDifficulty( nt, newDC, bIncludeAutoGen );
if( pNotes )
return pNotes;
newDC = (Difficulty)(dc-2);
CLAMP( (int&)newDC, 0, NUM_DIFFICULTIES-1 );
pNotes = GetNotes( nt, newDC, bIncludeAutoGen );
pNotes = GetStepsByDifficulty( nt, newDC, bIncludeAutoGen );
if( pNotes )
return pNotes;
newDC = (Difficulty)(dc+2);
CLAMP( (int&)newDC, 0, NUM_DIFFICULTIES-1 );
pNotes = GetNotes( nt, newDC, bIncludeAutoGen );
pNotes = GetStepsByDifficulty( nt, newDC, bIncludeAutoGen );
return pNotes;
}
@@ -1017,7 +1017,7 @@ void Song::AddAutoGenNotes()
for( StepsType nt=(StepsType)0; nt<NUM_STEPS_TYPES; nt=(StepsType)(nt+1) )
{
vector<Steps*> apNotes;
this->GetNotes( apNotes, nt );
this->GetSteps( apNotes, nt );
if(apNotes.empty() || apNotes[0]->IsAutogen())
continue; /* can't autogen from other autogen */
@@ -1069,7 +1069,7 @@ Grade Song::GetGradeForDifficulty( const StyleDef *st, PlayerNumber pn, Difficul
{
// return max grade of notes in difficulty class
vector<Steps*> aNotes;
this->GetNotes( aNotes, st->m_StepsType );
this->GetSteps( aNotes, st->m_StepsType );
SortNotesArrayByDifficulty( aNotes );
Grade grade = GRADE_NO_DATA;
@@ -1091,9 +1091,9 @@ bool Song::IsNew() const
bool Song::IsEasy( StepsType nt ) const
{
Steps* pBeginnerNotes = GetNotes( nt, DIFFICULTY_BEGINNER );
Steps* pEasyNotes = GetNotes( nt, DIFFICULTY_EASY );
Steps* pHardNotes = GetNotes( nt, DIFFICULTY_HARD );
Steps* pBeginnerNotes = GetStepsByDifficulty( nt, DIFFICULTY_BEGINNER );
Steps* pEasyNotes = GetStepsByDifficulty( nt, DIFFICULTY_EASY );
Steps* pHardNotes = GetStepsByDifficulty( nt, DIFFICULTY_HARD );
// HACK: Looks bizarre to see the easy mark by Legend of MAX.
if( pHardNotes && pHardNotes->GetMeter() > 9 )
@@ -1183,7 +1183,7 @@ void SortSongPointerArrayByTitle( vector<Song*> &arraySongPointers )
static int GetSongSortDifficulty(const Song *pSong)
{
vector<Steps*> aNotes;
pSong->GetNotes( aNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
pSong->GetSteps( aNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
// sort by anything but beginner
/* This makes the sort a little odd; songs can end up in unintuitive places because,
@@ -1391,8 +1391,8 @@ struct CompareSongByMeter
CompareSongByMeter(Difficulty d): dc(d) { }
bool operator() (const Song* pSong1, const Song* pSong2)
{
Steps* pNotes1 = pSong1->GetNotes( GAMESTATE->GetCurrentStyleDef()->m_StepsType, dc );
Steps* pNotes2 = pSong2->GetNotes( GAMESTATE->GetCurrentStyleDef()->m_StepsType, dc );
Steps* pNotes1 = pSong1->GetStepsByDifficulty( GAMESTATE->GetCurrentStyleDef()->m_StepsType, dc );
Steps* pNotes2 = pSong2->GetStepsByDifficulty( GAMESTATE->GetCurrentStyleDef()->m_StepsType, dc );
const int iMeter1 = pNotes1 ? pNotes1->GetMeter() : 0;
const int iMeter2 = pNotes2 ? pNotes2->GetMeter() : 0;
@@ -1579,7 +1579,7 @@ int Song::GetNumNotesWithGrade( Grade g ) const
{
int iCount = 0;
vector<Steps*> vNotes;
this->GetNotes( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
this->GetSteps( vNotes, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
for( unsigned j=0; j<vNotes.size(); j++ )
if( vNotes[j]->m_MemCardScores[MEMORY_CARD_MACHINE].grade == g )
iCount++;
+3 -3
View File
@@ -305,9 +305,9 @@ void SongManager::ReadNoteScoresFromFile( CString fn, int c )
if( pSong )
{
if( dc==DIFFICULTY_INVALID )
pNotes = pSong->GetNotes( nt, sDescription );
pNotes = pSong->GetStepsByDescription( nt, sDescription );
else
pNotes = pSong->GetNotes( nt, dc );
pNotes = pSong->GetStepsByDifficulty( nt, dc );
}
getline(f, line);
@@ -985,7 +985,7 @@ void SongManager::GetExtraStageInfo( bool bExtra2, const StyleDef *sd,
Song* pSong = apSongs[s];
vector<Steps*> apNotes;
pSong->GetNotes( apNotes, sd->m_StepsType );
pSong->GetSteps( apNotes, sd->m_StepsType );
for( unsigned n=0; n<apNotes.size(); n++ ) // foreach Steps
{
Steps* pNotes = apNotes[n];
+4 -4
View File
@@ -243,10 +243,10 @@ public:
bool SongCompleteForStyle( const StyleDef *st ) const;
bool SongHasNotesType( StepsType nt ) const;
bool SongHasNotesTypeAndDifficulty( StepsType nt, Difficulty dc ) const;
void GetNotes( vector<Steps*>& arrayAddTo, StepsType nt, Difficulty dc = DIFFICULTY_INVALID, int iMeterLow = -1, int iMeterHigh = -1, CString sDescription = "", bool bIncludeAutoGen = true ) const;
Steps* GetNotes( StepsType nt, Difficulty dc, bool bIncludeAutoGen = true ) const;
Steps* GetNotes( StepsType nt, int iMeterLow, int iMeterHigh, bool bIncludeAutoGen = true ) const;
Steps* GetNotes( StepsType nt, CString sDescription, bool bIncludeAutoGen = true ) const;
void GetSteps( vector<Steps*>& arrayAddTo, StepsType nt, Difficulty dc = DIFFICULTY_INVALID, int iMeterLow = -1, int iMeterHigh = -1, CString sDescription = "", bool bIncludeAutoGen = true ) const;
Steps* GetStepsByDifficulty( StepsType nt, Difficulty dc, bool bIncludeAutoGen = true ) const;
Steps* GetStepsByMeter( StepsType nt, int iMeterLow, int iMeterHigh, bool bIncludeAutoGen = true ) const;
Steps* GetStepsByDescription( StepsType nt, CString sDescription, bool bIncludeAutoGen = true ) const;
Steps* GetClosestNotes( StepsType nt, Difficulty dc, bool bIncludeAutoGen = true ) const;
void GetEdits( vector<Steps*>& arrayAddTo, StepsType nt, bool bIncludeAutoGen = true ) const;
int GetNumTimesPlayed() const;