some more s/GetSize/size/ and other minor STLisms
This commit is contained in:
+11
-11
@@ -18,9 +18,9 @@ GroupList::GroupList()
|
|||||||
|
|
||||||
void GroupList::DoneAddingGroups()
|
void GroupList::DoneAddingGroups()
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
for( i=0; i<min(m_textLabels.GetSize(), MAX_GROUPS_ONSCREEN); i++ )
|
for( i=0; i<min(m_textLabels.size(), MAX_GROUPS_ONSCREEN); i++ )
|
||||||
{
|
{
|
||||||
m_sprButton[i].Load( THEME->GetPathTo("Graphics","select group button") );
|
m_sprButton[i].Load( THEME->GetPathTo("Graphics","select group button") );
|
||||||
m_sprButton[i].SetXY( BUTTON_X, BUTTON_START_Y + i*BUTTON_SPACING_Y );
|
m_sprButton[i].SetXY( BUTTON_X, BUTTON_START_Y + i*BUTTON_SPACING_Y );
|
||||||
@@ -28,7 +28,7 @@ void GroupList::DoneAddingGroups()
|
|||||||
this->AddChild( &m_screenLabels[i] );
|
this->AddChild( &m_screenLabels[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i=0; i<min(m_textLabels.GetSize(), MAX_GROUPS_ONSCREEN); i++ )
|
for( i=0; i<min(m_textLabels.size(), MAX_GROUPS_ONSCREEN); i++ )
|
||||||
{
|
{
|
||||||
m_screenLabels[i].LoadFromFont( THEME->GetPathTo("Fonts","select group button label") );
|
m_screenLabels[i].LoadFromFont( THEME->GetPathTo("Fonts","select group button label") );
|
||||||
m_screenLabels[i].SetXY( BUTTON_X, BUTTON_START_Y + i*BUTTON_SPACING_Y );
|
m_screenLabels[i].SetXY( BUTTON_X, BUTTON_START_Y + i*BUTTON_SPACING_Y );
|
||||||
@@ -44,7 +44,7 @@ void GroupList::DoneAddingGroups()
|
|||||||
|
|
||||||
void GroupList::SetLabels()
|
void GroupList::SetLabels()
|
||||||
{
|
{
|
||||||
for( int i=0; i<min(m_textLabels.GetSize(), MAX_GROUPS_ONSCREEN); i++ )
|
for( unsigned i=0; i<min(m_textLabels.size(), MAX_GROUPS_ONSCREEN); i++ )
|
||||||
{
|
{
|
||||||
CString &label = m_textLabels[m_iTop+i];
|
CString &label = m_textLabels[m_iTop+i];
|
||||||
m_screenLabels[i].SetText( SONGMAN->ShortenGroupName( label ) );
|
m_screenLabels[i].SetText( SONGMAN->ShortenGroupName( label ) );
|
||||||
@@ -91,7 +91,7 @@ void GroupList::Up()
|
|||||||
BeforeChange();
|
BeforeChange();
|
||||||
|
|
||||||
if( m_iSelection == 0 )
|
if( m_iSelection == 0 )
|
||||||
SetSelection(m_textLabels.GetSize()-1);
|
SetSelection(m_textLabels.size()-1);
|
||||||
else
|
else
|
||||||
SetSelection(m_iSelection-1);
|
SetSelection(m_iSelection-1);
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ void GroupList::Down()
|
|||||||
{
|
{
|
||||||
BeforeChange();
|
BeforeChange();
|
||||||
|
|
||||||
SetSelection((m_iSelection+1) % m_textLabels.GetSize());
|
SetSelection((m_iSelection+1) % m_textLabels.size());
|
||||||
|
|
||||||
AfterChange();
|
AfterChange();
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ void GroupList::AddGroup(CString name)
|
|||||||
m_textLabels.Add(name);
|
m_textLabels.Add(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupList::SetSelection( int sel )
|
void GroupList::SetSelection( unsigned sel )
|
||||||
{
|
{
|
||||||
BeforeChange();
|
BeforeChange();
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ void GroupList::SetSelection( int sel )
|
|||||||
if( m_iSelection >= MAX_GROUPS_ONSCREEN/2 )
|
if( m_iSelection >= MAX_GROUPS_ONSCREEN/2 )
|
||||||
m_iTop++;
|
m_iTop++;
|
||||||
} else if( sel == m_iSelection-1 ) {
|
} else if( sel == m_iSelection-1 ) {
|
||||||
if(m_iSelection < m_textLabels.GetSize() - MAX_GROUPS_ONSCREEN/2)
|
if(m_iSelection < m_textLabels.size() - MAX_GROUPS_ONSCREEN/2)
|
||||||
m_iTop--;
|
m_iTop--;
|
||||||
} else {
|
} else {
|
||||||
/* We're jumping somewhere else; just put the top somewhere
|
/* We're jumping somewhere else; just put the top somewhere
|
||||||
@@ -130,7 +130,7 @@ void GroupList::SetSelection( int sel )
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_iSelection=sel;
|
m_iSelection=sel;
|
||||||
m_iTop = clamp( m_iTop, 0, m_textLabels.GetSize()-MAX_GROUPS_ONSCREEN );
|
m_iTop = clamp( m_iTop, 0u, m_textLabels.size()-MAX_GROUPS_ONSCREEN );
|
||||||
|
|
||||||
/* The current selection must always be visible. */
|
/* The current selection must always be visible. */
|
||||||
ASSERT( m_iTop <= m_iSelection );
|
ASSERT( m_iTop <= m_iSelection );
|
||||||
@@ -143,7 +143,7 @@ void GroupList::SetSelection( int sel )
|
|||||||
|
|
||||||
void GroupList::TweenOnScreen()
|
void GroupList::TweenOnScreen()
|
||||||
{
|
{
|
||||||
for( int i=0; i<min(m_textLabels.GetSize(), MAX_GROUPS_ONSCREEN); i++ )
|
for( unsigned i=0; i<min(m_textLabels.size(), MAX_GROUPS_ONSCREEN); i++ )
|
||||||
{
|
{
|
||||||
m_sprButton[i].SetX( BUTTON_X+400 );
|
m_sprButton[i].SetX( BUTTON_X+400 );
|
||||||
m_sprButton[i].BeginTweening( 0.1f*i, TWEEN_BOUNCE_END );
|
m_sprButton[i].BeginTweening( 0.1f*i, TWEEN_BOUNCE_END );
|
||||||
@@ -159,7 +159,7 @@ void GroupList::TweenOnScreen()
|
|||||||
|
|
||||||
void GroupList::TweenOffScreen()
|
void GroupList::TweenOffScreen()
|
||||||
{
|
{
|
||||||
for( int i=0; i<min(m_textLabels.GetSize(), MAX_GROUPS_ONSCREEN); i++ )
|
for( unsigned i=0; i<min(m_textLabels.size(), MAX_GROUPS_ONSCREEN); i++ )
|
||||||
{
|
{
|
||||||
if( i == m_iSelection )
|
if( i == m_iSelection )
|
||||||
m_sprButton[i].BeginTweening( 1.0f, TWEEN_BOUNCE_BEGIN );
|
m_sprButton[i].BeginTweening( 1.0f, TWEEN_BOUNCE_BEGIN );
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
#include "BitmapText.h"
|
#include "BitmapText.h"
|
||||||
|
|
||||||
const int MAX_GROUPS_ONSCREEN = 8;
|
const unsigned MAX_GROUPS_ONSCREEN = 8;
|
||||||
|
|
||||||
class GroupList: public ActorFrame {
|
class GroupList: public ActorFrame {
|
||||||
Sprite m_sprButton[MAX_GROUPS_ONSCREEN];
|
Sprite m_sprButton[MAX_GROUPS_ONSCREEN];
|
||||||
@@ -13,9 +13,9 @@ class GroupList: public ActorFrame {
|
|||||||
CArray<CString,CString> m_textLabels;
|
CArray<CString,CString> m_textLabels;
|
||||||
|
|
||||||
/* Currently selected label. */
|
/* Currently selected label. */
|
||||||
int m_iSelection;
|
unsigned m_iSelection;
|
||||||
/* Label that's currently at the top of the screen. */
|
/* Label that's currently at the top of the screen. */
|
||||||
int m_iTop;
|
unsigned m_iTop;
|
||||||
|
|
||||||
void BeforeChange();
|
void BeforeChange();
|
||||||
void AfterChange();
|
void AfterChange();
|
||||||
@@ -24,7 +24,7 @@ class GroupList: public ActorFrame {
|
|||||||
public:
|
public:
|
||||||
GroupList();
|
GroupList();
|
||||||
|
|
||||||
void SetSelection(int sel);
|
void SetSelection(unsigned sel);
|
||||||
int GetSelection() const { return m_iSelection; }
|
int GetSelection() const { return m_iSelection; }
|
||||||
CString GetSelectionName() const { return m_textLabels[m_iSelection]; }
|
CString GetSelectionName() const { return m_textLabels[m_iSelection]; }
|
||||||
void Up();
|
void Up();
|
||||||
|
|||||||
+48
-48
@@ -89,7 +89,7 @@ Song::Song()
|
|||||||
|
|
||||||
Song::~Song()
|
Song::~Song()
|
||||||
{
|
{
|
||||||
for( int i=0; i<m_apNotes.GetSize(); i++ )
|
for( unsigned i=0; i<m_apNotes.size(); i++ )
|
||||||
SAFE_DELETE( m_apNotes[i] );
|
SAFE_DELETE( m_apNotes[i] );
|
||||||
|
|
||||||
m_apNotes.clear();
|
m_apNotes.clear();
|
||||||
@@ -130,10 +130,10 @@ void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, fl
|
|||||||
fElapsedTime += m_fBeat0OffsetInSeconds;
|
fElapsedTime += m_fBeat0OffsetInSeconds;
|
||||||
|
|
||||||
|
|
||||||
for( int i=0; i<m_BPMSegments.GetSize(); i++ ) // foreach BPMSegment
|
for( unsigned i=0; i<m_BPMSegments.size(); i++ ) // foreach BPMSegment
|
||||||
{
|
{
|
||||||
float fStartBeatThisSegment = m_BPMSegments[i].m_fStartBeat;
|
float fStartBeatThisSegment = m_BPMSegments[i].m_fStartBeat;
|
||||||
bool bIsLastBPMSegment = i==m_BPMSegments.GetSize()-1;
|
bool bIsLastBPMSegment = i==m_BPMSegments.size()-1;
|
||||||
float fStartBeatNextSegment = bIsLastBPMSegment ? 40000/*inf*/ : m_BPMSegments[i+1].m_fStartBeat;
|
float fStartBeatNextSegment = bIsLastBPMSegment ? 40000/*inf*/ : m_BPMSegments[i+1].m_fStartBeat;
|
||||||
float fBeatsInThisSegment = fStartBeatNextSegment - fStartBeatThisSegment;
|
float fBeatsInThisSegment = fStartBeatNextSegment - fStartBeatThisSegment;
|
||||||
float fBPM = m_BPMSegments[i].m_fBPM;
|
float fBPM = m_BPMSegments[i].m_fBPM;
|
||||||
@@ -141,8 +141,8 @@ void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, fl
|
|||||||
|
|
||||||
// calculate the number of seconds in this segment
|
// calculate the number of seconds in this segment
|
||||||
float fSecondsInThisSegment = fBeatsInThisSegment / fBPS;
|
float fSecondsInThisSegment = fBeatsInThisSegment / fBPS;
|
||||||
int j;
|
unsigned j;
|
||||||
for( j=0; j<m_StopSegments.GetSize(); j++ ) // foreach freeze
|
for( j=0; j<m_StopSegments.size(); j++ ) // foreach freeze
|
||||||
{
|
{
|
||||||
if( fStartBeatThisSegment <= m_StopSegments[j].m_fStartBeat && m_StopSegments[j].m_fStartBeat < fStartBeatNextSegment )
|
if( fStartBeatThisSegment <= m_StopSegments[j].m_fStartBeat && m_StopSegments[j].m_fStartBeat < fStartBeatNextSegment )
|
||||||
{
|
{
|
||||||
@@ -163,7 +163,7 @@ void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, fl
|
|||||||
|
|
||||||
float fBeatEstimate = fStartBeatThisSegment + fElapsedTime*fBPS;
|
float fBeatEstimate = fStartBeatThisSegment + fElapsedTime*fBPS;
|
||||||
|
|
||||||
for( j=0; j<m_StopSegments.GetSize(); j++ ) // foreach freeze
|
for( j=0; j<m_StopSegments.size(); j++ ) // foreach freeze
|
||||||
{
|
{
|
||||||
if( fStartBeatThisSegment > m_StopSegments[j].m_fStartBeat ||
|
if( fStartBeatThisSegment > m_StopSegments[j].m_fStartBeat ||
|
||||||
m_StopSegments[j].m_fStartBeat > fStartBeatNextSegment )
|
m_StopSegments[j].m_fStartBeat > fStartBeatNextSegment )
|
||||||
@@ -300,7 +300,7 @@ bool Song::LoadFromSongDir( CString sDir )
|
|||||||
// save group name
|
// save group name
|
||||||
CStringArray sDirectoryParts;
|
CStringArray sDirectoryParts;
|
||||||
split( m_sSongDir, "\\", sDirectoryParts, false );
|
split( m_sSongDir, "\\", sDirectoryParts, false );
|
||||||
m_sGroupName = sDirectoryParts[sDirectoryParts.GetSize()-3]; // second from last item
|
m_sGroupName = sDirectoryParts[sDirectoryParts.size()-3]; // second from last item
|
||||||
|
|
||||||
//
|
//
|
||||||
// First look in the cache for this song (without loading NoteData)
|
// First look in the cache for this song (without loading NoteData)
|
||||||
@@ -345,16 +345,16 @@ bool Song::LoadFromSongDir( CString sDir )
|
|||||||
m_sSongFileName = m_sSongDir;
|
m_sSongFileName = m_sSongDir;
|
||||||
CStringArray asFileNames;
|
CStringArray asFileNames;
|
||||||
GetDirListing( m_sSongDir+"*.sm", asFileNames );
|
GetDirListing( m_sSongDir+"*.sm", asFileNames );
|
||||||
if( asFileNames.GetSize() > 0 )
|
if( !asFileNames.empty() )
|
||||||
m_sSongFileName += asFileNames[0];
|
m_sSongFileName += asFileNames[0];
|
||||||
else {
|
else {
|
||||||
GetDirListing( m_sSongDir+"*.dwi", asFileNames );
|
GetDirListing( m_sSongDir+"*.dwi", asFileNames );
|
||||||
if( asFileNames.GetSize() > 0 ) {
|
if( !asFileNames.empty() ) {
|
||||||
m_sSongFileName += asFileNames[0];
|
m_sSongFileName += asFileNames[0];
|
||||||
/* XXX: This would mess up "vote.for.dwight.d.eisenhower.dwi". */
|
/* XXX: This would mess up "vote.for.dwight.d.eisenhower.dwi". */
|
||||||
m_sSongFileName.Replace( ".dwi", ".sm" );
|
m_sSongFileName.Replace( ".dwi", ".sm" );
|
||||||
} else {
|
} else {
|
||||||
m_sSongFileName += sDirectoryParts[sDirectoryParts.GetSize()-2]; // last item
|
m_sSongFileName += sDirectoryParts[sDirectoryParts.size()-2]; // last item
|
||||||
m_sSongFileName += ".sm";
|
m_sSongFileName += ".sm";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -370,7 +370,7 @@ void Song::TidyUpData()
|
|||||||
if( m_sMainTitle == "" ) m_sMainTitle = "Untitled song";
|
if( m_sMainTitle == "" ) m_sMainTitle = "Untitled song";
|
||||||
m_sSubTitle.TrimRight();
|
m_sSubTitle.TrimRight();
|
||||||
if( m_sArtist == "" ) m_sArtist = "Unknown artist";
|
if( m_sArtist == "" ) m_sArtist = "Unknown artist";
|
||||||
if( m_BPMSegments.GetSize() == 0 )
|
if( m_BPMSegments.empty() )
|
||||||
throw RageException( "No #BPM specified in '%s%s.'", m_sSongDir.GetString(), m_sSongFileName.GetString() );
|
throw RageException( "No #BPM specified in '%s%s.'", m_sSongDir.GetString(), m_sSongFileName.GetString() );
|
||||||
|
|
||||||
if( !HasMusic() )
|
if( !HasMusic() )
|
||||||
@@ -380,7 +380,7 @@ void Song::TidyUpData()
|
|||||||
GetDirListing( m_sSongDir + CString("*.ogg"), arrayPossibleMusic );
|
GetDirListing( m_sSongDir + CString("*.ogg"), arrayPossibleMusic );
|
||||||
GetDirListing( m_sSongDir + CString("*.wav"), arrayPossibleMusic );
|
GetDirListing( m_sSongDir + CString("*.wav"), arrayPossibleMusic );
|
||||||
|
|
||||||
if( arrayPossibleMusic.GetSize() > 0 ) // we found a match
|
if( !arrayPossibleMusic.empty() ) // we found a match
|
||||||
m_sMusicFile = arrayPossibleMusic[0];
|
m_sMusicFile = arrayPossibleMusic[0];
|
||||||
// Don't throw on missing music. -Chris
|
// Don't throw on missing music. -Chris
|
||||||
// else
|
// else
|
||||||
@@ -423,7 +423,7 @@ void Song::TidyUpData()
|
|||||||
GetDirListing( m_sSongDir + CString("*banner*.jpg"), arrayPossibleBanners );
|
GetDirListing( m_sSongDir + CString("*banner*.jpg"), arrayPossibleBanners );
|
||||||
GetDirListing( m_sSongDir + CString("*banner*.bmp"), arrayPossibleBanners );
|
GetDirListing( m_sSongDir + CString("*banner*.bmp"), arrayPossibleBanners );
|
||||||
GetDirListing( m_sSongDir + CString("*banner*.gif"), arrayPossibleBanners );
|
GetDirListing( m_sSongDir + CString("*banner*.gif"), arrayPossibleBanners );
|
||||||
if( arrayPossibleBanners.GetSize() > 0 )
|
if( !arrayPossibleBanners.empty() )
|
||||||
m_sBannerFile = arrayPossibleBanners[0];
|
m_sBannerFile = arrayPossibleBanners[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ void Song::TidyUpData()
|
|||||||
GetDirListing( m_sSongDir + CString("*background*.jpg"), arrayPossibleBGs );
|
GetDirListing( m_sSongDir + CString("*background*.jpg"), arrayPossibleBGs );
|
||||||
GetDirListing( m_sSongDir + CString("*background*.bmp"), arrayPossibleBGs );
|
GetDirListing( m_sSongDir + CString("*background*.bmp"), arrayPossibleBGs );
|
||||||
GetDirListing( m_sSongDir + CString("*background*.gif"), arrayPossibleBGs );
|
GetDirListing( m_sSongDir + CString("*background*.gif"), arrayPossibleBGs );
|
||||||
if( arrayPossibleBGs.GetSize() > 0 )
|
if( !arrayPossibleBGs.empty() )
|
||||||
m_sBackgroundFile = arrayPossibleBGs[0];
|
m_sBackgroundFile = arrayPossibleBGs[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,7 +455,7 @@ void Song::TidyUpData()
|
|||||||
GetDirListing( m_sSongDir + CString("*cdtitle*.jpg"), arrayPossibleCDTitles );
|
GetDirListing( m_sSongDir + CString("*cdtitle*.jpg"), arrayPossibleCDTitles );
|
||||||
GetDirListing( m_sSongDir + CString("*cdtitle*.bmp"), arrayPossibleCDTitles );
|
GetDirListing( m_sSongDir + CString("*cdtitle*.bmp"), arrayPossibleCDTitles );
|
||||||
GetDirListing( m_sSongDir + CString("*cdtitle*.gif"), arrayPossibleCDTitles );
|
GetDirListing( m_sSongDir + CString("*cdtitle*.gif"), arrayPossibleCDTitles );
|
||||||
if( arrayPossibleCDTitles.GetSize() > 0 )
|
if( !arrayPossibleCDTitles.empty() )
|
||||||
m_sCDTitleFile = arrayPossibleCDTitles[0];
|
m_sCDTitleFile = arrayPossibleCDTitles[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,8 +468,8 @@ void Song::TidyUpData()
|
|||||||
GetDirListing( m_sSongDir + CString("*.jpg"), arrayImages );
|
GetDirListing( m_sSongDir + CString("*.jpg"), arrayImages );
|
||||||
GetDirListing( m_sSongDir + CString("*.bmp"), arrayImages );
|
GetDirListing( m_sSongDir + CString("*.bmp"), arrayImages );
|
||||||
GetDirListing( m_sSongDir + CString("*.gif"), arrayImages );
|
GetDirListing( m_sSongDir + CString("*.gif"), arrayImages );
|
||||||
|
unsigned i;
|
||||||
for( int i=0; i<arrayImages.GetSize(); i++ ) // foreach image
|
for( i=0; i<arrayImages.size(); i++ ) // foreach image
|
||||||
{
|
{
|
||||||
// Skip any image that we've already classified
|
// Skip any image that we've already classified
|
||||||
|
|
||||||
@@ -515,7 +515,7 @@ void Song::TidyUpData()
|
|||||||
GetDirListing( m_sSongDir + CString("*.avi"), arrayPossibleMovies );
|
GetDirListing( m_sSongDir + CString("*.avi"), arrayPossibleMovies );
|
||||||
GetDirListing( m_sSongDir + CString("*.mpg"), arrayPossibleMovies );
|
GetDirListing( m_sSongDir + CString("*.mpg"), arrayPossibleMovies );
|
||||||
GetDirListing( m_sSongDir + CString("*.mpeg"), arrayPossibleMovies );
|
GetDirListing( m_sSongDir + CString("*.mpeg"), arrayPossibleMovies );
|
||||||
if( arrayPossibleMovies.GetSize() == 1 )
|
if( arrayPossibleMovies.size() == 1 )
|
||||||
{
|
{
|
||||||
CString sBGMovieFile = arrayPossibleMovies[0];
|
CString sBGMovieFile = arrayPossibleMovies[0];
|
||||||
|
|
||||||
@@ -531,7 +531,7 @@ void Song::TidyUpData()
|
|||||||
//
|
//
|
||||||
// calculate radar values and first/last beat
|
// calculate radar values and first/last beat
|
||||||
//
|
//
|
||||||
for( i=0; i<m_apNotes.GetSize(); i++ )
|
for( i=0; i<m_apNotes.size(); i++ )
|
||||||
{
|
{
|
||||||
Notes* pNotes = m_apNotes[i];
|
Notes* pNotes = m_apNotes[i];
|
||||||
NoteData tempNoteData;
|
NoteData tempNoteData;
|
||||||
@@ -558,7 +558,7 @@ void Song::TidyUpData()
|
|||||||
{
|
{
|
||||||
CArray<Notes*,Notes*> apNotes;
|
CArray<Notes*,Notes*> apNotes;
|
||||||
GetNotesThatMatch( nt, apNotes );
|
GetNotesThatMatch( nt, apNotes );
|
||||||
if( apNotes.GetSize() == 1 )
|
if( apNotes.size() == 1 )
|
||||||
if( 0 == apNotes[0]->m_sDescription.CompareNoCase("smaniac") )
|
if( 0 == apNotes[0]->m_sDescription.CompareNoCase("smaniac") )
|
||||||
{
|
{
|
||||||
apNotes[0]->m_sDescription = "Challenge";
|
apNotes[0]->m_sDescription = "Challenge";
|
||||||
@@ -569,7 +569,7 @@ void Song::TidyUpData()
|
|||||||
|
|
||||||
void Song::GetNotesThatMatch( NotesType nt, CArray<Notes*, Notes*>& arrayAddTo ) const
|
void Song::GetNotesThatMatch( NotesType nt, CArray<Notes*, Notes*>& arrayAddTo ) const
|
||||||
{
|
{
|
||||||
for( int i=0; i<m_apNotes.GetSize(); i++ ) // for each of the Song's Notes
|
for( unsigned i=0; i<m_apNotes.size(); i++ ) // for each of the Song's Notes
|
||||||
{
|
{
|
||||||
if( m_apNotes[i]->m_NotesType == nt )
|
if( m_apNotes[i]->m_NotesType == nt )
|
||||||
arrayAddTo.Add( m_apNotes[i] );
|
arrayAddTo.Add( m_apNotes[i] );
|
||||||
@@ -586,7 +586,7 @@ bool Song::SongCompleteForStyle( const StyleDef *st ) const
|
|||||||
|
|
||||||
bool Song::SongHasNotesType( NotesType nt ) const
|
bool Song::SongHasNotesType( NotesType nt ) const
|
||||||
{
|
{
|
||||||
for( int i=0; i < m_apNotes.GetSize(); i++ ) // foreach Notes
|
for( unsigned i=0; i < m_apNotes.size(); i++ ) // foreach Notes
|
||||||
if( m_apNotes[i]->m_NotesType == nt )
|
if( m_apNotes[i]->m_NotesType == nt )
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
@@ -594,7 +594,7 @@ bool Song::SongHasNotesType( NotesType nt ) const
|
|||||||
|
|
||||||
bool Song::SongHasNotesTypeAndDifficulty( NotesType nt, Difficulty dc ) const
|
bool Song::SongHasNotesTypeAndDifficulty( NotesType nt, Difficulty dc ) const
|
||||||
{
|
{
|
||||||
for( int i=0; i < m_apNotes.GetSize(); i++ ) // foreach Notes
|
for( unsigned i=0; i < m_apNotes.size(); i++ ) // foreach Notes
|
||||||
if( m_apNotes[i]->m_NotesType == nt && m_apNotes[i]->m_Difficulty == dc )
|
if( m_apNotes[i]->m_NotesType == nt && m_apNotes[i]->m_Difficulty == dc )
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
@@ -627,7 +627,7 @@ void Song::Save()
|
|||||||
GetDirListing( m_sSongDir + "*.ksf", arrayOldFileNames );
|
GetDirListing( m_sSongDir + "*.ksf", arrayOldFileNames );
|
||||||
GetDirListing( m_sSongDir + "*.sm", arrayOldFileNames );
|
GetDirListing( m_sSongDir + "*.sm", arrayOldFileNames );
|
||||||
|
|
||||||
for( int i=0; i<arrayOldFileNames.GetSize(); i++ )
|
for( unsigned i=0; i<arrayOldFileNames.size(); i++ )
|
||||||
{
|
{
|
||||||
CString sOldPath = m_sSongDir + arrayOldFileNames[i];
|
CString sOldPath = m_sSongDir + arrayOldFileNames[i];
|
||||||
CString sNewPath = sOldPath + ".old";
|
CString sNewPath = sOldPath + ".old";
|
||||||
@@ -643,7 +643,7 @@ void Song::SaveToSMFile( CString sPath, bool bSavingCache )
|
|||||||
{
|
{
|
||||||
LOG->Trace( "Song::SaveToSMDir('%s')", sPath.GetString() );
|
LOG->Trace( "Song::SaveToSMDir('%s')", sPath.GetString() );
|
||||||
|
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
FILE* fp = fopen( sPath, "w" );
|
FILE* fp = fopen( sPath, "w" );
|
||||||
if( fp == NULL )
|
if( fp == NULL )
|
||||||
@@ -682,34 +682,34 @@ void Song::SaveToSMFile( CString sPath, bool bSavingCache )
|
|||||||
fprintf( fp, ";\n" );
|
fprintf( fp, ";\n" );
|
||||||
|
|
||||||
fprintf( fp, "#BPMS:" );
|
fprintf( fp, "#BPMS:" );
|
||||||
for( i=0; i<m_BPMSegments.GetSize(); i++ )
|
for( i=0; i<m_BPMSegments.size(); i++ )
|
||||||
{
|
{
|
||||||
BPMSegment &bs = m_BPMSegments[i];
|
BPMSegment &bs = m_BPMSegments[i];
|
||||||
|
|
||||||
fprintf( fp, "%.3f=%.3f", bs.m_fStartBeat, bs.m_fBPM );
|
fprintf( fp, "%.3f=%.3f", bs.m_fStartBeat, bs.m_fBPM );
|
||||||
if( i != m_BPMSegments.GetSize()-1 )
|
if( i != m_BPMSegments.size()-1 )
|
||||||
fprintf( fp, "," );
|
fprintf( fp, "," );
|
||||||
}
|
}
|
||||||
fprintf( fp, ";\n" );
|
fprintf( fp, ";\n" );
|
||||||
|
|
||||||
fprintf( fp, "#STOPS:" );
|
fprintf( fp, "#STOPS:" );
|
||||||
for( i=0; i<m_StopSegments.GetSize(); i++ )
|
for( i=0; i<m_StopSegments.size(); i++ )
|
||||||
{
|
{
|
||||||
StopSegment &fs = m_StopSegments[i];
|
StopSegment &fs = m_StopSegments[i];
|
||||||
|
|
||||||
fprintf( fp, "%.3f=%.3f", fs.m_fStartBeat, fs.m_fStopSeconds );
|
fprintf( fp, "%.3f=%.3f", fs.m_fStartBeat, fs.m_fStopSeconds );
|
||||||
if( i != m_StopSegments.GetSize()-1 )
|
if( i != m_StopSegments.size()-1 )
|
||||||
fprintf( fp, "," );
|
fprintf( fp, "," );
|
||||||
}
|
}
|
||||||
fprintf( fp, ";\n" );
|
fprintf( fp, ";\n" );
|
||||||
|
|
||||||
fprintf( fp, "#BGCHANGES:" );
|
fprintf( fp, "#BGCHANGES:" );
|
||||||
for( i=0; i<m_BackgroundChanges.GetSize(); i++ )
|
for( i=0; i<m_BackgroundChanges.size(); i++ )
|
||||||
{
|
{
|
||||||
BackgroundChange &seg = m_BackgroundChanges[i];
|
BackgroundChange &seg = m_BackgroundChanges[i];
|
||||||
|
|
||||||
fprintf( fp, "%.3f=%s", seg.m_fStartBeat, seg.m_sBGName.GetString() );
|
fprintf( fp, "%.3f=%s", seg.m_fStartBeat, seg.m_sBGName.GetString() );
|
||||||
if( i != m_BackgroundChanges.GetSize()-1 )
|
if( i != m_BackgroundChanges.size()-1 )
|
||||||
fprintf( fp, "," );
|
fprintf( fp, "," );
|
||||||
}
|
}
|
||||||
fprintf( fp, ";\n" );
|
fprintf( fp, ";\n" );
|
||||||
@@ -717,7 +717,7 @@ void Song::SaveToSMFile( CString sPath, bool bSavingCache )
|
|||||||
//
|
//
|
||||||
// Save all Notes for this file
|
// Save all Notes for this file
|
||||||
//
|
//
|
||||||
for( i=0; i<m_apNotes.GetSize(); i++ )
|
for( i=0; i<m_apNotes.size(); i++ )
|
||||||
{
|
{
|
||||||
Notes* pNotes = m_apNotes[i];
|
Notes* pNotes = m_apNotes[i];
|
||||||
if( bSavingCache || pNotes->m_sDescription.Find("(autogen)") == -1 ) // If notes aren't autogen
|
if( bSavingCache || pNotes->m_sDescription.Find("(autogen)") == -1 ) // If notes aren't autogen
|
||||||
@@ -752,7 +752,7 @@ void Song::AddAutoGenNotes()
|
|||||||
// if( !SongHasNotesType(NOTES_TYPE_PUMP_SINGLE) ) aMissingNotesTypes.Add( NOTES_TYPE_PUMP_SINGLE );
|
// if( !SongHasNotesType(NOTES_TYPE_PUMP_SINGLE) ) aMissingNotesTypes.Add( NOTES_TYPE_PUMP_SINGLE );
|
||||||
// if( !SongHasNotesType(NOTES_TYPE_PUMP_DOUBLE) ) aMissingNotesTypes.Add( NOTES_TYPE_PUMP_DOUBLE );
|
// if( !SongHasNotesType(NOTES_TYPE_PUMP_DOUBLE) ) aMissingNotesTypes.Add( NOTES_TYPE_PUMP_DOUBLE );
|
||||||
//
|
//
|
||||||
// for( int i=0; i<aMissingNotesTypes.GetSize(); i++ )
|
// for( unsigned i=0; i<aMissingNotesTypes.size(); i++ )
|
||||||
// {
|
// {
|
||||||
// NotesType ntMissing = aMissingNotesTypes[i];
|
// NotesType ntMissing = aMissingNotesTypes[i];
|
||||||
|
|
||||||
@@ -767,10 +767,10 @@ next_notes_type:
|
|||||||
// missing Notes of this type
|
// missing Notes of this type
|
||||||
int iNumTracksOfMissing = GAMEMAN->NotesTypeToNumTracks(ntMissing);
|
int iNumTracksOfMissing = GAMEMAN->NotesTypeToNumTracks(ntMissing);
|
||||||
|
|
||||||
int j;
|
unsigned j;
|
||||||
|
|
||||||
// look for an exact match that was created by autogen
|
// look for an exact match that was created by autogen
|
||||||
for( j=0; j<m_apNotes.GetSize(); j++ )
|
for( j=0; j<m_apNotes.size(); j++ )
|
||||||
{
|
{
|
||||||
Notes* pOriginalNotes = m_apNotes[j];
|
Notes* pOriginalNotes = m_apNotes[j];
|
||||||
if( iNumTracksOfMissing != GAMEMAN->NotesTypeToNumTracks(pOriginalNotes->m_NotesType) )
|
if( iNumTracksOfMissing != GAMEMAN->NotesTypeToNumTracks(pOriginalNotes->m_NotesType) )
|
||||||
@@ -797,7 +797,7 @@ next_notes_type:
|
|||||||
int iTrackDifference = abs(iNumTracks-iNumTracksOfMissing);
|
int iTrackDifference = abs(iNumTracks-iNumTracksOfMissing);
|
||||||
CArray<Notes*,Notes*> apNotes;
|
CArray<Notes*,Notes*> apNotes;
|
||||||
this->GetNotesThatMatch( nt, apNotes );
|
this->GetNotesThatMatch( nt, apNotes );
|
||||||
if( iTrackDifference<iBestTrackDifference && apNotes.GetSize() > 0 && apNotes[0]->m_sDescription.Find("autogen")==-1 )
|
if( iTrackDifference < iBestTrackDifference && !apNotes.empty() && apNotes[0]->m_sDescription.Find("autogen")==-1 )
|
||||||
{
|
{
|
||||||
ntBestMatch = nt;
|
ntBestMatch = nt;
|
||||||
iBestTrackDifference = iTrackDifference;
|
iBestTrackDifference = iTrackDifference;
|
||||||
@@ -807,7 +807,7 @@ next_notes_type:
|
|||||||
if( ntBestMatch == -1 )
|
if( ntBestMatch == -1 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for( j=0; j<m_apNotes.GetSize(); j++ )
|
for( j=0; j<m_apNotes.size(); j++ )
|
||||||
{
|
{
|
||||||
Notes* pOriginalNotes = m_apNotes[j];
|
Notes* pOriginalNotes = m_apNotes[j];
|
||||||
if( pOriginalNotes->m_NotesType != ntBestMatch )
|
if( pOriginalNotes->m_NotesType != ntBestMatch )
|
||||||
@@ -839,7 +839,7 @@ Grade Song::GetGradeForDifficulty( const StyleDef *st, int p, Difficulty dc ) co
|
|||||||
|
|
||||||
Grade grade = GRADE_NO_DATA;
|
Grade grade = GRADE_NO_DATA;
|
||||||
|
|
||||||
for( int i=0; i<aNotes.GetSize(); i++ )
|
for( unsigned i=0; i<aNotes.size(); i++ )
|
||||||
{
|
{
|
||||||
const Notes* pNotes = aNotes[i];
|
const Notes* pNotes = aNotes[i];
|
||||||
if( pNotes->m_Difficulty == dc )
|
if( pNotes->m_Difficulty == dc )
|
||||||
@@ -856,7 +856,7 @@ bool Song::IsNew() const
|
|||||||
|
|
||||||
bool Song::IsEasy( NotesType nt ) const
|
bool Song::IsEasy( NotesType nt ) const
|
||||||
{
|
{
|
||||||
for( int i=0; i<m_apNotes.GetSize(); i++ )
|
for( unsigned i=0; i<m_apNotes.size(); i++ )
|
||||||
{
|
{
|
||||||
Notes* pNotes = m_apNotes[i];
|
Notes* pNotes = m_apNotes[i];
|
||||||
if( pNotes->m_NotesType != nt )
|
if( pNotes->m_NotesType != nt )
|
||||||
@@ -902,10 +902,10 @@ int CompareSongPointersByDifficulty(const Song *pSong1, const Song *pSong2)
|
|||||||
int iEasiestMeter1 = 1000; // infinity
|
int iEasiestMeter1 = 1000; // infinity
|
||||||
int iEasiestMeter2 = 1000; // infinity
|
int iEasiestMeter2 = 1000; // infinity
|
||||||
|
|
||||||
int i;
|
unsigned i;
|
||||||
for( i=0; i<aNotes1.GetSize(); i++ )
|
for( i=0; i<aNotes1.size(); i++ )
|
||||||
iEasiestMeter1 = min( iEasiestMeter1, aNotes1[i]->m_iMeter );
|
iEasiestMeter1 = min( iEasiestMeter1, aNotes1[i]->m_iMeter );
|
||||||
for( i=0; i<aNotes2.GetSize(); i++ )
|
for( i=0; i<aNotes2.size(); i++ )
|
||||||
iEasiestMeter2 = min( iEasiestMeter2, aNotes2[i]->m_iMeter );
|
iEasiestMeter2 = min( iEasiestMeter2, aNotes2[i]->m_iMeter );
|
||||||
|
|
||||||
if( iEasiestMeter1 < iEasiestMeter2 )
|
if( iEasiestMeter1 < iEasiestMeter2 )
|
||||||
@@ -1005,16 +1005,16 @@ bool Song::RouletteDisplayed() const
|
|||||||
return m_SelectionDisplay != SHOW_NEVER;
|
return m_SelectionDisplay != SHOW_NEVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Song::HasMusic() const {return m_sMusicFile != "" && IsAFile(GetMusicPath()); };
|
bool Song::HasMusic() const {return m_sMusicFile != "" && IsAFile(GetMusicPath()); }
|
||||||
bool Song::HasBanner() const {return m_sBannerFile != "" && IsAFile(GetBannerPath()); };
|
bool Song::HasBanner() const {return m_sBannerFile != "" && IsAFile(GetBannerPath()); }
|
||||||
bool Song::HasBackground() const {return m_sBackgroundFile != "" && IsAFile(GetBackgroundPath()); };
|
bool Song::HasBackground() const {return m_sBackgroundFile != "" && IsAFile(GetBackgroundPath()); }
|
||||||
bool Song::HasCDTitle() const {return m_sCDTitleFile != "" && IsAFile(GetCDTitlePath()); };
|
bool Song::HasCDTitle() const {return m_sCDTitleFile != "" && IsAFile(GetCDTitlePath()); }
|
||||||
bool Song::HasBGChanges() const {return m_BackgroundChanges.GetSize() > 0; };
|
bool Song::HasBGChanges() const {return !m_BackgroundChanges.empty(); }
|
||||||
|
|
||||||
int Song::GetNumTimesPlayed() const
|
int Song::GetNumTimesPlayed() const
|
||||||
{
|
{
|
||||||
int iTotalNumTimesPlayed = 0;
|
int iTotalNumTimesPlayed = 0;
|
||||||
for( int i=0; i<m_apNotes.GetSize(); i++ )
|
for( unsigned i=0; i<m_apNotes.size(); i++ )
|
||||||
{
|
{
|
||||||
iTotalNumTimesPlayed += m_apNotes[i]->m_iNumTimesPlayed;
|
iTotalNumTimesPlayed += m_apNotes[i]->m_iNumTimesPlayed;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user