some more s/GetSize/size/ and other minor STLisms
This commit is contained in:
@@ -41,7 +41,7 @@ void Screen::Update( float fDeltaTime )
|
||||
// update the times of queued ScreenMessages and send if timer has expired
|
||||
// The order you remove messages in must be very careful! Sending a message can
|
||||
// potentially clear all m_QueuedMessages, and set a new state!
|
||||
for( int i=0; i<m_QueuedMessages.GetSize(); i++ )
|
||||
for( unsigned i=0; i<m_QueuedMessages.size(); i++ )
|
||||
{
|
||||
/* Er, wait. Shouldn't we subtract first? This will make messages
|
||||
* get delayed an extra frame. -glenn */
|
||||
|
||||
@@ -78,9 +78,9 @@ void ScreenAppearanceOptions::ImportOptions()
|
||||
CStringArray arrayAnnouncerNames;
|
||||
ANNOUNCER->GetAnnouncerNames( arrayAnnouncerNames );
|
||||
|
||||
m_OptionRowData[AO_ANNOUNCER].iNumOptions = arrayAnnouncerNames.GetSize() + 1;
|
||||
|
||||
for( int i=0; i<arrayAnnouncerNames.GetSize(); i++ )
|
||||
m_OptionRowData[AO_ANNOUNCER].iNumOptions = arrayAnnouncerNames.size() + 1;
|
||||
unsigned i;
|
||||
for( i=0; i<arrayAnnouncerNames.size(); i++ )
|
||||
strcpy( m_OptionRowData[AO_ANNOUNCER].szOptionsText[i+1], arrayAnnouncerNames[i] );
|
||||
|
||||
|
||||
@@ -104,9 +104,9 @@ void ScreenAppearanceOptions::ImportOptions()
|
||||
CStringArray arrayThemeNames;
|
||||
THEME->GetThemeNamesForCurGame( arrayThemeNames );
|
||||
|
||||
m_OptionRowData[AO_THEME].iNumOptions = arrayThemeNames.GetSize();
|
||||
m_OptionRowData[AO_THEME].iNumOptions = arrayThemeNames.size();
|
||||
|
||||
for( i=0; i<arrayThemeNames.GetSize(); i++ )
|
||||
for( i=0; i<arrayThemeNames.size(); i++ )
|
||||
strcpy( m_OptionRowData[AO_THEME].szOptionsText[i], arrayThemeNames[i] );
|
||||
|
||||
|
||||
@@ -130,9 +130,9 @@ void ScreenAppearanceOptions::ImportOptions()
|
||||
CStringArray arraySkinNames;
|
||||
GAMEMAN->GetNoteSkinNames( arraySkinNames );
|
||||
|
||||
m_OptionRowData[AO_SKIN].iNumOptions = arraySkinNames.GetSize();
|
||||
m_OptionRowData[AO_SKIN].iNumOptions = arraySkinNames.size();
|
||||
|
||||
for( i=0; i<arraySkinNames.GetSize(); i++ )
|
||||
for( i=0; i<arraySkinNames.size(); i++ )
|
||||
strcpy( m_OptionRowData[AO_SKIN].szOptionsText[i], arraySkinNames[i] );
|
||||
|
||||
// highlight currently selected skin
|
||||
|
||||
@@ -617,14 +617,14 @@ void ScreenEdit::Input( const DeviceInput& DeviceI, const InputEventType type, c
|
||||
void AddBGChange( CString sBGName )
|
||||
{
|
||||
Song* pSong = GAMESTATE->m_pCurSong;
|
||||
|
||||
for( int i=0; i<pSong->m_BackgroundChanges.GetSize(); i++ )
|
||||
unsigned i;
|
||||
for( i=0; i<pSong->m_BackgroundChanges.size(); i++ )
|
||||
{
|
||||
if( pSong->m_BackgroundChanges[i].m_fStartBeat == GAMESTATE->m_fSongBeat )
|
||||
break;
|
||||
}
|
||||
|
||||
if( i != pSong->m_BackgroundChanges.GetSize() ) // there is already a BGChange here
|
||||
if( i != pSong->m_BackgroundChanges.size() ) // there is already a BGChange here
|
||||
pSong->m_BackgroundChanges.RemoveAt( i );
|
||||
|
||||
// create a new BGChange
|
||||
@@ -1043,12 +1043,13 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
|
||||
case DIK_B:
|
||||
{
|
||||
CString sOldBackground;
|
||||
for( int i=0; i<m_pSong->m_BackgroundChanges.GetSize(); i++ )
|
||||
unsigned i;
|
||||
for( i=0; i<m_pSong->m_BackgroundChanges.size(); i++ )
|
||||
{
|
||||
if( m_pSong->m_BackgroundChanges[i].m_fStartBeat == GAMESTATE->m_fSongBeat )
|
||||
break;
|
||||
}
|
||||
if( i != m_pSong->m_BackgroundChanges.GetSize() ) // there is already a BGChange here
|
||||
if( i != m_pSong->m_BackgroundChanges.size() ) // there is already a BGChange here
|
||||
sOldBackground = m_pSong->m_BackgroundChanges[i].m_sBGName;
|
||||
|
||||
SCREENMAN->TextEntry( SM_None, "Type a background name.\nPress Enter to keep,\nEscape to cancel.\nEnter an empty string to remove\nthe Background Change.", sOldBackground, AddBGChange, NULL );
|
||||
@@ -1080,11 +1081,12 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
|
||||
}
|
||||
float fNewBPM = fBPM + fDeltaBPM;
|
||||
|
||||
for( int i=0; i<m_pSong->m_BPMSegments.GetSize(); i++ )
|
||||
unsigned i;
|
||||
for( i=0; i<m_pSong->m_BPMSegments.size(); i++ )
|
||||
if( m_pSong->m_BPMSegments[i].m_fStartBeat == GAMESTATE->m_fSongBeat )
|
||||
break;
|
||||
|
||||
if( i == m_pSong->m_BPMSegments.GetSize() ) // there is no BPMSegment at the current beat
|
||||
if( i == m_pSong->m_BPMSegments.size() ) // there is no BPMSegment at the current beat
|
||||
{
|
||||
// create a new BPMSegment
|
||||
m_pSong->AddBPMSegment( BPMSegment(GAMESTATE->m_fSongBeat, fNewBPM) );
|
||||
@@ -1114,13 +1116,14 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
|
||||
case IET_FAST_REPEAT: fStopDelta *= 40; break;
|
||||
}
|
||||
|
||||
for( int i=0; i<m_pSong->m_StopSegments.GetSize(); i++ )
|
||||
unsigned i;
|
||||
for( i=0; i<m_pSong->m_StopSegments.size(); i++ )
|
||||
{
|
||||
if( m_pSong->m_StopSegments[i].m_fStartBeat == GAMESTATE->m_fSongBeat )
|
||||
break;
|
||||
}
|
||||
|
||||
if( i == m_pSong->m_StopSegments.GetSize() ) // there is no BPMSegment at the current beat
|
||||
if( i == m_pSong->m_StopSegments.size() ) // there is no BPMSegment at the current beat
|
||||
{
|
||||
// create a new StopSegment
|
||||
if( fStopDelta > 0 )
|
||||
|
||||
@@ -217,11 +217,11 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
// crop down to 3
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( GAMESTATE->m_apSongsPlayed.GetSize() > STAGES_TO_SHOW_IN_SUMMARY )
|
||||
GAMESTATE->m_apSongsPlayed.RemoveAt( 0, GAMESTATE->m_apSongsPlayed.GetSize() - STAGES_TO_SHOW_IN_SUMMARY );
|
||||
if( GAMESTATE->m_apSongsPlayed.size() > STAGES_TO_SHOW_IN_SUMMARY )
|
||||
GAMESTATE->m_apSongsPlayed.RemoveAt( 0, GAMESTATE->m_apSongsPlayed.size() - STAGES_TO_SHOW_IN_SUMMARY );
|
||||
}
|
||||
|
||||
const int iSongsToShow = GAMESTATE->m_apSongsPlayed.GetSize();
|
||||
const unsigned iSongsToShow = GAMESTATE->m_apSongsPlayed.size();
|
||||
ASSERT( iSongsToShow > 0 );
|
||||
|
||||
for( int i=0; i<iSongsToShow; i++ )
|
||||
@@ -685,7 +685,7 @@ void ScreenEvaluation::TweenOnScreen()
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
|
||||
CArray<Actor*,Actor*> apActorsInBonusOrStageInfo;
|
||||
apActorsInBonusOrStageInfo.Add( &m_sprBonusFrame[p] );
|
||||
@@ -697,7 +697,7 @@ void ScreenEvaluation::TweenOnScreen()
|
||||
apActorsInBonusOrStageInfo.Add( &m_sprCourseFrame[p] );
|
||||
apActorsInBonusOrStageInfo.Add( &m_textTime[p] );
|
||||
apActorsInBonusOrStageInfo.Add( &m_textSongsSurvived[p] );
|
||||
for( i=0; i<apActorsInBonusOrStageInfo.GetSize(); i++ )
|
||||
for( i=0; i<apActorsInBonusOrStageInfo.size(); i++ )
|
||||
{
|
||||
fOriginalX = apActorsInBonusOrStageInfo[i]->GetX();
|
||||
apActorsInBonusOrStageInfo[i]->SetX( fOriginalX + SCREEN_WIDTH/2*(p==PLAYER_1 ? 1 : -1) );
|
||||
@@ -714,7 +714,7 @@ void ScreenEvaluation::TweenOnScreen()
|
||||
apActorsInGradeOrPercentFrame.Add( &m_textOniPercentLarge[p] );
|
||||
apActorsInGradeOrPercentFrame.Add( &m_textOniPercentSmall[p] );
|
||||
apActorsInGradeOrPercentFrame.Add( &m_sprNewRecord[p] );
|
||||
for( i=0; i<apActorsInGradeOrPercentFrame.GetSize(); i++ )
|
||||
for( i=0; i<apActorsInGradeOrPercentFrame.size(); i++ )
|
||||
{
|
||||
float fOriginalZoomY = apActorsInGradeOrPercentFrame[i]->GetZoomY();
|
||||
apActorsInGradeOrPercentFrame[i]->SetZoomY( 0 );
|
||||
|
||||
@@ -264,7 +264,7 @@ void ScreenEz2SelectMusic::TweenOffScreen()
|
||||
apActorsInScore.Add( &m_sprHighScoreFrame[p] );
|
||||
apActorsInScore.Add( &m_HighScore[p] );
|
||||
}
|
||||
for( i=0; i<apActorsInScore.GetSize(); i++ )
|
||||
for( i=0; i<apActorsInScore.size(); i++ )
|
||||
{
|
||||
apActorsInScore[i]->BeginTweening( TWEEN_TIME, TWEEN_BIAS_END );
|
||||
apActorsInScore[i]->SetTweenX( SCORE_CONNECTED_TO_MUSIC_WHEEL ? apActorsInScore[i]->GetX()+400 : apActorsInScore[i]->GetX()-400 );
|
||||
@@ -284,7 +284,7 @@ void ScreenEz2SelectMusic::TweenScoreOnAndOffAfterChangeSort()
|
||||
apActorsInScore.Add( &m_sprHighScoreFrame[p] );
|
||||
apActorsInScore.Add( &m_HighScore[p] );
|
||||
}
|
||||
for( int i=0; i<apActorsInScore.GetSize(); i++ )
|
||||
for( unsigned i=0; i<apActorsInScore.size(); i++ )
|
||||
{
|
||||
apActorsInScore[i]->StopTweening();
|
||||
|
||||
@@ -376,7 +376,7 @@ void ScreenEz2SelectMusic::EasierDifficulty( PlayerNumber pn )
|
||||
|
||||
if( !GAMESTATE->IsPlayerEnabled(pn) )
|
||||
return;
|
||||
if( m_arrayNotes.GetSize() == 0 )
|
||||
if( m_arrayNotes.empty() )
|
||||
return;
|
||||
if( m_iSelection[pn] == 0 )
|
||||
return;
|
||||
@@ -396,9 +396,9 @@ void ScreenEz2SelectMusic::HarderDifficulty( PlayerNumber pn )
|
||||
|
||||
if( !GAMESTATE->IsPlayerEnabled(pn) )
|
||||
return;
|
||||
if( m_arrayNotes.GetSize() == 0 )
|
||||
if( m_arrayNotes.empty() )
|
||||
return;
|
||||
if( m_iSelection[pn] == m_arrayNotes.GetSize()-1 )
|
||||
if( m_iSelection[pn] == m_arrayNotes.size()-1 )
|
||||
return;
|
||||
|
||||
m_iSelection[pn]++;
|
||||
@@ -599,9 +599,9 @@ void ScreenEz2SelectMusic::AfterNotesChange( PlayerNumber pn )
|
||||
if( !GAMESTATE->IsPlayerEnabled(pn) )
|
||||
return;
|
||||
|
||||
m_iSelection[pn] = clamp( m_iSelection[pn], 0, m_arrayNotes.GetSize()-1 ); // bounds clamping
|
||||
m_iSelection[pn] = clamp( m_iSelection[pn], 0, m_arrayNotes.size()-1 ); // bounds clamping
|
||||
|
||||
Notes* pNotes = m_arrayNotes.GetSize()>0 ? m_arrayNotes[m_iSelection[pn]] : NULL;
|
||||
Notes* pNotes = m_arrayNotes.empty()? NULL:m_arrayNotes[m_iSelection[pn]];
|
||||
|
||||
GAMESTATE->m_pCurNotes[pn] = pNotes;
|
||||
|
||||
@@ -670,11 +670,11 @@ void ScreenEz2SelectMusic::AfterMusicChange()
|
||||
{
|
||||
if( !GAMESTATE->IsPlayerEnabled( PlayerNumber(p) ) )
|
||||
continue;
|
||||
for( int i=0; i<m_arrayNotes.GetSize(); i++ )
|
||||
for( int i=0; i<m_arrayNotes.size(); i++ )
|
||||
if( m_arrayNotes[i]->m_DifficultyClass == GAMESTATE->m_PreferredDifficultyClass[p] )
|
||||
m_iSelection[p] = i;
|
||||
|
||||
m_iSelection[p] = clamp( m_iSelection[p], 0, m_arrayNotes.GetSize() ) ;
|
||||
m_iSelection[p] = clamp( m_iSelection[p], 0, m_arrayNotes.size() ) ;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -140,7 +140,7 @@ ScreenGameplay::ScreenGameplay()
|
||||
CStringArray asModifiers;
|
||||
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes, asModifiers, true );
|
||||
|
||||
for( int i=0; i<apNotes.GetSize(); i++ )
|
||||
for( unsigned i=0; i<apNotes.size(); i++ )
|
||||
{
|
||||
apNotes[i]->GetNoteData( ¬edata );
|
||||
int iPossibleDancePoints = notedata.GetPossibleDancePoints();
|
||||
@@ -497,7 +497,7 @@ bool ScreenGameplay::IsLastSong()
|
||||
CStringArray asModifiers;
|
||||
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes, asModifiers, true );
|
||||
|
||||
return GAMESTATE->m_iSongsIntoCourse >= apSongs.GetSize(); // there are no more songs left
|
||||
return unsigned(GAMESTATE->m_iSongsIntoCourse) >= apSongs.size(); // there are no more songs left
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -528,7 +528,7 @@ void ScreenGameplay::LoadNextSong( bool bFirstLoad )
|
||||
pCourse->GetSongAndNotesForCurrentStyle( apSongs, apNotes, asModifiers, true );
|
||||
|
||||
int iPlaySongIndex = GAMESTATE->m_iSongsIntoCourse;
|
||||
iPlaySongIndex %= apSongs.GetSize();
|
||||
iPlaySongIndex %= apSongs.size();
|
||||
|
||||
GAMESTATE->m_pCurSong = apSongs[iPlaySongIndex];
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
@@ -1445,7 +1445,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
|
||||
void ScreenGameplay::TweenOnScreen()
|
||||
{
|
||||
int i, p;
|
||||
unsigned i, p;
|
||||
|
||||
CArray<Actor*,Actor*> apActorsInLifeFrame;
|
||||
apActorsInLifeFrame.Add( &m_sprLifeFrame );
|
||||
@@ -1454,7 +1454,7 @@ void ScreenGameplay::TweenOnScreen()
|
||||
apActorsInLifeFrame.Add( &m_textStageNumber );
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
apActorsInLifeFrame.Add( &m_textCourseSongNumber[p] );
|
||||
for( i=0; i<apActorsInLifeFrame.GetSize(); i++ )
|
||||
for( i=0; i<apActorsInLifeFrame.size(); i++ )
|
||||
{
|
||||
float fOriginalY = apActorsInLifeFrame[i]->GetY();
|
||||
apActorsInLifeFrame[i]->SetY( fOriginalY-100 );
|
||||
@@ -1475,7 +1475,7 @@ void ScreenGameplay::TweenOnScreen()
|
||||
apActorsInScoreFrame.Add( &m_textPlayerOptions[p] );
|
||||
}
|
||||
apActorsInScoreFrame.Add( &m_textSongOptions );
|
||||
for( i=0; i<apActorsInScoreFrame.GetSize(); i++ )
|
||||
for( i=0; i<apActorsInScoreFrame.size(); i++ )
|
||||
{
|
||||
float fOriginalY = apActorsInScoreFrame[i]->GetY();
|
||||
apActorsInScoreFrame[i]->SetY( fOriginalY+100 );
|
||||
|
||||
@@ -114,11 +114,11 @@ void ScreenGraphicOptions::UpdateRefreshRates()
|
||||
opt.iNumOptions = 2;
|
||||
int OldSettingNo = RageDisplay::REFRESH_DEFAULT;
|
||||
|
||||
int i;
|
||||
unsigned i;
|
||||
for(i = 2; i < MAX_OPTIONS_PER_LINE; ++i)
|
||||
opt.szOptionsText[i][0] = 0;
|
||||
|
||||
for(i = 0; i < hz.GetSize(); ++i)
|
||||
for(i = 0; i < hz.size(); ++i)
|
||||
{
|
||||
if(hz[i] < 60) continue;
|
||||
sprintf(opt.szOptionsText[opt.iNumOptions], "%i", hz[i]);
|
||||
|
||||
@@ -62,7 +62,7 @@ ScreenManager::~ScreenManager()
|
||||
EmptyDeleteQueue();
|
||||
|
||||
// delete current states
|
||||
for( int i=0; i<m_ScreenStack.GetSize(); i++ )
|
||||
for( unsigned i=0; i<m_ScreenStack.size(); i++ )
|
||||
SAFE_DELETE( m_ScreenStack[i] );
|
||||
SAFE_DELETE( m_ScreenBuffered );
|
||||
}
|
||||
@@ -70,7 +70,7 @@ ScreenManager::~ScreenManager()
|
||||
void ScreenManager::EmptyDeleteQueue()
|
||||
{
|
||||
// delete all ScreensToDelete
|
||||
for( int i=0; i<m_ScreensToDelete.GetSize(); i++ )
|
||||
for( unsigned i=0; i<m_ScreensToDelete.size(); i++ )
|
||||
SAFE_DELETE( m_ScreensToDelete[i] );
|
||||
|
||||
m_ScreensToDelete.clear();
|
||||
@@ -86,7 +86,7 @@ void ScreenManager::Update( float fDeltaTime )
|
||||
EmptyDeleteQueue();
|
||||
|
||||
// Update all windows in the stack
|
||||
for( int i=0; i<m_ScreenStack.GetSize(); i++ ) {
|
||||
for( unsigned i=0; i<m_ScreenStack.size(); i++ ) {
|
||||
/* Screens take some time to load. If we don't do this, then screens
|
||||
* receive an initial update that includes all of the time they spent
|
||||
* loading, which will chop off their tweens.
|
||||
@@ -112,20 +112,20 @@ void ScreenManager::Update( float fDeltaTime )
|
||||
void ScreenManager::Restore()
|
||||
{
|
||||
// Draw all CurrentScreens (back to front)
|
||||
for( int i=0; i<m_ScreenStack.GetSize(); i++ )
|
||||
for( unsigned i=0; i<m_ScreenStack.size(); i++ )
|
||||
m_ScreenStack[i]->Restore();
|
||||
}
|
||||
|
||||
void ScreenManager::Invalidate()
|
||||
{
|
||||
for( int i=0; i<m_ScreenStack.GetSize(); i++ )
|
||||
for( unsigned i=0; i<m_ScreenStack.size(); i++ )
|
||||
m_ScreenStack[i]->Invalidate();
|
||||
}
|
||||
|
||||
void ScreenManager::Draw()
|
||||
{
|
||||
// Draw all CurrentScreens (back to front)
|
||||
for( int i=0; i<m_ScreenStack.GetSize(); i++ )
|
||||
for( unsigned i=0; i<m_ScreenStack.size(); i++ )
|
||||
m_ScreenStack[i]->Draw();
|
||||
|
||||
if( m_textSystemMessage.GetDiffuse().a != 0 )
|
||||
@@ -148,8 +148,8 @@ void ScreenManager::Input( const DeviceInput& DeviceI, const InputEventType type
|
||||
// DeviceI.device, DeviceI.button, GameI.controller, GameI.button, MenuI.player, MenuI.button, StyleI.player, StyleI.col );
|
||||
|
||||
// pass input only to topmost state
|
||||
if( m_ScreenStack.GetSize() > 0 )
|
||||
m_ScreenStack[m_ScreenStack.GetSize()-1]->Input( DeviceI, type, GameI, MenuI, StyleI );
|
||||
if( !m_ScreenStack.empty() )
|
||||
m_ScreenStack.back()->Input( DeviceI, type, GameI, MenuI, StyleI );
|
||||
}
|
||||
|
||||
|
||||
@@ -287,18 +287,18 @@ void ScreenManager::TextEntry( ScreenMessage SM_SendWhenDone, CString sQuestion,
|
||||
|
||||
void ScreenManager::PopTopScreen( ScreenMessage SM )
|
||||
{
|
||||
Screen* pScreenToPop = m_ScreenStack[m_ScreenStack.GetSize()-1]; // top menu
|
||||
Screen* pScreenToPop = m_ScreenStack.back(); // top menu
|
||||
//pScreenToPop->HandleScreenMessage( SM_LosingInputFocus );
|
||||
m_ScreenStack.RemoveAt(m_ScreenStack.GetSize()-1);
|
||||
m_ScreenStack.RemoveAt(m_ScreenStack.size()-1);
|
||||
m_ScreensToDelete.Add( pScreenToPop );
|
||||
|
||||
Screen* pNewTopScreen = m_ScreenStack[m_ScreenStack.GetSize()-1];
|
||||
Screen* pNewTopScreen = m_ScreenStack[m_ScreenStack.size()-1];
|
||||
pNewTopScreen->HandleScreenMessage( SM );
|
||||
}
|
||||
|
||||
void ScreenManager::SendMessageToTopScreen( ScreenMessage SM, float fDelay )
|
||||
{
|
||||
Screen* pTopScreen = m_ScreenStack[m_ScreenStack.GetSize()-1];
|
||||
Screen* pTopScreen = m_ScreenStack.back();
|
||||
pTopScreen->SendScreenMessage( SM, fDelay );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user