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

This commit is contained in:
Glenn Maynard
2002-10-31 03:16:02 +00:00
parent 69b816e780
commit 7e9905995d
27 changed files with 75 additions and 80 deletions
+2 -2
View File
@@ -94,14 +94,14 @@ void RefreshCacheItem( int iIndex )
CStringArray asButtonNames; CStringArray asButtonNames;
split( sButtonsNames, ",", asButtonNames, false ); split( sButtonsNames, ",", asButtonNames, false );
if( asButtonNames.GetSize() < 2 ) if( asButtonNames.size() < 2 )
{ {
LOG->Trace( "The code '%s' is less than 2 buttons, so it will be ignored.", sCodeName.GetString() ); LOG->Trace( "The code '%s' is less than 2 buttons, so it will be ignored.", sCodeName.GetString() );
item.iNumButtons = 0; item.iNumButtons = 0;
return; return;
} }
for( int i=0; i<asButtonNames.GetSize(); i++ ) // for each button in this code for( unsigned i=0; i<asButtonNames.size(); i++ ) // for each button in this code
{ {
CString sButtonName = asButtonNames[i]; CString sButtonName = asButtonNames[i];
+1 -1
View File
@@ -25,7 +25,7 @@ bool GameInput::fromString( CString s )
CStringArray a; CStringArray a;
split( s, "-", a); split( s, "-", a);
if( a.GetSize() != 2 ) { if( a.size() != 2 ) {
MakeInvalid(); MakeInvalid();
return false; return false;
} }
+4 -4
View File
@@ -1226,7 +1226,7 @@ bool GameManager::DoesNoteSkinExist( CString sSkinName ) const
{ {
CStringArray asSkinNames; CStringArray asSkinNames;
GetNoteSkinNames( asSkinNames ); GetNoteSkinNames( asSkinNames );
for( int i=0; i<asSkinNames.GetSize(); i++ ) for( unsigned i=0; i<asSkinNames.size(); i++ )
if( 0==stricmp(sSkinName, asSkinNames[i]) ) if( 0==stricmp(sSkinName, asSkinNames[i]) )
return true; return true;
return false; return false;
@@ -1318,7 +1318,7 @@ CString GameManager::GetPathTo( const int col, CString sElementName ) // looks i
GetDirListing( ssprintf("%s%s %s*.gif", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true ); GetDirListing( ssprintf("%s%s %s*.gif", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true ); GetDirListing( ssprintf("%s%s %s*", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
if( arrayPossibleFileNames.GetSize() > 0 ) if( !arrayPossibleFileNames.empty() )
return arrayPossibleFileNames[0]; return arrayPossibleFileNames[0];
throw RageException( "The NoteSkin element '%s %s' is missing from '%s'.", sButtonName.GetString(), sElementName.GetString(), sDir.GetString() ); throw RageException( "The NoteSkin element '%s %s' is missing from '%s'.", sButtonName.GetString(), sElementName.GetString(), sDir.GetString() );
@@ -1331,7 +1331,7 @@ void GameManager::GetEnabledGames( CArray<Game,Game>& aGamesOut )
Game game = (Game)g; Game game = (Game)g;
CStringArray asNoteSkins; CStringArray asNoteSkins;
GetNoteSkinNames( game, asNoteSkins ); GetNoteSkinNames( game, asNoteSkins );
if( asNoteSkins.GetSize() > 0 ) if( !asNoteSkins.empty() )
aGamesOut.Add( game ); aGamesOut.Add( game );
} }
} }
@@ -1344,7 +1344,7 @@ void GameManager::GetNoteSkinNames( Game game, CStringArray &AddTo ) const
GetDirListing( sBaseSkinFolder + "*.*", AddTo, true ); GetDirListing( sBaseSkinFolder + "*.*", AddTo, true );
// strip out "CVS" // strip out "CVS"
for( int i=AddTo.GetSize()-1; i>=0; i-- ) for( int i=AddTo.size()-1; i>=0; i-- )
if( 0 == stricmp("cvs", AddTo[i]) ) if( 0 == stricmp("cvs", AddTo[i]) )
AddTo.RemoveAt( i ); AddTo.RemoveAt( i );
} }
+1 -1
View File
@@ -301,7 +301,7 @@ float GameState::GetElapsedSeconds()
case PLAY_MODE_ENDLESS: case PLAY_MODE_ENDLESS:
{ {
float fSecondsTotal = 0; float fSecondsTotal = 0;
for( int i=0; i<m_apSongsPlayed.GetSize(); i++ ) for( unsigned i=0; i<m_apSongsPlayed.size(); i++ )
fSecondsTotal += m_apSongsPlayed[i]->m_fMusicLengthSeconds; fSecondsTotal += m_apSongsPlayed[i]->m_fMusicLengthSeconds;
fSecondsTotal += max( 0, m_fMusicSeconds ); fSecondsTotal += max( 0, m_fMusicSeconds );
return fSecondsTotal; return fSecondsTotal;
+1 -1
View File
@@ -90,7 +90,7 @@ void InputMapper::ReadMappingsFromDisk()
CStringArray sDeviceInputStrings; CStringArray sDeviceInputStrings;
split( value, ",", sDeviceInputStrings, false ); split( value, ",", sDeviceInputStrings, false );
for( int i=0; i<sDeviceInputStrings.GetSize() && i<NUM_GAME_TO_DEVICE_SLOTS; i++ ) for( unsigned i=0; i<sDeviceInputStrings.size() && i<NUM_GAME_TO_DEVICE_SLOTS; i++ )
{ {
DeviceInput DeviceI; DeviceInput DeviceI;
DeviceI.fromString( sDeviceInputStrings[i] ); DeviceI.fromString( sDeviceInputStrings[i] );
+4 -4
View File
@@ -30,8 +30,8 @@ InputQueue::InputQueue()
void InputQueue::RememberInput( const GameInput GameI ) void InputQueue::RememberInput( const GameInput GameI )
{ {
int c = GameI.controller; int c = GameI.controller;
if( m_aQueue[c].GetSize() >= MAX_INPUT_QUEUE_LENGTH ) // full if( m_aQueue[c].size() >= MAX_INPUT_QUEUE_LENGTH ) // full
m_aQueue[c].RemoveAt( 0, m_aQueue[c].GetSize()-MAX_INPUT_QUEUE_LENGTH+1 ); m_aQueue[c].RemoveAt( 0, m_aQueue[c].size()-MAX_INPUT_QUEUE_LENGTH+1 );
m_aQueue[c].Add( GameButtonAndTime(GameI.button,TIMER->GetTimeSinceStart()) ); m_aQueue[c].Add( GameButtonAndTime(GameI.button,TIMER->GetTimeSinceStart()) );
}; };
@@ -43,7 +43,7 @@ bool InputQueue::MatchesPattern( const GameController c, const MenuButton* butto
float fOldestTimeAllowed = TIMER->GetTimeSinceStart() - fMaxSecondsBack; float fOldestTimeAllowed = TIMER->GetTimeSinceStart() - fMaxSecondsBack;
int sequence_index = iNumButtons-1; // count down int sequence_index = iNumButtons-1; // count down
for( int queue_index=m_aQueue[c].GetSize()-1; queue_index>=0; queue_index-- ) // iterate newest to oldest for( int queue_index=m_aQueue[c].size()-1; queue_index>=0; queue_index-- ) // iterate newest to oldest
{ {
GameButtonAndTime BandT = m_aQueue[c][queue_index]; GameButtonAndTime BandT = m_aQueue[c][queue_index];
GameInput GameI( c, BandT.button ); GameInput GameI( c, BandT.button );
@@ -72,7 +72,7 @@ bool InputQueue::MatchesPattern( const GameController c, const GameButton* butto
float fOldestTimeAllowed = TIMER->GetTimeSinceStart() - fMaxSecondsBack; float fOldestTimeAllowed = TIMER->GetTimeSinceStart() - fMaxSecondsBack;
int sequence_index = iNumButtons-1; // count down int sequence_index = iNumButtons-1; // count down
for( int queue_index=m_aQueue[c].GetSize()-1; queue_index>=0; queue_index-- ) // iterate newest to oldest for( int queue_index=m_aQueue[c].size()-1; queue_index>=0; queue_index-- ) // iterate newest to oldest
{ {
GameButtonAndTime BandT = m_aQueue[c][queue_index]; GameButtonAndTime BandT = m_aQueue[c][queue_index];
if( BandT.button != button_sequence[sequence_index] || if( BandT.button != button_sequence[sequence_index] ||
+1 -1
View File
@@ -14,7 +14,7 @@
#include "GameInput.h" #include "GameInput.h"
#include "MenuInput.h" #include "MenuInput.h"
const int MAX_INPUT_QUEUE_LENGTH = 8; const unsigned MAX_INPUT_QUEUE_LENGTH = 8;
class InputQueue class InputQueue
{ {
+2 -2
View File
@@ -124,7 +124,7 @@ void MenuElements::TweenTopLayerOnScreen()
apActorsInTopFrame.Add( &m_sprTopEdge ); apActorsInTopFrame.Add( &m_sprTopEdge );
apActorsInTopFrame.Add( &m_sprStyleIcon ); apActorsInTopFrame.Add( &m_sprStyleIcon );
apActorsInTopFrame.Add( &m_MenuTimer ); apActorsInTopFrame.Add( &m_MenuTimer );
for( int i=0; i<apActorsInTopFrame.GetSize(); i++ ) for( unsigned i=0; i<apActorsInTopFrame.size(); i++ )
{ {
float fOriginalX = apActorsInTopFrame[i]->GetX(); float fOriginalX = apActorsInTopFrame[i]->GetX();
apActorsInTopFrame[i]->SetX( fOriginalX+SCREEN_WIDTH ); apActorsInTopFrame[i]->SetX( fOriginalX+SCREEN_WIDTH );
@@ -162,7 +162,7 @@ void MenuElements::TweenTopLayerOffScreen()
apActorsInTopFrame.Add( &m_sprTopEdge ); apActorsInTopFrame.Add( &m_sprTopEdge );
apActorsInTopFrame.Add( &m_sprStyleIcon ); apActorsInTopFrame.Add( &m_sprStyleIcon );
apActorsInTopFrame.Add( &m_MenuTimer ); apActorsInTopFrame.Add( &m_MenuTimer );
for( int i=0; i<apActorsInTopFrame.GetSize(); i++ ) for( unsigned i=0; i<apActorsInTopFrame.size(); i++ )
{ {
float fOriginalX = apActorsInTopFrame[i]->GetX(); float fOriginalX = apActorsInTopFrame[i]->GetX();
apActorsInTopFrame[i]->BeginTweening( MENU_ELEMENTS_TWEEN_TIME, TWEEN_BOUNCE_BEGIN ); apActorsInTopFrame[i]->BeginTweening( MENU_ELEMENTS_TWEEN_TIME, TWEEN_BOUNCE_BEGIN );
+4 -4
View File
@@ -166,7 +166,7 @@ void NoteField::DrawPrimitives()
if( GAMESTATE->m_bEditing ) if( GAMESTATE->m_bEditing )
{ {
int i; unsigned i;
// //
// Draw measure bars // Draw measure bars
@@ -180,21 +180,21 @@ void NoteField::DrawPrimitives()
// BPM text // BPM text
// //
CArray<BPMSegment,BPMSegment&> &aBPMSegments = GAMESTATE->m_pCurSong->m_BPMSegments; CArray<BPMSegment,BPMSegment&> &aBPMSegments = GAMESTATE->m_pCurSong->m_BPMSegments;
for( i=0; i<aBPMSegments.GetSize(); i++ ) for( i=0; i<aBPMSegments.size(); i++ )
DrawBPMText( aBPMSegments[i].m_fStartBeat, aBPMSegments[i].m_fBPM ); DrawBPMText( aBPMSegments[i].m_fStartBeat, aBPMSegments[i].m_fBPM );
// //
// Freeze text // Freeze text
// //
CArray<StopSegment,StopSegment&> &aStopSegments = GAMESTATE->m_pCurSong->m_StopSegments; CArray<StopSegment,StopSegment&> &aStopSegments = GAMESTATE->m_pCurSong->m_StopSegments;
for( i=0; i<aStopSegments.GetSize(); i++ ) for( i=0; i<aStopSegments.size(); i++ )
DrawFreezeText( aStopSegments[i].m_fStartBeat, aStopSegments[i].m_fStopSeconds ); DrawFreezeText( aStopSegments[i].m_fStartBeat, aStopSegments[i].m_fStopSeconds );
// //
// BGChange text // BGChange text
// //
CArray<BackgroundChange,BackgroundChange&> &aBackgroundChanges = GAMESTATE->m_pCurSong->m_BackgroundChanges; CArray<BackgroundChange,BackgroundChange&> &aBackgroundChanges = GAMESTATE->m_pCurSong->m_BackgroundChanges;
for( i=0; i<aBackgroundChanges.GetSize(); i++ ) for( i=0; i<aBackgroundChanges.size(); i++ )
DrawBGChangeText( aBackgroundChanges[i].m_fStartBeat, aBackgroundChanges[i].m_sBGName ); DrawBGChangeText( aBackgroundChanges[i].m_fStartBeat, aBackgroundChanges[i].m_sBGName );
// //
+5 -5
View File
@@ -306,7 +306,7 @@ bool DWILoader::LoadFromDWIFile( CString sPath, Song &out )
CStringArray arrayFreezeExpressions; CStringArray arrayFreezeExpressions;
split( sParams[1], ",", arrayFreezeExpressions ); split( sParams[1], ",", arrayFreezeExpressions );
for( int f=0; f<arrayFreezeExpressions.GetSize(); f++ ) for( unsigned f=0; f<arrayFreezeExpressions.size(); f++ )
{ {
CStringArray arrayFreezeValues; CStringArray arrayFreezeValues;
split( arrayFreezeExpressions[f], "=", arrayFreezeValues ); split( arrayFreezeExpressions[f], "=", arrayFreezeValues );
@@ -324,11 +324,11 @@ bool DWILoader::LoadFromDWIFile( CString sPath, Song &out )
CStringArray arrayBPMChangeExpressions; CStringArray arrayBPMChangeExpressions;
split( sParams[1], ",", arrayBPMChangeExpressions ); split( sParams[1], ",", arrayBPMChangeExpressions );
for( int b=0; b<arrayBPMChangeExpressions.GetSize(); b++ ) for( unsigned b=0; b<arrayBPMChangeExpressions.size(); b++ )
{ {
CStringArray arrayBPMChangeValues; CStringArray arrayBPMChangeValues;
split( arrayBPMChangeExpressions[b], "=", arrayBPMChangeValues ); split( arrayBPMChangeExpressions[b], "=", arrayBPMChangeValues );
if(arrayBPMChangeValues.GetSize() != 2) { if(arrayBPMChangeValues.size() != 2) {
LOG->Warn( "Invalid CHANGEBPM: '%s'", arrayBPMChangeExpressions[b].GetString()); LOG->Warn( "Invalid CHANGEBPM: '%s'", arrayBPMChangeExpressions[b].GetString());
continue; continue;
} }
@@ -377,12 +377,12 @@ bool DWILoader::LoadFromDir( CString sPath, Song &out )
CStringArray aFileNames; CStringArray aFileNames;
GetApplicableFiles( sPath, aFileNames ); GetApplicableFiles( sPath, aFileNames );
if( aFileNames.GetSize() > 1 ) if( aFileNames.size() > 1 )
throw RageException( "There is more than one DWI file in '%s'. There should be only one!", sPath.GetString() ); throw RageException( "There is more than one DWI file in '%s'. There should be only one!", sPath.GetString() );
/* We should have exactly one; if we had none, we shouldn't have been /* We should have exactly one; if we had none, we shouldn't have been
* called to begin with. */ * called to begin with. */
ASSERT( aFileNames.GetSize() == 1 ); ASSERT( aFileNames.size() == 1 );
return LoadFromDWIFile( sPath + aFileNames[0], out ); return LoadFromDWIFile( sPath + aFileNames[0], out );
} }
+3 -2
View File
@@ -86,7 +86,8 @@ int OptionToPreferredColumn( CString sOptionText )
void OptionIconRow::Refresh( PlayerNumber pn ) void OptionIconRow::Refresh( PlayerNumber pn )
{ {
// init // init
for( int i=0; i<NUM_OPTION_COLS; i++ ) unsigned i;
for( i=0; i<NUM_OPTION_COLS; i++ )
m_OptionIcon[i].Load( pn, "", i==0 ); m_OptionIcon[i].Load( pn, "", i==0 );
CString sOptions = GAMESTATE->m_PlayerOptions[pn].GetString(); CString sOptions = GAMESTATE->m_PlayerOptions[pn].GetString();
@@ -97,7 +98,7 @@ void OptionIconRow::Refresh( PlayerNumber pn )
CString asTabs[NUM_OPTION_COLS-1]; // fill these with what will be displayed on the tabs CString asTabs[NUM_OPTION_COLS-1]; // fill these with what will be displayed on the tabs
// for each option, look for the best column to place it in // for each option, look for the best column to place it in
for( i=0; i<asOptions.GetSize(); i++ ) for( i=0; i<asOptions.size(); i++ )
{ {
CString sOption = asOptions[i]; CString sOption = asOptions[i];
int iPerferredCol = OptionToPreferredColumn( sOption ); int iPerferredCol = OptionToPreferredColumn( sOption );
+1 -1
View File
@@ -17,7 +17,7 @@
struct PlayerOptions; struct PlayerOptions;
const int NUM_OPTION_COLS = 8; const unsigned NUM_OPTION_COLS = 8;
class OptionIconRow : public ActorFrame class OptionIconRow : public ActorFrame
+1 -1
View File
@@ -133,7 +133,7 @@ void PlayerOptions::FromString( CString sOptions )
CStringArray asBits; CStringArray asBits;
split( sOptions, ",", asBits, true ); split( sOptions, ",", asBits, true );
for( int i=0; i<asBits.GetSize(); i++ ) for( unsigned i=0; i<asBits.size(); i++ )
{ {
CString& sBit = asBits[i]; CString& sBit = asBits[i];
sBit.TrimLeft(); sBit.TrimLeft();
+3 -3
View File
@@ -206,7 +206,7 @@ D3DFORMAT RageDisplay::FindBackBufferType(bool bWindowed, int iBPP)
throw RageException( ssprintf("Invalid BPP '%u' specified", iBPP) ); throw RageException( ssprintf("Invalid BPP '%u' specified", iBPP) );
// Test each back buffer format until we find something that works. // Test each back buffer format until we find something that works.
for( int i=0; i < arrayBackBufferFormats.GetSize(); i++ ) for( unsigned i=0; i < arrayBackBufferFormats.size(); i++ )
{ {
D3DFORMAT fmtBackBuffer = arrayBackBufferFormats[i]; D3DFORMAT fmtBackBuffer = arrayBackBufferFormats[i];
@@ -619,12 +619,12 @@ void RageDisplay::ResetMatrixStack()
void RageDisplay::PushMatrix() void RageDisplay::PushMatrix()
{ {
m_MatrixStack.Add( GetTopMatrix() ); m_MatrixStack.Add( GetTopMatrix() );
ASSERT(m_MatrixStack.GetSize()<20); // check for infinite loop ASSERT(m_MatrixStack.size()<20); // check for infinite loop
} }
void RageDisplay::PopMatrix() void RageDisplay::PopMatrix()
{ {
m_MatrixStack.RemoveAt( m_MatrixStack.GetSize()-1 ); m_MatrixStack.RemoveAt( m_MatrixStack.size()-1 );
} }
void RageDisplay::Translate( float x, float y, float z ) void RageDisplay::Translate( float x, float y, float z )
+1 -1
View File
@@ -264,7 +264,7 @@ bool DeviceInput::fromString( const CString &s )
CStringArray a; CStringArray a;
split( s, "-", a); split( s, "-", a);
if( a.GetSize() != 2 ) { if( a.size() != 2 ) {
device = DEVICE_NONE; device = DEVICE_NONE;
return false; return false;
} }
+1 -1
View File
@@ -301,7 +301,7 @@ RageMovieTexture::RageMovieTexture(
CreateFrameRects(); CreateFrameRects();
// flip all frame rects because movies are upside down // flip all frame rects because movies are upside down
for( int i=0; i<m_TextureCoordRects.GetSize(); i++ ) for( unsigned i=0; i<m_TextureCoordRects.size(); i++ )
{ {
float fTemp = m_TextureCoordRects[i].top; float fTemp = m_TextureCoordRects[i].top;
m_TextureCoordRects[i].top = m_TextureCoordRects[i].bottom; m_TextureCoordRects[i].top = m_TextureCoordRects[i].bottom;
+2 -2
View File
@@ -117,9 +117,9 @@ void RageSound::PlayOnceStreamedFromDir( CString sDir )
GetDirListing( sDir + "*.wav", arraySoundFiles ); GetDirListing( sDir + "*.wav", arraySoundFiles );
GetDirListing( sDir + "*.ogg", arraySoundFiles ); GetDirListing( sDir + "*.ogg", arraySoundFiles );
if( arraySoundFiles.GetSize() != 0 ) if( !arraySoundFiles.empty() )
{ {
int index = rand() % arraySoundFiles.GetSize(); int index = rand() % arraySoundFiles.size();
PlayOnceStreamed( sDir + arraySoundFiles[index] ); PlayOnceStreamed( sDir + arraySoundFiles[index] );
} }
} }
+2 -2
View File
@@ -90,7 +90,7 @@ void RageTexture::GetFrameDimensionsFromFileName( CString sPath, int* piFramesWi
CStringArray arrayBits; CStringArray arrayBits;
split( sFName, " ", arrayBits, false ); split( sFName, " ", arrayBits, false );
for( int i=0; i<arrayBits.GetSize(); i++ ) for( unsigned i=0; i<arrayBits.size(); i++ )
{ {
CString &sBit = arrayBits[ i ]; CString &sBit = arrayBits[ i ];
@@ -99,7 +99,7 @@ void RageTexture::GetFrameDimensionsFromFileName( CString sPath, int* piFramesWi
CStringArray arrayDimensionsBits; CStringArray arrayDimensionsBits;
split( sBit, "x", arrayDimensionsBits, false ); split( sBit, "x", arrayDimensionsBits, false );
if( arrayDimensionsBits.GetSize() != 2 ) if( arrayDimensionsBits.size() != 2 )
continue; continue;
else if( !IsAnInt(arrayDimensionsBits[0]) || !IsAnInt(arrayDimensionsBits[1]) ) else if( !IsAnInt(arrayDimensionsBits[0]) || !IsAnInt(arrayDimensionsBits[1]) )
continue; continue;
+4 -4
View File
@@ -24,7 +24,7 @@ RandomSample::RandomSample()
RandomSample::~RandomSample() RandomSample::~RandomSample()
{ {
for( int i=0; i<m_pSamples.GetSize(); i++ ) for( unsigned i=0; i<m_pSamples.size(); i++ )
SAFE_DELETE( m_pSamples[i] ); SAFE_DELETE( m_pSamples[i] );
} }
@@ -43,7 +43,7 @@ bool RandomSample::LoadSoundDir( CString sDir )
GetDirListing( sDir + "*.ogg", arraySoundFiles ); GetDirListing( sDir + "*.ogg", arraySoundFiles );
GetDirListing( sDir + "*.wav", arraySoundFiles ); GetDirListing( sDir + "*.wav", arraySoundFiles );
for( int i=0; i<arraySoundFiles.GetSize(); i++ ) for( unsigned i=0; i<arraySoundFiles.size(); i++ )
LoadSound( sDir + arraySoundFiles[i] ); LoadSound( sDir + arraySoundFiles[i] );
return true; return true;
@@ -65,7 +65,7 @@ bool RandomSample::LoadSound( CString sSoundFilePath )
void RandomSample::PlayRandom() void RandomSample::PlayRandom()
{ {
// play one of the samples // play one of the samples
if( m_pSamples.GetSize() == 0 ) if( m_pSamples.empty() )
{ {
LOG->Trace( "WARNING: Tried to play a RandomSample that has 0 sounds loaded." ); LOG->Trace( "WARNING: Tried to play a RandomSample that has 0 sounds loaded." );
return; return;
@@ -74,7 +74,7 @@ void RandomSample::PlayRandom()
int iIndexToPlay = 0; int iIndexToPlay = 0;
for( int i=0; i<5; i++ ) for( int i=0; i<5; i++ )
{ {
iIndexToPlay = rand() % m_pSamples.GetSize(); iIndexToPlay = rand() % m_pSamples.size();
if( iIndexToPlay != m_iIndexLastPlayed ) if( iIndexToPlay != m_iIndexLastPlayed )
break; break;
} }
+5 -8
View File
@@ -129,14 +129,14 @@ const CString CREDIT_LINES[] =
"", "",
"Please, join the StepMania team and help us out!", "Please, join the StepMania team and help us out!",
}; };
const int NUM_CREDIT_LINES = sizeof(CREDIT_LINES) / sizeof(CString); const unsigned NUM_CREDIT_LINES = sizeof(CREDIT_LINES) / sizeof(CString);
ScreenMusicScroll::ScreenMusicScroll() ScreenMusicScroll::ScreenMusicScroll()
{ {
LOG->Trace( "ScreenMusicScroll::ScreenMusicScroll()" ); LOG->Trace( "ScreenMusicScroll::ScreenMusicScroll()" );
int i; unsigned i;
GAMESTATE->Reset(); // so that credits message for both players will show GAMESTATE->Reset(); // so that credits message for both players will show
@@ -149,7 +149,7 @@ ScreenMusicScroll::ScreenMusicScroll()
m_iNumLines = 0; m_iNumLines = 0;
for( i=0; i<min(arraySongs.GetSize(), MAX_MUSIC_LINES); i++ ) for( i=0; i<min(arraySongs.size(), MAX_MUSIC_LINES); i++ )
{ {
Song* pSong = arraySongs[i]; Song* pSong = arraySongs[i];
m_textLines[m_iNumLines].LoadFromFont( THEME->GetPathTo("Fonts","music scroll") ); m_textLines[m_iNumLines].LoadFromFont( THEME->GetPathTo("Fonts","music scroll") );
@@ -193,19 +193,16 @@ void ScreenMusicScroll::Update( float fDeltaTime )
{ {
Screen::Update( fDeltaTime ); Screen::Update( fDeltaTime );
for( int i=0; i<m_iNumLines; i++ ) for( unsigned i=0; i<m_iNumLines; i++ )
{
m_textLines[i].Update( fDeltaTime ); m_textLines[i].Update( fDeltaTime );
} }
}
void ScreenMusicScroll::DrawPrimitives() void ScreenMusicScroll::DrawPrimitives()
{ {
Screen::DrawPrimitives(); Screen::DrawPrimitives();
for( int i=0; i<m_iNumLines; i++ ) for( unsigned i=0; i<m_iNumLines; i++ )
{ {
if( m_textLines[i].GetY() > SCREEN_TOP-20 && if( m_textLines[i].GetY() > SCREEN_TOP-20 &&
m_textLines[i].GetY() < SCREEN_BOTTOM+20 ) m_textLines[i].GetY() < SCREEN_BOTTOM+20 )
+4 -4
View File
@@ -17,9 +17,9 @@
#include "MenuElements.h" #include "MenuElements.h"
const int MAX_MUSIC_LINES = 1200; const unsigned MAX_MUSIC_LINES = 1200;
const int MAX_CREDIT_LINES = 100; const unsigned MAX_CREDIT_LINES = 100;
const int MAX_TOTAL_LINES = MAX_MUSIC_LINES + MAX_CREDIT_LINES; const unsigned MAX_TOTAL_LINES = MAX_MUSIC_LINES + MAX_CREDIT_LINES;
class ScreenMusicScroll : public Screen class ScreenMusicScroll : public Screen
@@ -40,7 +40,7 @@ private:
BGAnimation m_Background; BGAnimation m_Background;
BitmapText m_textLines[MAX_TOTAL_LINES]; BitmapText m_textLines[MAX_TOTAL_LINES];
int m_iNumLines; unsigned m_iNumLines;
float m_fTimeLeftInScreen; float m_fTimeLeftInScreen;
TransitionFade m_Fade; TransitionFade m_Fade;
+2 -2
View File
@@ -455,9 +455,9 @@ void ScreenSelectDifficulty::MenuBack( PlayerNumber pn )
void ScreenSelectDifficulty::TweenOffScreen() void ScreenSelectDifficulty::TweenOffScreen()
{ {
int p; unsigned p;
for( p=0; p < m_SubActors.GetSize(); p++ ) for( p=0; p < m_SubActors.size(); p++ )
m_SubActors[p]->StopTweening(); m_SubActors[p]->StopTweening();
for( p=0; p<NUM_PAGES; p++ ) for( p=0; p<NUM_PAGES; p++ )
+4 -4
View File
@@ -18,10 +18,10 @@
#include "RandomSample.h" #include "RandomSample.h"
const int NUM_ITEMS_ON_PAGE_1 = 3; // easy, medium, hard, const unsigned NUM_ITEMS_ON_PAGE_1 = 3; // easy, medium, hard,
const int NUM_ITEMS_ON_PAGE_2 = 2; // Oni, Endless const unsigned NUM_ITEMS_ON_PAGE_2 = 2; // Oni, Endless
const int NUM_DIFFICULTY_ITEMS = NUM_ITEMS_ON_PAGE_1 + NUM_ITEMS_ON_PAGE_2; const unsigned NUM_DIFFICULTY_ITEMS = NUM_ITEMS_ON_PAGE_1 + NUM_ITEMS_ON_PAGE_2;
const int NUM_PAGES = 2; // easy-medium-hard, Oni const unsigned NUM_PAGES = 2; // easy-medium-hard, Oni
class ScreenSelectDifficulty : public Screen class ScreenSelectDifficulty : public Screen
{ {
+3 -3
View File
@@ -43,7 +43,7 @@ ScreenSelectGame::ScreenSelectGame() :
/* populate g_SelectGameLines */ /* populate g_SelectGameLines */
CArray<Game,Game> aGames; CArray<Game,Game> aGames;
GAMEMAN->GetEnabledGames( aGames ); GAMEMAN->GetEnabledGames( aGames );
for( int i=0; i<aGames.GetSize(); i++ ) for( unsigned i=0; i<aGames.size(); i++ )
{ {
Game game = aGames[i]; Game game = aGames[i];
CString sGameName = GAMEMAN->GetGameDefForGame(game)->m_szName; CString sGameName = GAMEMAN->GetGameDefForGame(game)->m_szName;
@@ -70,10 +70,10 @@ void ScreenSelectGame::ImportOptions()
* note skins; reset it to the first available. */ * note skins; reset it to the first available. */
CArray<Game,Game> aGames; CArray<Game,Game> aGames;
GAMEMAN->GetEnabledGames( aGames ); GAMEMAN->GetEnabledGames( aGames );
ASSERT(aGames.GetSize()); ASSERT(!aGames.empty());
m_iSelectedOption[0][SG_GAME] = 0; m_iSelectedOption[0][SG_GAME] = 0;
for(int sel = 0; sel < aGames.GetSize(); ++sel) for(unsigned sel = 0; sel < aGames.size(); ++sel)
if(aGames[sel] == GAMESTATE->m_CurGame) m_iSelectedOption[0][SG_GAME] = sel; if(aGames[sel] == GAMESTATE->m_CurGame) m_iSelectedOption[0][SG_GAME] = sel;
} }
+11 -14
View File
@@ -302,15 +302,14 @@ void ScreenSelectMusic::TweenOnScreen()
void ScreenSelectMusic::TweenOffScreen() void ScreenSelectMusic::TweenOffScreen()
{ {
int i;
m_sprBannerFrame.FadeOff( 0, "bounce left", TWEEN_TIME*2 ); m_sprBannerFrame.FadeOff( 0, "bounce left", TWEEN_TIME*2 );
m_Banner.FadeOff( 0, "bounce left", TWEEN_TIME*2 ); m_Banner.FadeOff( 0, "bounce left", TWEEN_TIME*2 );
m_BPMDisplay.FadeOff( 0, "bounce left", TWEEN_TIME*2 ); m_BPMDisplay.FadeOff( 0, "bounce left", TWEEN_TIME*2 );
m_textStage.FadeOff( 0, "bounce left", TWEEN_TIME*2 ); m_textStage.FadeOff( 0, "bounce left", TWEEN_TIME*2 );
m_sprCDTitle.FadeOff( 0, "bounce left", TWEEN_TIME*2 ); m_sprCDTitle.FadeOff( 0, "bounce left", TWEEN_TIME*2 );
for( int p=0; p<NUM_PLAYERS; p++ ) int p;
for( p=0; p<NUM_PLAYERS; p++ )
{ {
m_sprDifficultyFrame[p].FadeOff( 0, "fade", TWEEN_TIME ); m_sprDifficultyFrame[p].FadeOff( 0, "fade", TWEEN_TIME );
m_sprMeterFrame[p].FadeOff( 0, "fade", TWEEN_TIME ); m_sprMeterFrame[p].FadeOff( 0, "fade", TWEEN_TIME );
@@ -339,7 +338,7 @@ void ScreenSelectMusic::TweenOffScreen()
apActorsInScore.Add( &m_sprHighScoreFrame[p] ); apActorsInScore.Add( &m_sprHighScoreFrame[p] );
apActorsInScore.Add( &m_HighScore[p] ); apActorsInScore.Add( &m_HighScore[p] );
} }
for( i=0; i<apActorsInScore.GetSize(); i++ ) for( unsigned i=0; i<apActorsInScore.size(); i++ )
{ {
apActorsInScore[i]->BeginTweening( TWEEN_TIME, TWEEN_BIAS_END ); apActorsInScore[i]->BeginTweening( TWEEN_TIME, TWEEN_BIAS_END );
apActorsInScore[i]->SetTweenX( SCORE_CONNECTED_TO_MUSIC_WHEEL ? apActorsInScore[i]->GetX()+400 : apActorsInScore[i]->GetX()-400 ); apActorsInScore[i]->SetTweenX( SCORE_CONNECTED_TO_MUSIC_WHEEL ? apActorsInScore[i]->GetX()+400 : apActorsInScore[i]->GetX()-400 );
@@ -359,7 +358,7 @@ void ScreenSelectMusic::TweenScoreOnAndOffAfterChangeSort()
apActorsInScore.Add( &m_sprHighScoreFrame[p] ); apActorsInScore.Add( &m_sprHighScoreFrame[p] );
apActorsInScore.Add( &m_HighScore[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(); apActorsInScore[i]->StopTweening();
@@ -465,7 +464,7 @@ void ScreenSelectMusic::EasierDifficulty( PlayerNumber pn )
if( !GAMESTATE->IsPlayerEnabled(pn) ) if( !GAMESTATE->IsPlayerEnabled(pn) )
return; return;
if( m_arrayNotes[pn].GetSize() == 0 ) if( m_arrayNotes[pn].empty() )
return; return;
if( m_iSelection[pn] == 0 ) if( m_iSelection[pn] == 0 )
return; return;
@@ -485,9 +484,9 @@ void ScreenSelectMusic::HarderDifficulty( PlayerNumber pn )
if( !GAMESTATE->IsPlayerEnabled(pn) ) if( !GAMESTATE->IsPlayerEnabled(pn) )
return; return;
if( m_arrayNotes[pn].GetSize() == 0 ) if( m_arrayNotes[pn].empty() )
return; return;
if( m_iSelection[pn] == m_arrayNotes[pn].GetSize()-1 ) if( m_iSelection[pn] == int(m_arrayNotes[pn].size()-1) )
return; return;
m_iSelection[pn]++; m_iSelection[pn]++;
@@ -673,9 +672,9 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn )
if( !GAMESTATE->IsPlayerEnabled(pn) ) if( !GAMESTATE->IsPlayerEnabled(pn) )
return; return;
m_iSelection[pn] = clamp( m_iSelection[pn], 0, m_arrayNotes[pn].GetSize()-1 ); // bounds clamping m_iSelection[pn] = clamp( m_iSelection[pn], 0, int(m_arrayNotes[pn].size()-1) ); // bounds clamping
Notes* pNotes = m_arrayNotes[pn].GetSize()>0 ? m_arrayNotes[pn][m_iSelection[pn]] : NULL; Notes* pNotes = m_arrayNotes[pn].empty()? NULL: m_arrayNotes[pn][m_iSelection[pn]];
GAMESTATE->m_pCurNotes[pn] = pNotes; GAMESTATE->m_pCurNotes[pn] = pNotes;
@@ -711,9 +710,7 @@ void ScreenSelectMusic::AfterMusicChange()
{ {
CString sGroup = m_MusicWheel.GetSelectedSection(); CString sGroup = m_MusicWheel.GetSelectedSection();
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{
m_iSelection[p] = -1; m_iSelection[p] = -1;
}
m_Banner.SetFromGroup( sGroup ); // if this isn't a group, it'll default to the fallback banner m_Banner.SetFromGroup( sGroup ); // if this isn't a group, it'll default to the fallback banner
m_BPMDisplay.SetBPMRange( 0, 0 ); m_BPMDisplay.SetBPMRange( 0, 0 );
@@ -744,7 +741,7 @@ void ScreenSelectMusic::AfterMusicChange()
{ {
if( !GAMESTATE->IsPlayerEnabled( PlayerNumber(p) ) ) if( !GAMESTATE->IsPlayerEnabled( PlayerNumber(p) ) )
continue; continue;
for( int i=0; i<m_arrayNotes[p].GetSize(); i++ ) for( unsigned i=0; i<m_arrayNotes[p].size(); i++ )
{ {
if( m_arrayNotes[p][i]->m_Difficulty == GAMESTATE->m_PreferredDifficulty[p] ) if( m_arrayNotes[p][i]->m_Difficulty == GAMESTATE->m_PreferredDifficulty[p] )
{ {
@@ -753,7 +750,7 @@ void ScreenSelectMusic::AfterMusicChange()
} }
} }
m_iSelection[p] = clamp( m_iSelection[p], 0, m_arrayNotes[p].GetSize() ) ; m_iSelection[p] = clamp( m_iSelection[p], 0, int(m_arrayNotes[p].size()) ) ;
} }
} }
break; break;
+2 -2
View File
@@ -127,7 +127,7 @@ ScreenTitleMenu::ScreenTitleMenu()
m_textSongs.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); m_textSongs.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
m_textSongs.SetHorizAlign( Actor::align_left ); m_textSongs.SetHorizAlign( Actor::align_left );
m_textSongs.SetText( ssprintf("Found %d Songs", SONGMAN->m_pSongs.GetSize()) ); m_textSongs.SetText( ssprintf("Found %u Songs", SONGMAN->m_pSongs.size()) );
m_textSongs.SetDiffuse( RageColor(0.6f,0.6f,0.6f,1) ); // light gray m_textSongs.SetDiffuse( RageColor(0.6f,0.6f,0.6f,1) ); // light gray
m_textSongs.SetXY( SONGS_X, SONGS_Y ); m_textSongs.SetXY( SONGS_X, SONGS_Y );
m_textSongs.SetZoom( 0.5f ); m_textSongs.SetZoom( 0.5f );
@@ -365,7 +365,7 @@ void ScreenTitleMenu::MenuStart( PlayerNumber pn )
m_Fade.CloseWipingRight( SM_GoToNextScreen ); m_Fade.CloseWipingRight( SM_GoToNextScreen );
break; break;
case CHOICE_EDIT: case CHOICE_EDIT:
if( SONGMAN->m_pSongs.GetSize() == 0 ) if( SONGMAN->m_pSongs.empty() )
{ {
m_soundInvalid.PlayRandom(); m_soundInvalid.PlayRandom();
} }
+1 -1
View File
@@ -67,7 +67,7 @@ void SongOptions::FromString( CString sOptions )
CStringArray asBits; CStringArray asBits;
split( sOptions, ",", asBits, true ); split( sOptions, ",", asBits, true );
for( int i=0; i<asBits.GetSize(); i++ ) for( unsigned i=0; i<asBits.size(); i++ )
{ {
CString& sBit = asBits[i]; CString& sBit = asBits[i];
sBit.TrimLeft(); sBit.TrimLeft();