some more s/GetSize/size/ and other minor STLisms

This commit is contained in:
Glenn Maynard
2002-10-31 02:54:49 +00:00
parent 2b16872bd5
commit 945a39a247
11 changed files with 65 additions and 65 deletions
+7 -7
View File
@@ -30,7 +30,7 @@ BGAnimation::~BGAnimation()
void BGAnimation::Unload() void BGAnimation::Unload()
{ {
for( int i=0; i<m_Layers.GetSize(); i++ ) for( unsigned i=0; i<m_Layers.size(); i++ )
delete m_Layers[i]; delete m_Layers[i];
m_Layers.clear(); m_Layers.clear();
} }
@@ -64,7 +64,7 @@ void BGAnimation::LoadFromAniDir( CString sAniDir, CString sSongBGPath )
SortCStringArray( asImagePaths ); SortCStringArray( asImagePaths );
for( int i=0; i<asImagePaths.GetSize(); i++ ) for( unsigned i=0; i<asImagePaths.size(); i++ )
{ {
const CString sPath = asImagePaths[i]; const CString sPath = asImagePaths[i];
CString sDir, sFName, sExt; CString sDir, sFName, sExt;
@@ -109,19 +109,19 @@ void BGAnimation::LoadFromVisualization( CString sVisPath, CString sSongBGPath )
void BGAnimation::Update( float fDeltaTime ) void BGAnimation::Update( float fDeltaTime )
{ {
for( int i=0; i<m_Layers.GetSize(); i++ ) for( unsigned i=0; i<m_Layers.size(); i++ )
m_Layers[i]->Update( fDeltaTime ); m_Layers[i]->Update( fDeltaTime );
} }
void BGAnimation::DrawPrimitives() void BGAnimation::DrawPrimitives()
{ {
for( int i=0; i<m_Layers.GetSize(); i++ ) for( unsigned i=0; i<m_Layers.size(); i++ )
m_Layers[i]->Draw(); m_Layers[i]->Draw();
} }
void BGAnimation::GainingFocus() void BGAnimation::GainingFocus()
{ {
for( int i=0; i<m_Layers.GetSize(); i++ ) for( unsigned i=0; i<m_Layers.size(); i++ )
m_Layers[i]->GainingFocus(); m_Layers[i]->GainingFocus();
SetDiffuse( RageColor(1,1,1,1) ); SetDiffuse( RageColor(1,1,1,1) );
@@ -129,12 +129,12 @@ void BGAnimation::GainingFocus()
void BGAnimation::LosingFocus() void BGAnimation::LosingFocus()
{ {
for( int i=0; i<m_Layers.GetSize(); i++ ) for( unsigned i=0; i<m_Layers.size(); i++ )
m_Layers[i]->LosingFocus(); m_Layers[i]->LosingFocus();
} }
void BGAnimation::SetDiffuse( const RageColor &c ) void BGAnimation::SetDiffuse( const RageColor &c )
{ {
for( int i=0; i<m_Layers.GetSize(); i++ ) for( unsigned i=0; i<m_Layers.size(); i++ )
m_Layers[i]->SetDiffuse(c); m_Layers[i]->SetDiffuse(c);
} }
+7 -7
View File
@@ -37,22 +37,22 @@ void MusicList::AddGroup()
void MusicList::AddSongsToGroup(const CArray<Song*,Song*> &Songs) void MusicList::AddSongsToGroup(const CArray<Song*,Song*> &Songs)
{ {
// Generate what text will show in the contents for each group // Generate what text will show in the contents for each group
int group = m_ContentsText.GetSize()-1; unsigned group = m_ContentsText.size()-1;
m_ContentsText[group].m_iNumSongsInGroup = Songs.GetSize(); m_ContentsText[group].m_iNumSongsInGroup = Songs.size();
for( int c=0; c<TITLES_COLUMNS; c++ ) // foreach col for( int c=0; c<TITLES_COLUMNS; c++ ) // foreach col
{ {
CString sText; CString sText;
for( int r=0; r<TITLES_ROWS; r++ ) // foreach row for( int r=0; r<TITLES_ROWS; r++ ) // foreach row
{ {
int iIndex = c*TITLES_ROWS + r; unsigned iIndex = c*TITLES_ROWS + r;
if( iIndex >= Songs.GetSize() ) if( iIndex >= Songs.size() )
continue; continue;
if( c == TITLES_COLUMNS-1 && r == TITLES_ROWS-1 && Songs.GetSize() != TITLES_COLUMNS*TITLES_ROWS ) if( c == TITLES_COLUMNS-1 && r == TITLES_ROWS-1 && Songs.size() != unsigned(TITLES_COLUMNS*TITLES_ROWS) )
{ {
sText += ssprintf( "%d more.....", Songs.GetSize() - TITLES_COLUMNS * TITLES_ROWS + 1 ); sText += ssprintf( "%d more.....", Songs.size() - TITLES_COLUMNS * TITLES_ROWS + 1 );
continue; continue;
} }
@@ -65,7 +65,7 @@ void MusicList::AddSongsToGroup(const CArray<Song*,Song*> &Songs)
} }
sText += sTitle + "\n"; sText += sTitle + "\n";
} }
m_ContentsText[m_ContentsText.GetSize()-1].ContentsText[c] = sText; m_ContentsText[m_ContentsText.size()-1].ContentsText[c] = sText;
} }
} }
+9 -9
View File
@@ -74,7 +74,7 @@ void NoteData::LoadFromSMNoteDataString( CString sSMNoteData )
CStringArray asMeasures; CStringArray asMeasures;
split( sSMNoteData, ",", asMeasures, true ); // ignore empty is important split( sSMNoteData, ",", asMeasures, true ); // ignore empty is important
for( int m=0; m<asMeasures.GetSize(); m++ ) // foreach measure for( unsigned m=0; m<asMeasures.size(); m++ ) // foreach measure
{ {
CString &sMeasureString = asMeasures[m]; CString &sMeasureString = asMeasures[m];
sMeasureString.TrimLeft(); sMeasureString.TrimLeft();
@@ -83,19 +83,19 @@ void NoteData::LoadFromSMNoteDataString( CString sSMNoteData )
CStringArray asMeasureLines; CStringArray asMeasureLines;
split( sMeasureString, "\n", asMeasureLines, true ); // ignore empty is important split( sMeasureString, "\n", asMeasureLines, true ); // ignore empty is important
//ASSERT( asMeasureLines.GetSize() == 4 || //ASSERT( asMeasureLines.size() == 4 ||
// asMeasureLines.GetSize() == 8 || // asMeasureLines.size() == 8 ||
// asMeasureLines.GetSize() == 12 || // asMeasureLines.size() == 12 ||
// asMeasureLines.GetSize() == 16 ); // asMeasureLines.size() == 16 );
for( int l=0; l<asMeasureLines.GetSize(); l++ ) for( unsigned l=0; l<asMeasureLines.size(); l++ )
{ {
CString &sMeasureLine = asMeasureLines[l]; CString &sMeasureLine = asMeasureLines[l];
sMeasureLine.TrimLeft(); sMeasureLine.TrimLeft();
sMeasureLine.TrimRight(); sMeasureLine.TrimRight();
const float fPercentIntoMeasure = l/(float)asMeasureLines.GetSize(); const float fPercentIntoMeasure = l/(float)asMeasureLines.size();
const float fBeat = (m + fPercentIntoMeasure) * BEATS_PER_MEASURE; const float fBeat = (m + fPercentIntoMeasure) * BEATS_PER_MEASURE;
const int iIndex = BeatToNoteRow( fBeat ); const int iIndex = BeatToNoteRow( fBeat );
@@ -571,7 +571,7 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
for( t=0; t<m_iNumTracks; t++ ) for( t=0; t<m_iNumTracks; t++ )
{ {
int iRandTrackIndex = rand()%aiTracksLeftToMap.GetSize(); int iRandTrackIndex = rand()%aiTracksLeftToMap.size();
int iRandTrack = aiTracksLeftToMap[iRandTrackIndex]; int iRandTrack = aiTracksLeftToMap[iRandTrackIndex];
aiTracksLeftToMap.RemoveAt( iRandTrackIndex ); aiTracksLeftToMap.RemoveAt( iRandTrackIndex );
iTakeFromTrack[t] = iRandTrack; iTakeFromTrack[t] = iRandTrack;
@@ -632,7 +632,7 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
{ {
if( GetTapNote(t, r) != TAP_HOLD && GetTapNote(t, r) != TAP_EMPTY ) // there is a tap note here (and not a HoldNote) if( GetTapNote(t, r) != TAP_HOLD && GetTapNote(t, r) != TAP_EMPTY ) // there is a tap note here (and not a HoldNote)
{ {
int iRandIndex = rand() % aiTracksThatCouldHaveTapNotes.GetSize(); int iRandIndex = rand() % aiTracksThatCouldHaveTapNotes.size();
int iTo = aiTracksThatCouldHaveTapNotes[ iRandIndex ]; int iTo = aiTracksThatCouldHaveTapNotes[ iRandIndex ];
aiTracksThatCouldHaveTapNotes.RemoveAt( iRandIndex ); aiTracksThatCouldHaveTapNotes.RemoveAt( iRandIndex );
+5 -5
View File
@@ -72,7 +72,7 @@ void NoteDisplay::Load( int iColNum, PlayerNumber pn )
m_colorTapTweens.Add( color ); m_colorTapTweens.Add( color );
} while( bSuccess ); } while( bSuccess );
if( m_colorTapTweens.GetSize() == 0 ) if( m_colorTapTweens.empty() )
m_colorTapTweens.Add( RageColor(1,1,1,1) ); m_colorTapTweens.Add( RageColor(1,1,1,1) );
fclose( fp ); fclose( fp );
@@ -176,17 +176,17 @@ void NoteDisplay::GetTapEdgeColors( const float fNoteBeat, RageColor &colorLeadi
return; return;
} }
float fLeadingColorIndex = fPercentThroughColorsLeading * m_colorTapTweens.GetSize(); float fLeadingColorIndex = fPercentThroughColorsLeading * m_colorTapTweens.size();
float fTrailingColorIndex = fPercentThroughColorsTrailing* m_colorTapTweens.GetSize(); float fTrailingColorIndex = fPercentThroughColorsTrailing* m_colorTapTweens.size();
float fLeadingColorWeightOf2 = fLeadingColorIndex - int(fLeadingColorIndex); float fLeadingColorWeightOf2 = fLeadingColorIndex - int(fLeadingColorIndex);
int iLeadingColor1 = int(fLeadingColorIndex); int iLeadingColor1 = int(fLeadingColorIndex);
int iLeadingColor2 = (iLeadingColor1 + 1) % m_colorTapTweens.GetSize(); int iLeadingColor2 = (iLeadingColor1 + 1) % m_colorTapTweens.size();
colorLeadingOut = m_colorTapTweens[iLeadingColor1] * (1-fLeadingColorWeightOf2) + m_colorTapTweens[iLeadingColor2] * fLeadingColorWeightOf2; colorLeadingOut = m_colorTapTweens[iLeadingColor1] * (1-fLeadingColorWeightOf2) + m_colorTapTweens[iLeadingColor2] * fLeadingColorWeightOf2;
float fTrailingColorWeightOf2 = fTrailingColorIndex - int(fTrailingColorIndex); float fTrailingColorWeightOf2 = fTrailingColorIndex - int(fTrailingColorIndex);
int iTrailingColor1 = int(fTrailingColorIndex); int iTrailingColor1 = int(fTrailingColorIndex);
int iTrailingColor2 = (iTrailingColor1 + 1) % m_colorTapTweens.GetSize(); int iTrailingColor2 = (iTrailingColor1 + 1) % m_colorTapTweens.size();
colorTrailingOut = m_colorTapTweens[iTrailingColor1] * (1-fTrailingColorWeightOf2) + m_colorTapTweens[iTrailingColor2] * fTrailingColorWeightOf2; colorTrailingOut = m_colorTapTweens[iTrailingColor1] * (1-fTrailingColorWeightOf2) + m_colorTapTweens[iTrailingColor2] * fTrailingColorWeightOf2;
} }
+1 -1
View File
@@ -7,7 +7,7 @@ bool NotesLoader::Loadable( CString sPath )
{ {
CStringArray list; CStringArray list;
GetApplicableFiles( sPath, list ); GetApplicableFiles( sPath, list );
return list.GetSize() != 0; return !list.empty();
} }
void NotesLoader::GetMainAndSubTitlesFromFullTitle( const CString sFullTitle, CString &sMainTitleOut, CString &sSubTitleOut ) void NotesLoader::GetMainAndSubTitlesFromFullTitle( const CString sFullTitle, CString &sMainTitleOut, CString &sSubTitleOut )
+9 -9
View File
@@ -161,10 +161,10 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Notes &out )
arrayNotes.Add( bThisIsANote ); arrayNotes.Add( bThisIsANote );
} }
const int iNumNotesInThisMeasure = arrayNotes.GetSize(); const unsigned iNumNotesInThisMeasure = arrayNotes.size();
//LOG->Trace( "%s:%s: iMeasureNo = %d, iNoteNum = %d, iNumNotesInThisMeasure = %d", //LOG->Trace( "%s:%s: iMeasureNo = %d, iNoteNum = %d, iNumNotesInThisMeasure = %d",
// valuename.GetString(), sNoteData.GetString(), iMeasureNo, iNoteNum, iNumNotesInThisMeasure ); // valuename.GetString(), sNoteData.GetString(), iMeasureNo, iNoteNum, iNumNotesInThisMeasure );
for( int j=0; j<iNumNotesInThisMeasure; j++ ) for( unsigned j=0; j<iNumNotesInThisMeasure; j++ )
{ {
if( arrayNotes[j] ) if( arrayNotes[j] )
{ {
@@ -258,11 +258,11 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
CStringArray arrayBMSFileNames; CStringArray arrayBMSFileNames;
GetApplicableFiles( sDir, arrayBMSFileNames ); GetApplicableFiles( sDir, arrayBMSFileNames );
if( arrayBMSFileNames.GetSize() == 0 ) if( arrayBMSFileNames.empty() )
throw RageException( "Couldn't find any BMS files in '%s'", sDir.GetString() ); throw RageException( "Couldn't find any BMS files in '%s'", sDir.GetString() );
// load the Notes from the rest of the BMS files // load the Notes from the rest of the BMS files
for( int i=0; i<arrayBMSFileNames.GetSize(); i++ ) for( unsigned i=0; i<arrayBMSFileNames.size(); i++ )
{ {
Notes* pNewNotes = new Notes; Notes* pNewNotes = new Notes;
@@ -364,10 +364,10 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
arrayNotes.Add( iNote ); arrayNotes.Add( iNote );
} }
const int iNumNotesInThisMeasure = arrayNotes.GetSize(); const unsigned iNumNotesInThisMeasure = arrayNotes.size();
//LOG->Trace( "%s:%s: iMeasureNo = %d, iBMSTrackNo = %d, iNumNotesInThisMeasure = %d", //LOG->Trace( "%s:%s: iMeasureNo = %d, iBMSTrackNo = %d, iNumNotesInThisMeasure = %d",
// valuename.GetString(), sNoteData.GetString(), iMeasureNo, iBMSTrackNo, iNumNotesInThisMeasure ); // valuename.GetString(), sNoteData.GetString(), iMeasureNo, iBMSTrackNo, iNumNotesInThisMeasure );
for( int j=0; j<iNumNotesInThisMeasure; j++ ) for( unsigned j=0; j<iNumNotesInThisMeasure; j++ )
{ {
if( arrayNotes[j] == 0 ) if( arrayNotes[j] == 0 )
continue; continue;
@@ -511,7 +511,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
{ {
// find the BPM at the time of this freeze // find the BPM at the time of this freeze
float fBPM = -1; float fBPM = -1;
for( int i=0; i<out.m_BPMSegments.GetSize()-1; i++ ) for( unsigned i=0; i<out.m_BPMSegments.size()-1; i++ )
{ {
if( out.m_BPMSegments[i].m_fStartBeat <= fFreezeStartBeat && if( out.m_BPMSegments[i].m_fStartBeat <= fFreezeStartBeat &&
out.m_BPMSegments[i+1].m_fStartBeat > fFreezeStartBeat ) out.m_BPMSegments[i+1].m_fStartBeat > fFreezeStartBeat )
@@ -522,7 +522,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
} }
// the BPM segment of this beat is the last BPM segment // the BPM segment of this beat is the last BPM segment
if( fBPM == -1 ) if( fBPM == -1 )
fBPM = out.m_BPMSegments[out.m_BPMSegments.GetSize()-1].m_fBPM; fBPM = out.m_BPMSegments[out.m_BPMSegments.size()-1].m_fBPM;
fFreezeSecs = (float)atof(value_data)/(fBPM*0.81f); // I have no idea what units these are in, so I experimented until finding this factor. fFreezeSecs = (float)atof(value_data)/(fBPM*0.81f); // I have no idea what units these are in, so I experimented until finding this factor.
break; break;
@@ -548,7 +548,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
} }
} }
for( i=0; i<out.m_BPMSegments.GetSize(); i++ ) for( i=0; i<out.m_BPMSegments.size(); i++ )
LOG->Trace( "There is a BPM change at beat %f, BPM %f, index %d", LOG->Trace( "There is a BPM change at beat %f, BPM %f, index %d",
out.m_BPMSegments[i].m_fStartBeat, out.m_BPMSegments[i].m_fBPM, i ); out.m_BPMSegments[i].m_fStartBeat, out.m_BPMSegments[i].m_fBPM, i );
+7 -7
View File
@@ -228,35 +228,35 @@ bool NotesWriterDWI::Write( CString sPath, const Song &out )
fprintf( fp, "#SAMPLESTART:%.3f;\n", out.m_fMusicSampleStartSeconds ); fprintf( fp, "#SAMPLESTART:%.3f;\n", out.m_fMusicSampleStartSeconds );
fprintf( fp, "#SAMPLELENGTH:%.3f;\n", out.m_fMusicSampleLengthSeconds ); fprintf( fp, "#SAMPLELENGTH:%.3f;\n", out.m_fMusicSampleLengthSeconds );
if( out.m_StopSegments.GetSize() ) if( !out.m_StopSegments.empty() )
{ {
fprintf( fp, "#FREEZE:" ); fprintf( fp, "#FREEZE:" );
for( int i=0; i<out.m_StopSegments.GetSize(); i++ ) for( unsigned i=0; i<out.m_StopSegments.size(); i++ )
{ {
const StopSegment &fs = out.m_StopSegments[i]; const StopSegment &fs = out.m_StopSegments[i];
fprintf( fp, "%.3f=%.3f", BeatToNoteRow( fs.m_fStartBeat ) * 4.0f / ROWS_PER_BEAT, fprintf( fp, "%.3f=%.3f", BeatToNoteRow( fs.m_fStartBeat ) * 4.0f / ROWS_PER_BEAT,
roundf(fs.m_fStopSeconds*1000) ); roundf(fs.m_fStopSeconds*1000) );
if( i != out.m_StopSegments.GetSize()-1 ) if( i != out.m_StopSegments.size()-1 )
fprintf( fp, "," ); fprintf( fp, "," );
} }
fprintf( fp, ";\n" ); fprintf( fp, ";\n" );
} }
if( out.m_BPMSegments.GetSize() > 1) if( out.m_BPMSegments.size() > 1)
{ {
fprintf( fp, "#CHANGEBPM:" ); fprintf( fp, "#CHANGEBPM:" );
for( int i=1; i<out.m_BPMSegments.GetSize(); i++ ) for( unsigned i=1; i<out.m_BPMSegments.size(); i++ )
{ {
const BPMSegment &bs = out.m_BPMSegments[i]; const BPMSegment &bs = out.m_BPMSegments[i];
fprintf( fp, "%.3f=%.3f", BeatToNoteRow( bs.m_fStartBeat ) * 4.0f / ROWS_PER_BEAT, bs.m_fBPM ); fprintf( fp, "%.3f=%.3f", BeatToNoteRow( bs.m_fStartBeat ) * 4.0f / ROWS_PER_BEAT, bs.m_fBPM );
if( i != out.m_BPMSegments.GetSize()-1 ) if( i != out.m_BPMSegments.size()-1 )
fprintf( fp, "," ); fprintf( fp, "," );
} }
fprintf( fp, ";\n" ); fprintf( fp, ";\n" );
} }
for( int i=0; i<out.m_apNotes.GetSize(); i++ ) for( unsigned i=0; i<out.m_apNotes.size(); i++ )
{ {
if( -1 != out.m_apNotes[i]->m_sDescription.Find("autogen") ) if( -1 != out.m_apNotes[i]->m_sDescription.Find("autogen") )
continue; // don't save autogen notes continue; // don't save autogen notes
+5 -5
View File
@@ -225,21 +225,21 @@ void ScreenSelectMode::RefreshModeChoices()
int iNumSidesJoined = GAMESTATE->GetNumSidesJoined(); int iNumSidesJoined = GAMESTATE->GetNumSidesJoined();
GAMEMAN->GetModesChoicesForGame( GAMESTATE->m_CurGame, m_aPossibleModeChoices ); GAMEMAN->GetModesChoicesForGame( GAMESTATE->m_CurGame, m_aPossibleModeChoices );
ASSERT( m_aPossibleModeChoices.GetSize() > 0 ); ASSERT( !m_aPossibleModeChoices.empty() );
int i; int i;
// remove ModeChoices that won't work with the current number of players // remove ModeChoices that won't work with the current number of players
for( i=m_aPossibleModeChoices.GetSize()-1; i>=0; i-- ) for( i=m_aPossibleModeChoices.size()-1; i>=0; i-- )
if( m_aPossibleModeChoices[i].numSidesJoinedToPlay != iNumSidesJoined ) if( m_aPossibleModeChoices[i].numSidesJoinedToPlay != iNumSidesJoined )
m_aPossibleModeChoices.RemoveAt( i ); m_aPossibleModeChoices.RemoveAt( i );
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
CStringArray asGraphicPaths; CStringArray asGraphicPaths;
for( i=0; i<m_aPossibleModeChoices.GetSize(); i++ ) for( unsigned j=0; j<m_aPossibleModeChoices.size(); j++ )
{ {
const ModeChoice& choice = m_aPossibleModeChoices[i]; const ModeChoice& choice = m_aPossibleModeChoices[j];
asGraphicPaths.Add( THEME->GetPathTo("Graphics", ssprintf("select mode choice %s %s", sGameName.GetString(), choice.name) ) ); asGraphicPaths.Add( THEME->GetPathTo("Graphics", ssprintf("select mode choice %s %s", sGameName.GetString(), choice.name) ) );
} }
@@ -250,7 +250,7 @@ void ScreenSelectMode::RefreshModeChoices()
{ {
CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName;
for( int i=0; i<m_aPossibleModeChoices.GetSize(); i++ ) for( unsigned i=0; i<m_aPossibleModeChoices.size(); i++ )
{ {
CString sChoiceName = m_aPossibleModeChoices[i].name; CString sChoiceName = m_aPossibleModeChoices[i].name;
m_BGAnimations[i].LoadFromAniDir( THEME->GetPathTo("BGAnimations",ssprintf("select mode %s %s", sGameName.GetString(), sChoiceName.GetString())) ); m_BGAnimations[i].LoadFromAniDir( THEME->GetPathTo("BGAnimations",ssprintf("select mode %s %s", sGameName.GetString(), sChoiceName.GetString())) );
+11 -11
View File
@@ -45,7 +45,7 @@ ScrollingList::~ScrollingList()
void ScrollingList::Unload() void ScrollingList::Unload()
{ {
for( int i=0; i<m_apSprites.GetSize(); i++ ) for( unsigned i=0; i<m_apSprites.size(); i++ )
delete m_apSprites[i]; delete m_apSprites[i];
m_apSprites.clear(); m_apSprites.clear();
} }
@@ -57,7 +57,7 @@ in the scrolling list
void ScrollingList::Load( const CStringArray& asGraphicPaths ) void ScrollingList::Load( const CStringArray& asGraphicPaths )
{ {
Unload(); Unload();
for( int i=0; i<asGraphicPaths.GetSize(); i++ ) for( unsigned i=0; i<asGraphicPaths.size(); i++ )
{ {
Sprite* pNewSprite = new Sprite; Sprite* pNewSprite = new Sprite;
pNewSprite->Load( asGraphicPaths[i] ); pNewSprite->Load( asGraphicPaths[i] );
@@ -73,9 +73,9 @@ Make the entire list shuffle left
**************************************/ **************************************/
void ScrollingList::Left() void ScrollingList::Left()
{ {
ASSERT( m_apSprites.GetSize() > 0 ); // nothing loaded! ASSERT( !m_apSprites.empty() ); // nothing loaded!
m_iSelection = (m_iSelection + m_apSprites.GetSize() - 1) % m_apSprites.GetSize(); // decrement with wrapping m_iSelection = (m_iSelection + m_apSprites.size() - 1) % m_apSprites.size(); // decrement with wrapping
m_fSelectionLag -= 1; m_fSelectionLag -= 1;
} }
@@ -86,9 +86,9 @@ Make the entire list shuffle right
**************************************/ **************************************/
void ScrollingList::Right() void ScrollingList::Right()
{ {
ASSERT( m_apSprites.GetSize() > 0 ); // nothing loaded! ASSERT( !m_apSprites.empty() ); // nothing loaded!
m_iSelection = (m_iSelection + 1) % m_apSprites.GetSize(); // increment with wrapping m_iSelection = (m_iSelection + 1) % m_apSprites.size(); // increment with wrapping
m_fSelectionLag += 1; m_fSelectionLag += 1;
} }
@@ -133,7 +133,7 @@ void ScrollingList::Update( float fDeltaTime )
{ {
ActorFrame::Update( fDeltaTime ); ActorFrame::Update( fDeltaTime );
if( m_apSprites.GetSize() == 0 ) if( m_apSprites.empty() )
return; return;
// update m_fLaggingSelection // update m_fLaggingSelection
@@ -149,7 +149,7 @@ void ScrollingList::Update( float fDeltaTime )
m_fSelectionLag = 0; // snap m_fSelectionLag = 0; // snap
} }
for( int i=0; i<m_apSprites.GetSize(); i++ ) for( unsigned i=0; i<m_apSprites.size(); i++ )
m_apSprites[i]->Update( fDeltaTime ); m_apSprites[i]->Update( fDeltaTime );
} }
@@ -160,7 +160,7 @@ Draws the elements onto the screen
*********************************/ *********************************/
void ScrollingList::DrawPrimitives() void ScrollingList::DrawPrimitives()
{ {
ASSERT( m_apSprites.GetSize() > 0 ); ASSERT( !m_apSprites.empty() );
for( int i=(m_iNumVisible)/2; i>= 0; i-- ) // draw outside to inside for( int i=(m_iNumVisible)/2; i>= 0; i-- ) // draw outside to inside
{ {
@@ -168,8 +168,8 @@ void ScrollingList::DrawPrimitives()
int iIndexToDraw2 = m_iSelection + i; int iIndexToDraw2 = m_iSelection + i;
// wrap IndexToDraw* // wrap IndexToDraw*
iIndexToDraw1 = (iIndexToDraw1 + m_apSprites.GetSize()*300) % m_apSprites.GetSize(); // make sure this is positive iIndexToDraw1 = (iIndexToDraw1 + m_apSprites.size()*300) % m_apSprites.size(); // make sure this is positive
iIndexToDraw2 = iIndexToDraw2 % m_apSprites.GetSize(); iIndexToDraw2 = iIndexToDraw2 % m_apSprites.size();
ASSERT( iIndexToDraw1 >= 0 ); ASSERT( iIndexToDraw1 >= 0 );
+1 -1
View File
@@ -30,7 +30,7 @@ void SongCacheIndex::ReadCacheIndex()
LOG->Trace( "Cache format is out of date. Deleting all cache files." ); LOG->Trace( "Cache format is out of date. Deleting all cache files." );
CStringArray asCacheFileNames; CStringArray asCacheFileNames;
GetDirListing( "Cache/*.*", asCacheFileNames ); GetDirListing( "Cache/*.*", asCacheFileNames );
for( int i=0; i<asCacheFileNames.GetSize(); i++ ) for( unsigned i=0; i<asCacheFileNames.size(); i++ )
DeleteFile( "Cache/" + asCacheFileNames[i] ); DeleteFile( "Cache/" + asCacheFileNames[i] );
CacheIndex.Reset(); CacheIndex.Reset();
} }
+3 -3
View File
@@ -36,7 +36,7 @@ TipDisplay::TipDisplay()
void TipDisplay::SetTips( CStringArray &arrayTips ) void TipDisplay::SetTips( CStringArray &arrayTips )
{ {
m_arrayTips = arrayTips; m_arrayTips = arrayTips;
if( m_arrayTips.GetSize() > 0 ) if( !m_arrayTips.empty() )
m_textTip.SetText( m_arrayTips[0] ); m_textTip.SetText( m_arrayTips[0] );
} }
@@ -45,13 +45,13 @@ void TipDisplay::Update( float fDeltaTime )
{ {
ActorFrame::Update( fDeltaTime ); ActorFrame::Update( fDeltaTime );
if( m_arrayTips.GetSize() > 0 ) if( !m_arrayTips.empty() )
{ {
m_fSecsUntilSwitch -= fDeltaTime; m_fSecsUntilSwitch -= fDeltaTime;
if( m_fSecsUntilSwitch < 0 ) // time to switch states if( m_fSecsUntilSwitch < 0 ) // time to switch states
{ {
m_iCurTipIndex++; m_iCurTipIndex++;
m_iCurTipIndex = m_iCurTipIndex % m_arrayTips.GetSize(); m_iCurTipIndex = m_iCurTipIndex % m_arrayTips.size();
m_fSecsUntilSwitch = TIP_SHOW_TIME; m_fSecsUntilSwitch = TIP_SHOW_TIME;
m_textTip.SetText( m_arrayTips[m_iCurTipIndex] ); m_textTip.SetText( m_arrayTips[m_iCurTipIndex] );
} }