some more s/GetSize/size/ and other minor STLisms
This commit is contained in:
@@ -52,7 +52,7 @@ bool KSFLoader::LoadFromKSFFile( const CString &sPath, Notes &out )
|
|||||||
for( int t=0; t<13; t++ )
|
for( int t=0; t<13; t++ )
|
||||||
iHoldStartRow[t] = -1;
|
iHoldStartRow[t] = -1;
|
||||||
|
|
||||||
for( int r=0; r<asRows.GetSize(); r++ )
|
for( unsigned r=0; r<asRows.size(); r++ )
|
||||||
{
|
{
|
||||||
CString& sRowString = asRows[r];
|
CString& sRowString = asRows[r];
|
||||||
|
|
||||||
@@ -151,11 +151,11 @@ bool KSFLoader::LoadFromDir( CString sDir, Song &out )
|
|||||||
CStringArray arrayKSFFileNames;
|
CStringArray arrayKSFFileNames;
|
||||||
GetDirListing( sDir + CString("*.ksf"), arrayKSFFileNames );
|
GetDirListing( sDir + CString("*.ksf"), arrayKSFFileNames );
|
||||||
|
|
||||||
if( arrayKSFFileNames.GetSize() == 0 )
|
if( arrayKSFFileNames.empty() )
|
||||||
throw RageException( "Couldn't find any KSF files in '%s'", sDir.GetString() );
|
throw RageException( "Couldn't find any KSF files in '%s'", sDir.GetString() );
|
||||||
|
|
||||||
// load the Notes from the rest of the KSF files
|
// load the Notes from the rest of the KSF files
|
||||||
for( int i=0; i<arrayKSFFileNames.GetSize(); i++ )
|
for( unsigned i=0; i<arrayKSFFileNames.size(); i++ )
|
||||||
{
|
{
|
||||||
Notes* pNewNotes = new Notes;
|
Notes* pNewNotes = new Notes;
|
||||||
LoadFromKSFFile( out.m_sSongDir + arrayKSFFileNames[i], *pNewNotes );
|
LoadFromKSFFile( out.m_sSongDir + arrayKSFFileNames[i], *pNewNotes );
|
||||||
@@ -169,7 +169,8 @@ bool KSFLoader::LoadFromDir( CString sDir, Song &out )
|
|||||||
if( !bResult )
|
if( !bResult )
|
||||||
throw RageException( "Error opening file '%s'.", sPath.GetString() );
|
throw RageException( "Error opening file '%s'.", sPath.GetString() );
|
||||||
|
|
||||||
for( i=0; i<msd.m_iNumValues; i++ )
|
// XXX msd::iNumValues should be unsigned
|
||||||
|
for( i=0; i<unsigned(msd.m_iNumValues); i++ )
|
||||||
{
|
{
|
||||||
CString* sParams = msd.m_sParams[i];
|
CString* sParams = msd.m_sParams[i];
|
||||||
CString sValueName = sParams[0];
|
CString sValueName = sParams[0];
|
||||||
@@ -183,7 +184,7 @@ bool KSFLoader::LoadFromDir( CString sDir, Song &out )
|
|||||||
|
|
||||||
/* It's often "artist - songtitle - difficulty". Ignore
|
/* It's often "artist - songtitle - difficulty". Ignore
|
||||||
* the difficulty, since we get that from the filename. */
|
* the difficulty, since we get that from the filename. */
|
||||||
if( asBits.GetSize() == 3 &&
|
if( asBits.size() == 3 &&
|
||||||
(!stricmp(asBits[2], "double") ||
|
(!stricmp(asBits[2], "double") ||
|
||||||
!stricmp(asBits[2], "easy") ||
|
!stricmp(asBits[2], "easy") ||
|
||||||
!stricmp(asBits[2], "normal") ||
|
!stricmp(asBits[2], "normal") ||
|
||||||
@@ -193,7 +194,7 @@ bool KSFLoader::LoadFromDir( CString sDir, Song &out )
|
|||||||
asBits.RemoveAt(2);
|
asBits.RemoveAt(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( asBits.GetSize() == 2 )
|
if( asBits.size() == 2 )
|
||||||
{
|
{
|
||||||
out.m_sArtist = asBits[0];
|
out.m_sArtist = asBits[0];
|
||||||
out.m_sMainTitle = asBits[1];
|
out.m_sMainTitle = asBits[1];
|
||||||
@@ -210,11 +211,11 @@ bool KSFLoader::LoadFromDir( CString sDir, Song &out )
|
|||||||
{
|
{
|
||||||
CStringArray asBits;
|
CStringArray asBits;
|
||||||
split( sDir, "\\", asBits, true);
|
split( sDir, "\\", asBits, true);
|
||||||
CString sSongFolderName = asBits[ asBits.GetSize()-1 ];
|
CString sSongFolderName = asBits[ asBits.size()-1 ];
|
||||||
asBits.clear();
|
asBits.clear();
|
||||||
|
|
||||||
split( sSongFolderName, " - ", asBits, false );
|
split( sSongFolderName, " - ", asBits, false );
|
||||||
if( asBits.GetSize() == 2 )
|
if( asBits.size() == 2 )
|
||||||
{
|
{
|
||||||
out.m_sArtist = asBits[0];
|
out.m_sArtist = asBits[0];
|
||||||
out.m_sMainTitle = asBits[1];
|
out.m_sMainTitle = asBits[1];
|
||||||
@@ -247,7 +248,7 @@ bool KSFLoader::LoadFromDir( CString sDir, Song &out )
|
|||||||
GetDirListing( out.m_sSongDir + CString("song.ogg"), arrayPossibleMusic );
|
GetDirListing( out.m_sSongDir + CString("song.ogg"), arrayPossibleMusic );
|
||||||
GetDirListing( out.m_sSongDir + CString("song.wav"), arrayPossibleMusic );
|
GetDirListing( out.m_sSongDir + CString("song.wav"), arrayPossibleMusic );
|
||||||
|
|
||||||
if( arrayPossibleMusic.GetSize() > 0 ) // we found a match
|
if( !arrayPossibleMusic.empty() ) // we found a match
|
||||||
out.m_sMusicFile = arrayPossibleMusic[0];
|
out.m_sMusicFile = arrayPossibleMusic[0];
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ ScreenSelectGroup::ScreenSelectGroup()
|
|||||||
LOG->Trace( "ScreenSelectGroup::ScreenSelectGroup()" );
|
LOG->Trace( "ScreenSelectGroup::ScreenSelectGroup()" );
|
||||||
|
|
||||||
|
|
||||||
int i;
|
unsigned i;
|
||||||
|
int j;
|
||||||
|
|
||||||
// The new process by which the group and song lists are formed
|
// The new process by which the group and song lists are formed
|
||||||
// is bizarre and complex but yields the end result that songs
|
// is bizarre and complex but yields the end result that songs
|
||||||
@@ -69,23 +69,23 @@ ScreenSelectGroup::ScreenSelectGroup()
|
|||||||
CArray<Song*, Song*> aAllSongs = SONGMAN->m_pSongs;
|
CArray<Song*, Song*> aAllSongs = SONGMAN->m_pSongs;
|
||||||
|
|
||||||
// Filter out Songs that can't be played by the current Style
|
// Filter out Songs that can't be played by the current Style
|
||||||
for( i=aAllSongs.GetSize()-1; i>=0; i-- ) // foreach Song, back to front
|
for( j=aAllSongs.size()-1; j>=0; j-- ) // foreach Song, back to front
|
||||||
{
|
{
|
||||||
if( aAllSongs[i]->SongCompleteForStyle(GAMESTATE->GetCurrentStyleDef()) &&
|
if( aAllSongs[j]->SongCompleteForStyle(GAMESTATE->GetCurrentStyleDef()) &&
|
||||||
aAllSongs[i]->NormallyDisplayed() )
|
aAllSongs[j]->NormallyDisplayed() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
aAllSongs.RemoveAt( i );
|
aAllSongs.RemoveAt( j );
|
||||||
}
|
}
|
||||||
|
|
||||||
CStringArray asGroupNames;
|
CStringArray asGroupNames;
|
||||||
for( i=0; i<aAllSongs.GetSize(); i++ ) {
|
for( i=0; i<aAllSongs.size(); i++ ) {
|
||||||
asGroupNames.Add( aAllSongs[i]->m_sGroupName );
|
asGroupNames.Add( aAllSongs[i]->m_sGroupName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove duplicate groups. */
|
/* Remove duplicate groups. */
|
||||||
SortCStringArray(asGroupNames, true);
|
SortCStringArray(asGroupNames, true);
|
||||||
for( i=asGroupNames.GetSize()-1; i > 0; --i ) {
|
for( i=asGroupNames.size()-1; i > 0; --i ) {
|
||||||
if( asGroupNames[i] == asGroupNames[i-1] )
|
if( asGroupNames[i] == asGroupNames[i-1] )
|
||||||
asGroupNames.RemoveAt( i );
|
asGroupNames.RemoveAt( i );
|
||||||
}
|
}
|
||||||
@@ -93,11 +93,11 @@ ScreenSelectGroup::ScreenSelectGroup()
|
|||||||
asGroupNames.insert(asGroupNames.begin(), "ALL MUSIC" );
|
asGroupNames.insert(asGroupNames.begin(), "ALL MUSIC" );
|
||||||
|
|
||||||
// Add songs to the MusicList.
|
// Add songs to the MusicList.
|
||||||
for( int j=0; j < asGroupNames.GetSize(); j++ ) /* for each group */
|
for( unsigned j=0; j < asGroupNames.size(); j++ ) /* for each group */
|
||||||
{
|
{
|
||||||
CArray<Song*,Song*> aSongsInGroup;
|
CArray<Song*,Song*> aSongsInGroup;
|
||||||
/* find all songs */
|
/* find all songs */
|
||||||
for( i=0; i<aAllSongs.GetSize(); i++ ) // foreach Song
|
for( i=0; i<aAllSongs.size(); i++ ) // foreach Song
|
||||||
{
|
{
|
||||||
/* group 0 gets all songs */
|
/* group 0 gets all songs */
|
||||||
if( j != 0 && aAllSongs[i]->m_sGroupName != asGroupNames[j] )
|
if( j != 0 && aAllSongs[i]->m_sGroupName != asGroupNames[j] )
|
||||||
@@ -146,7 +146,7 @@ ScreenSelectGroup::ScreenSelectGroup()
|
|||||||
|
|
||||||
this->AddChild( &m_MusicList );
|
this->AddChild( &m_MusicList );
|
||||||
|
|
||||||
for( i=0; i < asGroupNames.GetSize(); ++i )
|
for( i=0; i < asGroupNames.size(); ++i )
|
||||||
m_GroupList.AddGroup( asGroupNames[i] );
|
m_GroupList.AddGroup( asGroupNames[i] );
|
||||||
m_GroupList.DoneAddingGroups();
|
m_GroupList.DoneAddingGroups();
|
||||||
this->AddChild( &m_GroupList );
|
this->AddChild( &m_GroupList );
|
||||||
|
|||||||
@@ -89,26 +89,26 @@ SongSelector::SongSelector()
|
|||||||
|
|
||||||
if( GAMESTATE->m_pCurSong )
|
if( GAMESTATE->m_pCurSong )
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
for( i=0; i<m_sGroups.GetSize(); i++ )
|
for( i=0; i<m_sGroups.size(); i++ )
|
||||||
if( GAMESTATE->m_pCurSong->m_sGroupName == m_sGroups[i] )
|
if( GAMESTATE->m_pCurSong->m_sGroupName == m_sGroups[i] )
|
||||||
m_iSelectedGroup = i;
|
m_iSelectedGroup = i;
|
||||||
OnGroupChange();
|
OnGroupChange();
|
||||||
|
|
||||||
for( i=0; i<m_pSongs.GetSize(); i++ )
|
for( i=0; i<m_pSongs.size(); i++ )
|
||||||
if( GAMESTATE->m_pCurSong == m_pSongs[i] )
|
if( GAMESTATE->m_pCurSong == m_pSongs[i] )
|
||||||
m_iSelectedSong = i;
|
m_iSelectedSong = i;
|
||||||
OnSongChange();
|
OnSongChange();
|
||||||
|
|
||||||
for( i=0; i<m_Styles.GetSize(); i++ )
|
for( i=0; i<m_Styles.size(); i++ )
|
||||||
{
|
{
|
||||||
if( GAMESTATE->GetCurrentStyleDef() == GAMEMAN->GetStyleDefForStyle(m_Styles[i]) )
|
if( GAMESTATE->GetCurrentStyleDef() == GAMEMAN->GetStyleDefForStyle(m_Styles[i]) )
|
||||||
m_iSelectedStyle = i;
|
m_iSelectedStyle = i;
|
||||||
}
|
}
|
||||||
OnNotesTypeChange();
|
OnNotesTypeChange();
|
||||||
|
|
||||||
for( i=0; i<m_pNotess.GetSize(); i++ )
|
for( i=0; i<m_pNotess.size(); i++ )
|
||||||
if( GAMESTATE->m_pCurNotes[PLAYER_1] == m_pNotess[i] )
|
if( GAMESTATE->m_pCurNotes[PLAYER_1] == m_pNotess[i] )
|
||||||
m_iSelectedNotes = i;
|
m_iSelectedNotes = i;
|
||||||
OnNotesChange();
|
OnNotesChange();
|
||||||
@@ -184,25 +184,25 @@ void SongSelector::Right()
|
|||||||
switch( m_SelectedRow )
|
switch( m_SelectedRow )
|
||||||
{
|
{
|
||||||
case ROW_GROUP:
|
case ROW_GROUP:
|
||||||
if( m_iSelectedGroup == m_sGroups.GetSize()-1 ) // can't go right any further
|
if( m_iSelectedGroup == m_sGroups.size()-1 ) // can't go right any further
|
||||||
return;
|
return;
|
||||||
m_iSelectedGroup++;
|
m_iSelectedGroup++;
|
||||||
OnGroupChange();
|
OnGroupChange();
|
||||||
break;
|
break;
|
||||||
case ROW_SONG:
|
case ROW_SONG:
|
||||||
if( m_iSelectedSong == m_pSongs.GetSize()-1 ) // can't go right any further
|
if( m_iSelectedSong == m_pSongs.size()-1 ) // can't go right any further
|
||||||
return;
|
return;
|
||||||
m_iSelectedSong++;
|
m_iSelectedSong++;
|
||||||
OnSongChange();
|
OnSongChange();
|
||||||
break;
|
break;
|
||||||
case ROW_STYLE:
|
case ROW_STYLE:
|
||||||
if( m_iSelectedStyle == m_Styles.GetSize()-1 ) // can't go right any further
|
if( m_iSelectedStyle == m_Styles.size()-1 ) // can't go right any further
|
||||||
return;
|
return;
|
||||||
m_iSelectedStyle++;
|
m_iSelectedStyle++;
|
||||||
OnNotesTypeChange();
|
OnNotesTypeChange();
|
||||||
break;
|
break;
|
||||||
case ROW_STEPS:
|
case ROW_STEPS:
|
||||||
if( m_iSelectedNotes == m_pNotess.GetSize()-1 ) // can't go right any further
|
if( m_iSelectedNotes == m_pNotess.size()-1 ) // can't go right any further
|
||||||
return;
|
return;
|
||||||
m_iSelectedNotes++;
|
m_iSelectedNotes++;
|
||||||
OnNotesChange();
|
OnNotesChange();
|
||||||
@@ -237,7 +237,7 @@ void SongSelector::ChangeSelectedRow( SelectedRow row )
|
|||||||
|
|
||||||
void SongSelector::OnGroupChange()
|
void SongSelector::OnGroupChange()
|
||||||
{
|
{
|
||||||
m_iSelectedGroup = clamp( m_iSelectedGroup, 0, m_sGroups.GetSize()-1 );
|
m_iSelectedGroup = clamp( m_iSelectedGroup, 0u, m_sGroups.size()-1 );
|
||||||
|
|
||||||
m_textGroup.SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) );
|
m_textGroup.SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) );
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ void SongSelector::OnGroupChange()
|
|||||||
|
|
||||||
void SongSelector::OnSongChange()
|
void SongSelector::OnSongChange()
|
||||||
{
|
{
|
||||||
m_iSelectedSong = clamp( m_iSelectedSong, 0, m_pSongs.GetSize()-1 );
|
m_iSelectedSong = clamp( m_iSelectedSong, 0u, m_pSongs.size()-1 );
|
||||||
|
|
||||||
m_Banner.LoadFromSong( GetSelectedSong() );
|
m_Banner.LoadFromSong( GetSelectedSong() );
|
||||||
m_TextBanner.LoadFromSong( GetSelectedSong() );
|
m_TextBanner.LoadFromSong( GetSelectedSong() );
|
||||||
@@ -260,7 +260,7 @@ void SongSelector::OnSongChange()
|
|||||||
|
|
||||||
void SongSelector::OnNotesTypeChange()
|
void SongSelector::OnNotesTypeChange()
|
||||||
{
|
{
|
||||||
m_iSelectedStyle = clamp( m_iSelectedStyle, 0, m_Styles.GetSize()-1 );
|
m_iSelectedStyle = clamp( m_iSelectedStyle, 0u, m_Styles.size()-1 );
|
||||||
|
|
||||||
m_textStyle.SetText( GAMEMAN->GetStyleDefForStyle(GetSelectedStyle())->m_szName );
|
m_textStyle.SetText( GAMEMAN->GetStyleDefForStyle(GetSelectedStyle())->m_szName );
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ void SongSelector::OnNotesTypeChange()
|
|||||||
|
|
||||||
void SongSelector::OnNotesChange()
|
void SongSelector::OnNotesChange()
|
||||||
{
|
{
|
||||||
m_iSelectedNotes = clamp( m_iSelectedNotes, 0, m_pNotess.GetSize()-1 );
|
m_iSelectedNotes = clamp( m_iSelectedNotes, 0u, m_pNotess.size()-1 );
|
||||||
|
|
||||||
if( GetSelectedNotes() == NULL )
|
if( GetSelectedNotes() == NULL )
|
||||||
m_textNotes.SetText( "(NEW)" );
|
m_textNotes.SetText( "(NEW)" );
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ private:
|
|||||||
SelectedRow m_SelectedRow;
|
SelectedRow m_SelectedRow;
|
||||||
|
|
||||||
CStringArray m_sGroups;
|
CStringArray m_sGroups;
|
||||||
int m_iSelectedGroup; // index into m_sGroups
|
unsigned m_iSelectedGroup; // index into m_sGroups
|
||||||
BitmapText m_textGroup;
|
BitmapText m_textGroup;
|
||||||
|
|
||||||
CArray<Song*, Song*> m_pSongs;
|
CArray<Song*, Song*> m_pSongs;
|
||||||
int m_iSelectedSong; // index into m_pSongs
|
unsigned m_iSelectedSong; // index into m_pSongs
|
||||||
Banner m_Banner;
|
Banner m_Banner;
|
||||||
TextBanner m_TextBanner;
|
TextBanner m_TextBanner;
|
||||||
|
|
||||||
@@ -56,11 +56,11 @@ private:
|
|||||||
Sprite m_sprArrowRight;
|
Sprite m_sprArrowRight;
|
||||||
|
|
||||||
CArray<Style, Style> m_Styles;
|
CArray<Style, Style> m_Styles;
|
||||||
int m_iSelectedStyle; // index into m_Styles
|
unsigned m_iSelectedStyle; // index into m_Styles
|
||||||
BitmapText m_textStyle;
|
BitmapText m_textStyle;
|
||||||
|
|
||||||
CArray<Notes*, Notes*> m_pNotess;
|
CArray<Notes*, Notes*> m_pNotess;
|
||||||
int m_iSelectedNotes; // index into m_pNotess
|
unsigned m_iSelectedNotes; // index into m_pNotess
|
||||||
BitmapText m_textNotes;
|
BitmapText m_textNotes;
|
||||||
|
|
||||||
RandomSample m_soundChangeMusic;
|
RandomSample m_soundChangeMusic;
|
||||||
|
|||||||
Reference in New Issue
Block a user