From 945a39a247dfea2363bff59d6ad63df8682aa255 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 31 Oct 2002 02:54:49 +0000 Subject: [PATCH] some more s/GetSize/size/ and other minor STLisms --- stepmania/src/BGAnimation.cpp | 14 +++++++------- stepmania/src/MusicList.cpp | 14 +++++++------- stepmania/src/NoteData.cpp | 18 +++++++++--------- stepmania/src/NoteDisplay.cpp | 10 +++++----- stepmania/src/NotesLoader.cpp | 2 +- stepmania/src/NotesLoaderBMS.cpp | 18 +++++++++--------- stepmania/src/NotesWriterDWI.cpp | 14 +++++++------- stepmania/src/ScreenSelectMode.cpp | 10 +++++----- stepmania/src/ScrollingList.cpp | 22 +++++++++++----------- stepmania/src/SongCacheIndex.cpp | 2 +- stepmania/src/TipDisplay.cpp | 6 +++--- 11 files changed, 65 insertions(+), 65 deletions(-) diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index 676705acbc..fec78bded1 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -30,7 +30,7 @@ BGAnimation::~BGAnimation() void BGAnimation::Unload() { - for( int i=0; iUpdate( fDeltaTime ); } void BGAnimation::DrawPrimitives() { - for( int i=0; iDraw(); } void BGAnimation::GainingFocus() { - for( int i=0; iGainingFocus(); SetDiffuse( RageColor(1,1,1,1) ); @@ -129,12 +129,12 @@ void BGAnimation::GainingFocus() void BGAnimation::LosingFocus() { - for( int i=0; iLosingFocus(); } void BGAnimation::SetDiffuse( const RageColor &c ) { - for( int i=0; iSetDiffuse(c); } diff --git a/stepmania/src/MusicList.cpp b/stepmania/src/MusicList.cpp index c3e8f24866..c44cceb2ba 100644 --- a/stepmania/src/MusicList.cpp +++ b/stepmania/src/MusicList.cpp @@ -37,22 +37,22 @@ void MusicList::AddGroup() void MusicList::AddSongsToGroup(const CArray &Songs) { // 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= Songs.GetSize() ) + unsigned iIndex = c*TITLES_ROWS + r; + if( iIndex >= Songs.size() ) 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; } @@ -65,7 +65,7 @@ void MusicList::AddSongsToGroup(const CArray &Songs) } sText += sTitle + "\n"; } - m_ContentsText[m_ContentsText.GetSize()-1].ContentsText[c] = sText; + m_ContentsText[m_ContentsText.size()-1].ContentsText[c] = sText; } } diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index bc067af775..aefaefd1fe 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -74,7 +74,7 @@ void NoteData::LoadFromSMNoteDataString( CString sSMNoteData ) CStringArray asMeasures; split( sSMNoteData, ",", asMeasures, true ); // ignore empty is important - for( int m=0; mTrace( "%s:%s: iMeasureNo = %d, iNoteNum = %d, iNumNotesInThisMeasure = %d", // valuename.GetString(), sNoteData.GetString(), iMeasureNo, iNoteNum, iNumNotesInThisMeasure ); - for( int j=0; jTrace( "%s:%s: iMeasureNo = %d, iBMSTrackNo = %d, iNumNotesInThisMeasure = %d", // valuename.GetString(), sNoteData.GetString(), iMeasureNo, iBMSTrackNo, iNumNotesInThisMeasure ); - for( int j=0; j fFreezeStartBeat ) @@ -522,7 +522,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out ) } // the BPM segment of this beat is the last BPM segment 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. break; @@ -548,7 +548,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out ) } } - for( i=0; iTrace( "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 ); diff --git a/stepmania/src/NotesWriterDWI.cpp b/stepmania/src/NotesWriterDWI.cpp index 6b790deffc..c6d68eaaf7 100644 --- a/stepmania/src/NotesWriterDWI.cpp +++ b/stepmania/src/NotesWriterDWI.cpp @@ -228,35 +228,35 @@ bool NotesWriterDWI::Write( CString sPath, const Song &out ) fprintf( fp, "#SAMPLESTART:%.3f;\n", out.m_fMusicSampleStartSeconds ); fprintf( fp, "#SAMPLELENGTH:%.3f;\n", out.m_fMusicSampleLengthSeconds ); - if( out.m_StopSegments.GetSize() ) + if( !out.m_StopSegments.empty() ) { fprintf( fp, "#FREEZE:" ); - for( int i=0; i 1) + if( out.m_BPMSegments.size() > 1) { fprintf( fp, "#CHANGEBPM:" ); - for( int i=1; im_sDescription.Find("autogen") ) continue; // don't save autogen notes diff --git a/stepmania/src/ScreenSelectMode.cpp b/stepmania/src/ScreenSelectMode.cpp index 2efc1202a6..3d8d49eeb8 100644 --- a/stepmania/src/ScreenSelectMode.cpp +++ b/stepmania/src/ScreenSelectMode.cpp @@ -225,21 +225,21 @@ void ScreenSelectMode::RefreshModeChoices() int iNumSidesJoined = GAMESTATE->GetNumSidesJoined(); GAMEMAN->GetModesChoicesForGame( GAMESTATE->m_CurGame, m_aPossibleModeChoices ); - ASSERT( m_aPossibleModeChoices.GetSize() > 0 ); + ASSERT( !m_aPossibleModeChoices.empty() ); int i; // 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 ) m_aPossibleModeChoices.RemoveAt( i ); CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; CStringArray asGraphicPaths; - for( i=0; iGetPathTo("Graphics", ssprintf("select mode choice %s %s", sGameName.GetString(), choice.name) ) ); } @@ -250,7 +250,7 @@ void ScreenSelectMode::RefreshModeChoices() { CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; - for( int i=0; iGetPathTo("BGAnimations",ssprintf("select mode %s %s", sGameName.GetString(), sChoiceName.GetString())) ); diff --git a/stepmania/src/ScrollingList.cpp b/stepmania/src/ScrollingList.cpp index 552e59407f..6966c3a40f 100644 --- a/stepmania/src/ScrollingList.cpp +++ b/stepmania/src/ScrollingList.cpp @@ -45,7 +45,7 @@ ScrollingList::~ScrollingList() void ScrollingList::Unload() { - for( int i=0; iLoad( asGraphicPaths[i] ); @@ -73,9 +73,9 @@ Make the entire list shuffle 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; } @@ -86,9 +86,9 @@ Make the entire list shuffle 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; } @@ -133,7 +133,7 @@ void ScrollingList::Update( float fDeltaTime ) { ActorFrame::Update( fDeltaTime ); - if( m_apSprites.GetSize() == 0 ) + if( m_apSprites.empty() ) return; // update m_fLaggingSelection @@ -149,7 +149,7 @@ void ScrollingList::Update( float fDeltaTime ) m_fSelectionLag = 0; // snap } - for( int i=0; iUpdate( fDeltaTime ); } @@ -160,7 +160,7 @@ Draws the elements onto the screen *********************************/ 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 { @@ -168,8 +168,8 @@ void ScrollingList::DrawPrimitives() int iIndexToDraw2 = m_iSelection + i; // wrap IndexToDraw* - iIndexToDraw1 = (iIndexToDraw1 + m_apSprites.GetSize()*300) % m_apSprites.GetSize(); // make sure this is positive - iIndexToDraw2 = iIndexToDraw2 % m_apSprites.GetSize(); + iIndexToDraw1 = (iIndexToDraw1 + m_apSprites.size()*300) % m_apSprites.size(); // make sure this is positive + iIndexToDraw2 = iIndexToDraw2 % m_apSprites.size(); ASSERT( iIndexToDraw1 >= 0 ); diff --git a/stepmania/src/SongCacheIndex.cpp b/stepmania/src/SongCacheIndex.cpp index 0d84d86cff..a2ee1038d4 100644 --- a/stepmania/src/SongCacheIndex.cpp +++ b/stepmania/src/SongCacheIndex.cpp @@ -30,7 +30,7 @@ void SongCacheIndex::ReadCacheIndex() LOG->Trace( "Cache format is out of date. Deleting all cache files." ); CStringArray asCacheFileNames; GetDirListing( "Cache/*.*", asCacheFileNames ); - for( int i=0; i 0 ) + if( !m_arrayTips.empty() ) m_textTip.SetText( m_arrayTips[0] ); } @@ -45,13 +45,13 @@ void TipDisplay::Update( float fDeltaTime ) { ActorFrame::Update( fDeltaTime ); - if( m_arrayTips.GetSize() > 0 ) + if( !m_arrayTips.empty() ) { m_fSecsUntilSwitch -= fDeltaTime; if( m_fSecsUntilSwitch < 0 ) // time to switch states { m_iCurTipIndex++; - m_iCurTipIndex = m_iCurTipIndex % m_arrayTips.GetSize(); + m_iCurTipIndex = m_iCurTipIndex % m_arrayTips.size(); m_fSecsUntilSwitch = TIP_SHOW_TIME; m_textTip.SetText( m_arrayTips[m_iCurTipIndex] ); }