diff --git a/src/Actor.cpp b/src/Actor.cpp index 52dfa4507b..66cd3a7191 100644 --- a/src/Actor.cpp +++ b/src/Actor.cpp @@ -1131,7 +1131,7 @@ void Actor::ResetEffectTimeIfDifferent(Effect new_effect) } } -void Actor::SetEffectDiffuseBlink( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +void Actor::SetEffectDiffuseBlink( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 ) { ASSERT( fEffectPeriodSeconds > 0 ); // todo: account for SSC_FUTURES -aj @@ -1141,7 +1141,7 @@ void Actor::SetEffectDiffuseBlink( float fEffectPeriodSeconds, RageColor c1, Rag m_effectColor2 = c2; } -void Actor::SetEffectDiffuseShift( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +void Actor::SetEffectDiffuseShift( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 ) { ASSERT( fEffectPeriodSeconds > 0 ); // todo: account for SSC_FUTURES -aj @@ -1151,7 +1151,7 @@ void Actor::SetEffectDiffuseShift( float fEffectPeriodSeconds, RageColor c1, Rag m_effectColor2 = c2; } -void Actor::SetEffectDiffuseRamp( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +void Actor::SetEffectDiffuseRamp( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 ) { ASSERT( fEffectPeriodSeconds > 0 ); // todo: account for SSC_FUTURES -aj @@ -1161,7 +1161,7 @@ void Actor::SetEffectDiffuseRamp( float fEffectPeriodSeconds, RageColor c1, Rage m_effectColor2 = c2; } -void Actor::SetEffectGlowBlink( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +void Actor::SetEffectGlowBlink( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 ) { ASSERT( fEffectPeriodSeconds > 0 ); // todo: account for SSC_FUTURES -aj @@ -1171,7 +1171,7 @@ void Actor::SetEffectGlowBlink( float fEffectPeriodSeconds, RageColor c1, RageCo m_effectColor2 = c2; } -void Actor::SetEffectGlowShift( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +void Actor::SetEffectGlowShift( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 ) { ASSERT( fEffectPeriodSeconds > 0 ); // todo: account for SSC_FUTURES -aj @@ -1181,7 +1181,7 @@ void Actor::SetEffectGlowShift( float fEffectPeriodSeconds, RageColor c1, RageCo m_effectColor2 = c2; } -void Actor::SetEffectGlowRamp( float fEffectPeriodSeconds, RageColor c1, RageColor c2 ) +void Actor::SetEffectGlowRamp( float fEffectPeriodSeconds, const RageColor &c1, const RageColor &c2 ) { ASSERT( fEffectPeriodSeconds > 0 ); // todo: account for SSC_FUTURES -aj @@ -1199,7 +1199,7 @@ void Actor::SetEffectRainbow( float fEffectPeriodSeconds ) SetEffectPeriod( fEffectPeriodSeconds ); } -void Actor::SetEffectWag( float fPeriod, RageVector3 vect ) +void Actor::SetEffectWag( float fPeriod, const RageVector3 &vect ) { ASSERT( fPeriod > 0 ); // todo: account for SSC_FUTURES -aj @@ -1208,7 +1208,7 @@ void Actor::SetEffectWag( float fPeriod, RageVector3 vect ) m_vEffectMagnitude = vect; } -void Actor::SetEffectBounce( float fPeriod, RageVector3 vect ) +void Actor::SetEffectBounce( float fPeriod, const RageVector3 &vect ) { ASSERT( fPeriod > 0 ); // todo: account for SSC_FUTURES -aj @@ -1218,7 +1218,7 @@ void Actor::SetEffectBounce( float fPeriod, RageVector3 vect ) m_fSecsIntoEffect = 0; } -void Actor::SetEffectBob( float fPeriod, RageVector3 vect ) +void Actor::SetEffectBob( float fPeriod, const RageVector3 &vect ) { ASSERT( fPeriod > 0 ); // todo: account for SSC_FUTURES -aj @@ -1231,14 +1231,14 @@ void Actor::SetEffectBob( float fPeriod, RageVector3 vect ) m_vEffectMagnitude = vect; } -void Actor::SetEffectSpin( RageVector3 vect ) +void Actor::SetEffectSpin( const RageVector3 &vect ) { // todo: account for SSC_FUTURES -aj m_Effect = spin; m_vEffectMagnitude = vect; } -void Actor::SetEffectVibrate( RageVector3 vect ) +void Actor::SetEffectVibrate( const RageVector3 &vect ) { // todo: account for SSC_FUTURES -aj m_Effect = vibrate; @@ -1325,7 +1325,7 @@ float Actor::GetTweenTimeLeft() const * we can simply say eg. "for x in states(Actor) do x.SetDiffuseColor(c) end". * However, we'd then have to give every TweenState a userdata in Lua while it's * being manipulated, which would add overhead ... */ -void Actor::SetGlobalDiffuseColor( RageColor c ) +void Actor::SetGlobalDiffuseColor( const RageColor &c ) { for( int i=0; iGetID() == ID ) @@ -204,7 +204,7 @@ void ActorMultiVertex::SetVertexPos( int index, float x, float y, float z ) AMV_DestTweenState().vertices[index].p = RageVector3( x, y, z ); } -void ActorMultiVertex::SetVertexColor( int index, RageColor c ) +void ActorMultiVertex::SetVertexColor( int index, const RageColor &c ) { AMV_DestTweenState().vertices[index].c = c; } diff --git a/src/ActorMultiVertex.h b/src/ActorMultiVertex.h index f0c0fc6b93..6c3285b492 100644 --- a/src/ActorMultiVertex.h +++ b/src/ActorMultiVertex.h @@ -84,7 +84,7 @@ class ActorMultiVertex: public Actor void SetTexture( RageTexture *Texture ); RageTexture* GetTexture() { return _Texture; }; - void LoadFromTexture( RageTextureID ID ); + void LoadFromTexture( const RageTextureID &ID ); void UnloadTexture(); void SetNumVertices( size_t n ); @@ -107,7 +107,7 @@ class ActorMultiVertex: public Actor size_t GetNumVertices() { return AMV_DestTweenState().vertices.size(); } void SetVertexPos( int index , float x , float y , float z ); - void SetVertexColor( int index , RageColor c ); + void SetVertexColor( int index , const RageColor &c ); void SetVertexCoords( int index , float TexCoordX , float TexCoordY ); inline void SetVertsFromSplinesInternal(size_t num_splines, size_t start_vert); diff --git a/src/AnnouncerManager.cpp b/src/AnnouncerManager.cpp index 7d5576e2ec..18ba0bfaa2 100644 --- a/src/AnnouncerManager.cpp +++ b/src/AnnouncerManager.cpp @@ -42,7 +42,7 @@ void AnnouncerManager::GetAnnouncerNames( vector& AddTo ) AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 ); } -bool AnnouncerManager::DoesAnnouncerExist( RString sAnnouncerName ) +bool AnnouncerManager::DoesAnnouncerExist( const RString &sAnnouncerName ) { if( sAnnouncerName == "" ) return true; @@ -55,12 +55,12 @@ bool AnnouncerManager::DoesAnnouncerExist( RString sAnnouncerName ) return false; } -RString AnnouncerManager::GetAnnouncerDirFromName( RString sAnnouncerName ) +RString AnnouncerManager::GetAnnouncerDirFromName( const RString &sAnnouncerName ) { return ANNOUNCERS_DIR + sAnnouncerName + "/"; } -void AnnouncerManager::SwitchAnnouncer( RString sNewAnnouncerName ) +void AnnouncerManager::SwitchAnnouncer( const RString &sNewAnnouncerName ) { if( !DoesAnnouncerExist(sNewAnnouncerName) ) m_sCurAnnouncerName = ""; @@ -108,7 +108,7 @@ static const char *aliases[][2] = { * then all aliases above. Ignore directories that are empty, since we might * have "select difficulty intro" with sounds and an empty "ScreenSelectDifficulty * intro". */ -RString AnnouncerManager::GetPathTo( RString sAnnouncerName, RString sFolderName ) +RString AnnouncerManager::GetPathTo( const RString &sAnnouncerName, const RString &sFolderName ) { if(sAnnouncerName == "") return RString(); /* announcer disabled */ @@ -142,12 +142,12 @@ RString AnnouncerManager::GetPathTo( RString sAnnouncerName, RString sFolderName return RString(); } -RString AnnouncerManager::GetPathTo( RString sFolderName ) +RString AnnouncerManager::GetPathTo( const RString &sFolderName ) { return GetPathTo(m_sCurAnnouncerName, sFolderName); } -bool AnnouncerManager::HasSoundsFor( RString sFolderName ) +bool AnnouncerManager::HasSoundsFor( const RString &sFolderName ) { return !DirectoryIsEmpty( GetPathTo(sFolderName) ); } diff --git a/src/AnnouncerManager.h b/src/AnnouncerManager.h index 645acbff55..369f237dad 100644 --- a/src/AnnouncerManager.h +++ b/src/AnnouncerManager.h @@ -17,26 +17,26 @@ class AnnouncerManager * @brief Determine if the specified announcer exists. * @param sAnnouncerName the announcer we're checking for. * @return true if it exists, false otherwise. */ - bool DoesAnnouncerExist( RString sAnnouncerName ); + bool DoesAnnouncerExist( const RString &sAnnouncerName ); /** * @brief Switch to a new specified announcer. * @param sNewAnnouncerName the new announcer the Player will be listening to. */ - void SwitchAnnouncer( RString sNewAnnouncerName ); + void SwitchAnnouncer( const RString &sNewAnnouncerName ); /** * @brief Retrieve the current announcer's name. * @return the current announcer's name. */ RString GetCurAnnouncerName() const { return m_sCurAnnouncerName; }; void NextAnnouncer(); - RString GetPathTo( RString sFolderName ); - bool HasSoundsFor( RString sFolderName ); + RString GetPathTo( const RString &sFolderName ); + bool HasSoundsFor( const RString &sFolderName ); // Lua void PushSelf( lua_State *L ); protected: - static RString GetAnnouncerDirFromName( RString sAnnouncerName ); - RString GetPathTo( RString AnnouncerPath, RString sFolderName ); + static RString GetAnnouncerDirFromName( const RString &sAnnouncerName ); + RString GetPathTo( const RString &AnnouncerPath, const RString &sFolderName ); /** @brief the current announcer's name. */ RString m_sCurAnnouncerName; }; diff --git a/src/BackgroundUtil.h b/src/BackgroundUtil.h index 4858019e5f..3450d736d5 100644 --- a/src/BackgroundUtil.h +++ b/src/BackgroundUtil.h @@ -37,7 +37,7 @@ struct BackgroundDef * @param effect the intended effect. * @param f1 the primary filename for the definition. * @param f2 the secondary filename (optional). */ - BackgroundDef(RString effect, RString f1, RString f2): + BackgroundDef(const RString &effect, const RString &f1, const RString &f2): m_sEffect(effect), m_sFile1(f1), m_sFile2(f2), m_sColor1(""), m_sColor2("") {} }; diff --git a/src/Banner.cpp b/src/Banner.cpp index 0e7ff1b8de..780596a29f 100644 --- a/src/Banner.cpp +++ b/src/Banner.cpp @@ -122,7 +122,7 @@ void Banner::LoadMode() m_bScrolling = (bool)SCROLL_MODE; } -void Banner::LoadFromSongGroup( RString sSongGroup ) +void Banner::LoadFromSongGroup( const RString &sSongGroup ) { RString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup ); if( sGroupBannerPath != "" ) Load( sGroupBannerPath ); diff --git a/src/Banner.h b/src/Banner.h index 527eff5ac0..127822632a 100644 --- a/src/Banner.h +++ b/src/Banner.h @@ -20,7 +20,7 @@ class Banner : public Sprite virtual Banner *Copy() const; void Load( RageTextureID ID, bool bIsBanner ); - virtual void Load( RageTextureID ID ) { Load( ID, true ); } + virtual void Load( const RageTextureID &ID ) { Load( ID, true ); } void LoadFromCachedBanner( const RString &sPath ); virtual void Update( float fDeltaTime ); @@ -31,7 +31,7 @@ class Banner : public Sprite */ void LoadFromSong( Song* pSong ); void LoadMode(); - void LoadFromSongGroup( RString sSongGroup ); + void LoadFromSongGroup( const RString &sSongGroup ); void LoadFromCourse( const Course *pCourse ); void LoadCardFromCharacter( const Character *pCharacter ); void LoadIconFromCharacter( const Character *pCharacter ); diff --git a/src/BannerCache.cpp b/src/BannerCache.cpp index e7dad900eb..5a22b9b18c 100644 --- a/src/BannerCache.cpp +++ b/src/BannerCache.cpp @@ -53,7 +53,7 @@ BannerCache *BANNERCACHE; // global and accessible from anywhere in our program static map g_BannerPathToImage; static int g_iDemandRefcount = 0; -RString BannerCache::GetBannerCachePath( RString sBannerPath ) +RString BannerCache::GetBannerCachePath( const RString &sBannerPath ) { return SongCacheIndex::GetCacheFilePath( "Banners", sBannerPath ); } @@ -105,7 +105,7 @@ void BannerCache::Undemand() * the cache file if necessary. Unlike CacheBanner(), the original file will * not be examined unless the cached banner doesn't exist, so the banner will * not be updated if the original file changes, for efficiency. */ -void BannerCache::LoadBanner( RString sBannerPath ) +void BannerCache::LoadBanner( const RString &sBannerPath ) { if( sBannerPath == "" ) return; // nothing to do @@ -265,7 +265,7 @@ struct BannerTexture: public RageTexture }; /* If a banner is cached, get its ID for use. */ -RageTextureID BannerCache::LoadCachedBanner( RString sBannerPath ) +RageTextureID BannerCache::LoadCachedBanner( const RString &sBannerPath ) { RageTextureID ID( GetBannerCachePath(sBannerPath) ); @@ -328,7 +328,7 @@ static inline int closest( int num, int n1, int n2 ) /* Create or update the banner cache file as necessary. If in preload mode, * load the cache file, too. (This is done at startup.) */ -void BannerCache::CacheBanner( RString sBannerPath ) +void BannerCache::CacheBanner( const RString &sBannerPath ) { if( PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_PRELOAD && PREFSMAN->m_BannerCache != BNCACHE_LOW_RES_LOAD_ON_DEMAND ) @@ -367,7 +367,7 @@ void BannerCache::CacheBanner( RString sBannerPath ) CacheBannerInternal( sBannerPath ); } -void BannerCache::CacheBannerInternal( RString sBannerPath ) +void BannerCache::CacheBannerInternal( const RString &sBannerPath ) { RString sError; RageSurface *pImage = RageSurfaceUtils::LoadFile( sBannerPath, sError ); diff --git a/src/BannerCache.h b/src/BannerCache.h index aa04b6adfc..3fed272995 100644 --- a/src/BannerCache.h +++ b/src/BannerCache.h @@ -14,9 +14,9 @@ class BannerCache ~BannerCache(); void ReadFromDisk(); - RageTextureID LoadCachedBanner( RString sBannerPath ); - void CacheBanner( RString sBannerPath ); - void LoadBanner( RString sBannerPath ); + RageTextureID LoadCachedBanner( const RString &sBannerPath ); + void CacheBanner( const RString &sBannerPath ); + void LoadBanner( const RString &sBannerPath ); void Demand(); void Undemand(); @@ -24,9 +24,9 @@ class BannerCache void OutputStats() const; private: - static RString GetBannerCachePath( RString sBannerPath ); + static RString GetBannerCachePath( const RString &sBannerPath ); void UnloadAllBanners(); - void CacheBannerInternal( RString sBannerPath ); + void CacheBannerInternal( const RString &sBannerPath ); IniFile BannerData; }; diff --git a/src/BitmapText.h b/src/BitmapText.h index 802f4594fe..d6cbefce2a 100644 --- a/src/BitmapText.h +++ b/src/BitmapText.h @@ -78,9 +78,9 @@ class BitmapText : public Actor void SetHorizAlign( float f ); - void SetStrokeColor(RageColor c) { BMT_DestTweenState().SetStrokeColor(c); } + void SetStrokeColor(const RageColor &c) { BMT_DestTweenState().SetStrokeColor(c); } RageColor const& GetStrokeColor() { return BMT_DestTweenState().GetStrokeColor(); } - void SetCurrStrokeColor(RageColor c) { BMT_current.SetStrokeColor(c); } + void SetCurrStrokeColor(const RageColor &c) { BMT_current.SetStrokeColor(c); } RageColor const& GetCurrStrokeColor() { return BMT_current.GetStrokeColor(); } void SetTextGlowMode( TextGlowMode tgm ) { m_TextGlowMode = tgm; } diff --git a/src/Character.cpp b/src/Character.cpp index b6392ef4cb..a9c621505d 100644 --- a/src/Character.cpp +++ b/src/Character.cpp @@ -5,7 +5,7 @@ #include "RageTextureID.h" #include "ActorUtil.h" -RString GetRandomFileInDir( RString sDir ); +RString GetRandomFileInDir( const RString &sDir ); Character::Character(): m_sCharDir(""), m_sCharacterID(""), m_sDisplayName(""), m_sCardPath(""), m_sIconPath(""), @@ -72,7 +72,7 @@ bool Character::Load( RString sCharDir ) return true; } -RString GetRandomFileInDir( RString sDir ) +RString GetRandomFileInDir( const RString &sDir ) { vector asFiles; GetDirListing( sDir, asFiles, false, true ); diff --git a/src/CharacterManager.cpp b/src/CharacterManager.cpp index 03df847012..f48b585ec1 100644 --- a/src/CharacterManager.cpp +++ b/src/CharacterManager.cpp @@ -105,7 +105,7 @@ void CharacterManager::UndemandGraphics() (*c)->UndemandGraphics(); } -Character* CharacterManager::GetCharacterFromID( RString sCharacterID ) +Character* CharacterManager::GetCharacterFromID( const RString &sCharacterID ) { for( unsigned i=0; im_sGroupName) != 0) return false; diff --git a/src/Course.h b/src/Course.h index abd780f8e4..24ca7c4af7 100644 --- a/src/Course.h +++ b/src/Course.h @@ -142,7 +142,7 @@ class Course ProfileSlot GetLoadedFromProfileSlot() const { return m_LoadedFromProfile; } void SetLoadedFromProfile( ProfileSlot slot ) { m_LoadedFromProfile = slot; } - bool Matches(RString sGroup, RString sCourse) const; + bool Matches(const RString &sGroup, const RString &sCourse) const; // Lua void PushSelf( lua_State *L ); diff --git a/src/CourseUtil.cpp b/src/CourseUtil.cpp index f2a53a8752..efe1fe9a21 100644 --- a/src/CourseUtil.cpp +++ b/src/CourseUtil.cpp @@ -321,7 +321,7 @@ void CourseUtil::AutogenOniFromArtist( const RString &sArtistName, RString sArti } } -void CourseUtil::WarnOnInvalidMods( RString sMods ) +void CourseUtil::WarnOnInvalidMods( const RString &sMods ) { PlayerOptions po; SongOptions so; diff --git a/src/CourseUtil.h b/src/CourseUtil.h index 6be86abe77..d1a4a9189e 100644 --- a/src/CourseUtil.h +++ b/src/CourseUtil.h @@ -40,7 +40,7 @@ namespace CourseUtil bool ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut ); - void WarnOnInvalidMods( RString sMods ); + void WarnOnInvalidMods( const RString &sMods ); // sm-ssc additions: //RString GetSectionNameFromCourseAndSort( const Course *pCourse, SortOrder so ); diff --git a/src/CryptManager.cpp b/src/CryptManager.cpp index 84628f989c..de1c548c40 100644 --- a/src/CryptManager.cpp +++ b/src/CryptManager.cpp @@ -48,7 +48,7 @@ static bool HashFile( RageFileBasic &f, unsigned char buf_hash[20], int iHash ) CryptManager::CryptManager() { } CryptManager::~CryptManager() { } void CryptManager::GenerateRSAKey( unsigned int keyLength, RString privFilename, RString pubFilename ) { } -void CryptManager::SignFileToFile( RString sPath, RString sSignatureFile ) { } +void CryptManager::SignFileToFile( const RString &sPath, RString sSignatureFile ) { } bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile, RString sPublicKeyFile ) { return true; } bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile ) { @@ -136,7 +136,7 @@ CryptManager::~CryptManager() LUA->UnsetGlobal( "CRYPTMAN" ); } -static bool WriteFile( RString sFile, RString sBuf ) +static bool WriteFile( const RString &sFile, const RString &sBuf ) { RageFile output; if( !output.Open(sFile, RageFile::WRITE) ) @@ -190,7 +190,7 @@ void CryptManager::GenerateRSAKey( unsigned int keyLength, RString &sPrivKey, RS sPrivKey = RString( (const char *) buf, iSize ); } -void CryptManager::GenerateRSAKeyToFile( unsigned int keyLength, RString privFilename, RString pubFilename ) +void CryptManager::GenerateRSAKeyToFile( unsigned int keyLength, const RString &privFilename, const RString &pubFilename ) { RString sPrivKey, sPubKey; GenerateRSAKey( keyLength, sPrivKey, sPubKey ); @@ -205,7 +205,7 @@ void CryptManager::GenerateRSAKeyToFile( unsigned int keyLength, RString privFil } } -void CryptManager::SignFileToFile( RString sPath, RString sSignatureFile ) +void CryptManager::SignFileToFile( const RString &sPath, RString sSignatureFile ) { RString sPrivFilename = PRIVATE_KEY_PATH; if( sSignatureFile.empty() ) @@ -222,7 +222,7 @@ void CryptManager::SignFileToFile( RString sPath, RString sSignatureFile ) WriteFile( sSignatureFile, sSignature ); } -bool CryptManager::Sign( RString sPath, RString &sSignatureOut, RString sPrivKey ) +bool CryptManager::Sign( const RString &sPath, RString &sSignatureOut, const RString &sPrivKey ) { if( !IsAFile(sPath) ) { @@ -270,7 +270,7 @@ bool CryptManager::Sign( RString sPath, RString &sSignatureOut, RString sPrivKey return true; } -bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile ) +bool CryptManager::VerifyFileWithFile( const RString &sPath, const RString &sSignatureFile ) { if( VerifyFileWithFile(sPath, sSignatureFile, PUBLIC_KEY_PATH) ) return true; @@ -289,7 +289,7 @@ bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile ) return false; } -bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile, RString sPublicKeyFile ) +bool CryptManager::VerifyFileWithFile( const RString &sPath, RString sSignatureFile, const RString &sPublicKeyFile ) { if( sSignatureFile.empty() ) sSignatureFile = sPath + SIGNATURE_APPEND; @@ -316,7 +316,7 @@ bool CryptManager::VerifyFileWithFile( RString sPath, RString sSignatureFile, RS return Verify( file, sSignature, sPublicKey ); } -bool CryptManager::Verify( RageFileBasic &file, RString sSignature, RString sPublicKey ) +bool CryptManager::Verify( RageFileBasic &file, const RString &sSignature, const RString &sPublicKey ) { RSAKeyWrapper key; RString sError; @@ -359,7 +359,7 @@ void CryptManager::GetRandomBytes( void *pData, int iBytes ) } #endif -RString CryptManager::GetMD5ForFile( RString fn ) +RString CryptManager::GetMD5ForFile( const RString &fn ) { RageFile file; if( !file.Open( fn, RageFile::READ ) ) @@ -376,7 +376,7 @@ RString CryptManager::GetMD5ForFile( RString fn ) return RString( (const char *) digest, sizeof(digest) ); } -RString CryptManager::GetMD5ForString( RString sData ) +RString CryptManager::GetMD5ForString( const RString &sData ) { unsigned char digest[16]; @@ -390,7 +390,7 @@ RString CryptManager::GetMD5ForString( RString sData ) return RString( (const char *) digest, sizeof(digest) ); } -RString CryptManager::GetSHA1ForString( RString sData ) +RString CryptManager::GetSHA1ForString( const RString &sData ) { unsigned char digest[20]; @@ -404,7 +404,7 @@ RString CryptManager::GetSHA1ForString( RString sData ) return RString( (const char *) digest, sizeof(digest) ); } -RString CryptManager::GetSHA1ForFile( RString fn ) +RString CryptManager::GetSHA1ForFile( const RString &fn ) { RageFile file; if( !file.Open( fn, RageFile::READ ) ) diff --git a/src/CryptManager.h b/src/CryptManager.h index ee897346d2..1a5cd5e018 100644 --- a/src/CryptManager.h +++ b/src/CryptManager.h @@ -14,20 +14,20 @@ class CryptManager static void GenerateGlobalKeys(); static void GenerateRSAKey( unsigned int keyLength, RString &sPrivKey, RString &sPubKey ); - static void GenerateRSAKeyToFile( unsigned int keyLength, RString privFilename, RString pubFilename ); - static void SignFileToFile( RString sPath, RString sSignatureFile = "" ); - static bool Sign( RString sPath, RString &sSignatureOut, RString sPrivateKey ); - static bool VerifyFileWithFile( RString sPath, RString sSignatureFile = "" ); - static bool VerifyFileWithFile( RString sPath, RString sSignatureFile, RString sPublicKeyFile ); - static bool Verify( RageFileBasic &file, RString sSignature, RString sPublicKey ); + static void GenerateRSAKeyToFile( unsigned int keyLength, const RString &privFilename, const RString &pubFilename ); + static void SignFileToFile( const RString &sPath, RString sSignatureFile = "" ); + static bool Sign( const RString &sPath, RString &sSignatureOut, const RString &sPrivateKey ); + static bool VerifyFileWithFile( const RString &sPath, const RString &sSignatureFile = "" ); + static bool VerifyFileWithFile( const RString &sPath, RString sSignatureFile, const RString &sPublicKeyFile ); + static bool Verify( RageFileBasic &file, const RString &sSignature, const RString &sPublicKey ); static void GetRandomBytes( void *pData, int iBytes ); static RString GenerateRandomUUID(); - static RString GetMD5ForFile( RString fn ); // in binary - static RString GetMD5ForString( RString sData ); // in binary - static RString GetSHA1ForString( RString sData ); // in binary - static RString GetSHA1ForFile( RString fn ); // in binary + static RString GetMD5ForFile( const RString &fn ); // in binary + static RString GetMD5ForString( const RString &sData ); // in binary + static RString GetSHA1ForString( const RString &sData ); // in binary + static RString GetSHA1ForFile( const RString &fn ); // in binary static RString GetPublicKeyFileName(); diff --git a/src/DateTime.cpp b/src/DateTime.cpp index a99230e0cc..e63cc0c225 100644 --- a/src/DateTime.cpp +++ b/src/DateTime.cpp @@ -108,7 +108,7 @@ RString DateTime::GetString() const return s; } -bool DateTime::FromString( const RString sDateTime ) +bool DateTime::FromString( const RString &sDateTime ) { Init(); @@ -145,7 +145,7 @@ RString DayInYearToString( int iDayInYear ) return ssprintf("DayInYear%03d",iDayInYear); } -int StringToDayInYear( RString sDayInYear ) +int StringToDayInYear( const RString &sDayInYear ) { int iDayInYear; if( sscanf( sDayInYear, "DayInYear%d", &iDayInYear ) != 1 ) diff --git a/src/DateTime.h b/src/DateTime.h index 271d44e35e..9d90d7be79 100644 --- a/src/DateTime.h +++ b/src/DateTime.h @@ -4,7 +4,7 @@ #include "EnumHelper.h" #include -int StringToDayInYear( RString sDayInYear ); +int StringToDayInYear( const RString &sDayInYear ); /** @brief The number of days we check for previously. */ const int NUM_LAST_DAYS = 7; @@ -145,7 +145,7 @@ struct DateTime * * @param sDateTime the string to attempt to convert. * @return true if the conversion worked, or false otherwise. */ - bool FromString( const RString sDateTime ); + bool FromString( const RString &sDateTime ); }; #endif diff --git a/src/DifficultyIcon.cpp b/src/DifficultyIcon.cpp index 58eead5f75..06e935db9a 100644 --- a/src/DifficultyIcon.cpp +++ b/src/DifficultyIcon.cpp @@ -19,7 +19,7 @@ DifficultyIcon::DifficultyIcon() m_PlayerNumber = PLAYER_1; } -bool DifficultyIcon::Load( RString sPath ) +bool DifficultyIcon::Load( const RString &sPath ) { Sprite::Load( sPath ); int iStates = GetNumStates(); diff --git a/src/DifficultyIcon.h b/src/DifficultyIcon.h index 80e7d3437f..6f6f0dd310 100644 --- a/src/DifficultyIcon.h +++ b/src/DifficultyIcon.h @@ -17,8 +17,8 @@ class DifficultyIcon : public Sprite DifficultyIcon(); virtual bool EarlyAbortDraw() const { return m_bBlank || Sprite::EarlyAbortDraw(); } - bool Load( RString sFilePath ); - virtual void Load( RageTextureID ID ) { Load( ID.filename ); } + bool Load( const RString &sFilePath ); + virtual void Load( const RageTextureID &ID ) { Load( ID.filename ); } virtual void LoadFromNode( const XNode* pNode ); virtual DifficultyIcon *Copy() const; diff --git a/src/FadingBanner.cpp b/src/FadingBanner.cpp index 1efe9a567e..cd41ceebf3 100644 --- a/src/FadingBanner.cpp +++ b/src/FadingBanner.cpp @@ -67,7 +67,7 @@ void FadingBanner::DrawPrimitives() } } -void FadingBanner::Load( RageTextureID ID, bool bLowResToHighRes ) +void FadingBanner::Load( const RageTextureID &ID, bool bLowResToHighRes ) { BeforeChange( bLowResToHighRes ); m_Banner[m_iIndexLatest].Load(ID); @@ -187,7 +187,7 @@ void FadingBanner::LoadMode() m_Banner[m_iIndexLatest].LoadMode(); } -void FadingBanner::LoadFromSongGroup( RString sSongGroup ) +void FadingBanner::LoadFromSongGroup( const RString &sSongGroup ) { const RString sGroupBannerPath = SONGMAN->GetSongGroupBannerPath( sSongGroup ); LoadFromCachedBanner( sGroupBannerPath ); @@ -254,7 +254,7 @@ void FadingBanner::LoadCourseFallback() m_Banner[m_iIndexLatest].LoadCourseFallback(); } -void FadingBanner::LoadCustom( RString sBanner ) +void FadingBanner::LoadCustom( const RString &sBanner ) { BeforeChange(); m_Banner[m_iIndexLatest].Load( THEME->GetPathG( "Banner", sBanner ) ); diff --git a/src/FadingBanner.h b/src/FadingBanner.h index 0389f42602..a54689e346 100644 --- a/src/FadingBanner.h +++ b/src/FadingBanner.h @@ -17,10 +17,10 @@ class FadingBanner : public ActorFrame /* If you previously loaded a cached banner, and are now loading the full- * resolution banner, set bLowResToHighRes to true. */ - void Load( RageTextureID ID, bool bLowResToHighRes=false ); + void Load( const RageTextureID &ID, bool bLowResToHighRes=false ); void LoadFromSong( const Song* pSong ); // NULL means no song void LoadMode(); - void LoadFromSongGroup( RString sSongGroup ); + void LoadFromSongGroup( const RString &sSongGroup ); void LoadFromCourse( const Course* pCourse ); void LoadIconFromCharacter( Character* pCharacter ); void LoadBannerFromUnlockEntry( const UnlockEntry* pUE ); @@ -29,7 +29,7 @@ class FadingBanner : public ActorFrame void LoadFromSortOrder( SortOrder so ); void LoadFallback(); void LoadCourseFallback(); - void LoadCustom( RString sBanner ); + void LoadCustom( const RString &sBanner ); bool LoadFromCachedBanner( const RString &path ); bool LoadFromCachedBackground( const RString &path ); diff --git a/src/Font.cpp b/src/Font.cpp index 072a721092..11153b3876 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -443,7 +443,7 @@ RString Font::GetPageNameFromFileName( const RString &sFilename ) return sFilename.substr( begin, end-begin+1 ); } -void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &sPageName, RString sChars ) +void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &sPageName, const RString &sChars ) { cfg.m_sTexturePath = sTexturePath; @@ -663,7 +663,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr cfg.CharToGlyphNo[0x00A0] = cfg.CharToGlyphNo[' ']; } -RString FontPageSettings::MapRange( RString sMapping, int iMapOffset, int iGlyphNo, int iCount ) +RString FontPageSettings::MapRange( const RString &sMapping, int iMapOffset, int iGlyphNo, int iCount ) { if( !sMapping.CompareNoCase("Unicode") ) { @@ -740,7 +740,7 @@ static vector LoadStack; * However, if it doesn't, we don't know what it is and the font will receive * no default mapping. A font isn't useful with no characters mapped. */ -void Font::Load( const RString &sIniPath, RString sChars ) +void Font::Load( const RString &sIniPath, const RString &sChars ) { if(GetExtension(sIniPath).CompareNoCase("ini")) { diff --git a/src/Font.h b/src/Font.h index b24faff671..122acbf2c8 100644 --- a/src/Font.h +++ b/src/Font.h @@ -96,7 +96,7 @@ struct FontPageSettings * @param iGlyphOffset the number of glyphs to offset. * @param iCount the range to map. If -1, the range is the entire map. * @return the empty string on success, or an error message on failure. */ - RString MapRange( RString sMapping, int iMapOffset, int iGlyphOffset, int iCount ); + RString MapRange( const RString &sMapping, int iMapOffset, int iGlyphOffset, int iCount ); }; class FontPage @@ -160,7 +160,7 @@ class Font * @param f the font whose pages we are stealing. */ void MergeFont(Font &f); - void Load(const RString &sFontOrTextureFilePath, RString sChars); + void Load(const RString &sFontOrTextureFilePath, const RString &sChars); void Unload(); void Reload(); @@ -204,7 +204,7 @@ class Font /** @brief We keep this around only for reloading. */ RString m_sChars; - void LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &PageName, RString sChars ); + void LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RString &sTexturePath, const RString &PageName, const RString &sChars ); static void GetFontPaths( const RString &sFontOrTextureFilePath, vector &sTexturePaths ); RString GetPageNameFromFileName( const RString &sFilename ); diff --git a/src/GameManager.cpp b/src/GameManager.cpp index a9a4d37983..c7f2186c5f 100644 --- a/src/GameManager.cpp +++ b/src/GameManager.cpp @@ -3464,7 +3464,7 @@ RString GameManager::StyleToLocalizedString( const Style* style ) return s; } -const Game* GameManager::StringToGame( RString sGame ) +const Game* GameManager::StringToGame( const RString &sGame ) { for( size_t i=0; im_szName) ) @@ -3474,7 +3474,7 @@ const Game* GameManager::StringToGame( RString sGame ) } -const Style* GameManager::GameAndStringToStyle( const Game *game, RString sStyle ) +const Style* GameManager::GameAndStringToStyle( const Game *game, const RString &sStyle ) { for( int s=0; game->m_apStyles[s]; ++s ) { diff --git a/src/GameManager.h b/src/GameManager.h index 1efa2d2015..5e2fe27705 100644 --- a/src/GameManager.h +++ b/src/GameManager.h @@ -46,8 +46,8 @@ class GameManager const StepsTypeInfo &GetStepsTypeInfo( StepsType st ); StepsType StringToStepsType( RString sStepsType ); - const Game* StringToGame( RString sGame ); - const Style* GameAndStringToStyle( const Game* pGame, RString sStyle ); + const Game* StringToGame( const RString &sGame ); + const Style* GameAndStringToStyle( const Game* pGame, const RString &sStyle ); RString StyleToLocalizedString( const Style* s ); diff --git a/src/GameSoundManager.cpp b/src/GameSoundManager.cpp index 8058f73f26..a0a0feb8db 100644 --- a/src/GameSoundManager.cpp +++ b/src/GameSoundManager.cpp @@ -669,7 +669,7 @@ RString GameSoundManager::GetMusicPath() const } void GameSoundManager::PlayMusic( - RString sFile, + const RString &sFile, const TimingData *pTiming, bool bForceLoop, float fStartSecond, @@ -749,7 +749,7 @@ void GameSoundManager::HandleSongTimer( bool on ) g_UpdatingTimer = on; } -void GameSoundManager::PlayOnce( RString sPath ) +void GameSoundManager::PlayOnce( const RString &sPath ) { /* Add the sound to the g_SoundsToPlayOnce queue. */ g_Mutex->Lock(); @@ -758,7 +758,7 @@ void GameSoundManager::PlayOnce( RString sPath ) g_Mutex->Unlock(); } -void GameSoundManager::PlayOnceFromDir( RString sPath ) +void GameSoundManager::PlayOnceFromDir( const RString &sPath ) { /* Add the path to the g_SoundsToPlayOnceFromDir queue. */ g_Mutex->Lock(); @@ -767,7 +767,7 @@ void GameSoundManager::PlayOnceFromDir( RString sPath ) g_Mutex->Unlock(); } -void GameSoundManager::PlayOnceFromAnnouncer( RString sPath ) +void GameSoundManager::PlayOnceFromAnnouncer( const RString &sPath ) { /* Add the path to the g_SoundsToPlayOnceFromAnnouncer queue. */ g_Mutex->Lock(); diff --git a/src/GameSoundManager.h b/src/GameSoundManager.h index addd49cea1..ca2d404d7f 100644 --- a/src/GameSoundManager.h +++ b/src/GameSoundManager.h @@ -43,7 +43,7 @@ class GameSoundManager }; void PlayMusic( PlayMusicParams params, PlayMusicParams FallbackMusicParams = PlayMusicParams() ); void PlayMusic( - RString sFile, + const RString &sFile, const TimingData *pTiming = NULL, bool force_loop = false, float start_sec = 0, @@ -57,9 +57,9 @@ class GameSoundManager RString GetMusicPath() const; void Flush(); - void PlayOnce( RString sPath ); - void PlayOnceFromDir( RString sDir ); - void PlayOnceFromAnnouncer( RString sFolderName ); + void PlayOnce( const RString &sPath ); + void PlayOnceFromDir( const RString &sDir ); + void PlayOnceFromAnnouncer( const RString &sFolderName ); void HandleSongTimer( bool on=true ); float GetFrameTimingAdjustment( float fDeltaTime ); diff --git a/src/GameState.cpp b/src/GameState.cpp index 17a4286135..3910090637 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -351,7 +351,7 @@ void GameState::Reset() m_pCurCharacters[p] = CHARMAN->GetRandomCharacter(); else m_pCurCharacters[p] = CHARMAN->GetDefaultCharacter(); - ASSERT( m_pCurCharacters[p] != NULL ); + //ASSERT( m_pCurCharacters[p] != NULL ); } m_bTemporaryEventMode = false; @@ -1837,13 +1837,13 @@ void GameState::ResetToDefaultSongOptions( ModsLevel l ) m_SongOptions.Assign( l, so ); } -void GameState::ApplyPreferredModifiers( PlayerNumber pn, RString sModifiers ) +void GameState::ApplyPreferredModifiers( PlayerNumber pn, const RString &sModifiers ) { m_pPlayerState[pn]->m_PlayerOptions.FromString( ModsLevel_Preferred, sModifiers ); m_SongOptions.FromString( ModsLevel_Preferred, sModifiers ); } -void GameState::ApplyStageModifiers( PlayerNumber pn, RString sModifiers ) +void GameState::ApplyStageModifiers( PlayerNumber pn, const RString &sModifiers ) { m_pPlayerState[pn]->m_PlayerOptions.FromString( ModsLevel_Stage, sModifiers ); m_SongOptions.FromString( ModsLevel_Stage, sModifiers ); diff --git a/src/GameState.h b/src/GameState.h index 0ba676f12a..851344ddf9 100644 --- a/src/GameState.h +++ b/src/GameState.h @@ -320,8 +320,8 @@ class GameState void GetDefaultPlayerOptions( PlayerOptions &po ); void GetDefaultSongOptions( SongOptions &so ); void ResetToDefaultSongOptions( ModsLevel l ); - void ApplyPreferredModifiers( PlayerNumber pn, RString sModifiers ); - void ApplyStageModifiers( PlayerNumber pn, RString sModifiers ); + void ApplyPreferredModifiers( PlayerNumber pn, const RString &sModifiers ); + void ApplyStageModifiers( PlayerNumber pn, const RString &sModifiers ); void ClearStageModifiersIllegalForCourse(); void ResetOptions(); diff --git a/src/GradeDisplay.cpp b/src/GradeDisplay.cpp index 658146cc0e..5cbae13075 100644 --- a/src/GradeDisplay.cpp +++ b/src/GradeDisplay.cpp @@ -8,7 +8,7 @@ REGISTER_ACTOR_CLASS( GradeDisplay ); -void GradeDisplay::Load( RString sMetricsGroup ) +void GradeDisplay::Load( const RString &sMetricsGroup ) { ASSERT( m_vSpr.empty() ); m_vSpr.resize( NUM_POSSIBLE_GRADES ); diff --git a/src/GradeDisplay.h b/src/GradeDisplay.h index e2a3c09cf2..c209e2f1a2 100644 --- a/src/GradeDisplay.h +++ b/src/GradeDisplay.h @@ -10,7 +10,7 @@ struct lua_State; class GradeDisplay : public ActorFrame { public: - virtual void Load( RString sMetricsGroup ); + virtual void Load( const RString &sMetricsGroup ); void SetGrade( Grade g ); virtual GradeDisplay *Copy() const; diff --git a/src/GraphDisplay.cpp b/src/GraphDisplay.cpp index a5b8ee4c73..402b93ab27 100644 --- a/src/GraphDisplay.cpp +++ b/src/GraphDisplay.cpp @@ -218,7 +218,7 @@ void GraphDisplay::Set( const StageStats &ss, const PlayerStageStats &pss ) } } -void GraphDisplay::Load( RString sMetricsGroup ) +void GraphDisplay::Load( const RString &sMetricsGroup ) { m_size.x = THEME->GetMetricI( sMetricsGroup, "BodyWidth" ); m_size.y = THEME->GetMetricI( sMetricsGroup, "BodyHeight" ); diff --git a/src/GraphDisplay.h b/src/GraphDisplay.h index 42e17b8695..2aab94d8f5 100644 --- a/src/GraphDisplay.h +++ b/src/GraphDisplay.h @@ -16,7 +16,7 @@ class GraphDisplay: public ActorFrame ~GraphDisplay(); virtual GraphDisplay *Copy() const; - void Load( RString sMetricsGroup ); + void Load( const RString &sMetricsGroup ); void Set( const StageStats &ss, const PlayerStageStats &s ); // Lua diff --git a/src/HighScore.cpp b/src/HighScore.cpp index cc9e17c0c6..afb3a29cab 100644 --- a/src/HighScore.cpp +++ b/src/HighScore.cpp @@ -217,10 +217,10 @@ void HighScore::SetStageAward( StageAward a ) { m_Impl->stageAward = a; } void HighScore::SetPeakComboAward( PeakComboAward a ) { m_Impl->peakComboAward = a; } void HighScore::SetPercentDP( float f ) { m_Impl->fPercentDP = f; } void HighScore::SetAliveSeconds( float f ) { m_Impl->fSurviveSeconds = f; } -void HighScore::SetModifiers( RString s ) { m_Impl->sModifiers = s; } +void HighScore::SetModifiers( const RString &s ) { m_Impl->sModifiers = s; } void HighScore::SetDateTime( DateTime d ) { m_Impl->dateTime = d; } -void HighScore::SetPlayerGuid( RString s ) { m_Impl->sPlayerGuid = s; } -void HighScore::SetMachineGuid( RString s ) { m_Impl->sMachineGuid = s; } +void HighScore::SetPlayerGuid( const RString &s ) { m_Impl->sPlayerGuid = s; } +void HighScore::SetMachineGuid( const RString &s ) { m_Impl->sMachineGuid = s; } void HighScore::SetProductID( int i ) { m_Impl->iProductID = i; } void HighScore::SetTapNoteScore( TapNoteScore tns, int i ) { m_Impl->iTapNoteScores[tns] = i; } void HighScore::SetHoldNoteScore( HoldNoteScore hns, int i ) { m_Impl->iHoldNoteScores[hns] = i; } diff --git a/src/HighScore.h b/src/HighScore.h index 568ad191ea..56defb3424 100644 --- a/src/HighScore.h +++ b/src/HighScore.h @@ -72,10 +72,10 @@ struct HighScore void SetMaxCombo( unsigned int i ); void SetStageAward( StageAward a ); void SetPeakComboAward( PeakComboAward a ); - void SetModifiers( RString s ); + void SetModifiers( const RString &s ); void SetDateTime( DateTime d ); - void SetPlayerGuid( RString s ); - void SetMachineGuid( RString s ); + void SetPlayerGuid( const RString &s ); + void SetMachineGuid( const RString &s ); void SetProductID( int i ); void SetTapNoteScore( TapNoteScore tns, int i ); void SetHoldNoteScore( HoldNoteScore tns, int i ); diff --git a/src/InputMapper.cpp b/src/InputMapper.cpp index 873ccc02fe..848133aa7f 100644 --- a/src/InputMapper.cpp +++ b/src/InputMapper.cpp @@ -1193,7 +1193,7 @@ void InputMappings::Unmap( InputDevice id ) } } -void InputMappings::ReadMappings( const InputScheme *pInputScheme, RString sFilePath, bool bIsAutoMapping ) +void InputMappings::ReadMappings( const InputScheme *pInputScheme, const RString &sFilePath, bool bIsAutoMapping ) { Clear(); @@ -1240,7 +1240,7 @@ void InputMappings::ReadMappings( const InputScheme *pInputScheme, RString sFile } } -void InputMappings::WriteMappings( const InputScheme *pInputScheme, RString sFilePath ) +void InputMappings::WriteMappings( const InputScheme *pInputScheme, const RString &sFilePath ) { IniFile ini; ini.ReadFile( sFilePath ); diff --git a/src/InputMapper.h b/src/InputMapper.h index afd6e29088..61097b54c0 100644 --- a/src/InputMapper.h +++ b/src/InputMapper.h @@ -131,8 +131,8 @@ class InputMappings void Clear(); void Unmap( InputDevice id ); - void WriteMappings( const InputScheme *pInputScheme, RString sFilePath ); - void ReadMappings( const InputScheme *pInputScheme, RString sFilePath, bool bIsAutoMapping ); + void WriteMappings( const InputScheme *pInputScheme, const RString &sFilePath ); + void ReadMappings( const InputScheme *pInputScheme, const RString &sFilePath, bool bIsAutoMapping ); void SetInputMap( const DeviceInput &DeviceI, const GameInput &GameI, int iSlotIndex ); void ClearFromInputMap( const DeviceInput &DeviceI ); diff --git a/src/JsonUtil.cpp b/src/JsonUtil.cpp index 755036e770..8dd1be9a76 100644 --- a/src/JsonUtil.cpp +++ b/src/JsonUtil.cpp @@ -7,7 +7,7 @@ #include "json/reader.h" #include "json/writer.h" -bool JsonUtil::LoadFromString(Json::Value &root, RString sData, RString &sErrorOut) +bool JsonUtil::LoadFromString(Json::Value &root, const RString &sData, RString &sErrorOut) { Json::Reader reader; bool parsingSuccessful = reader.parse(sData, root); @@ -40,7 +40,7 @@ bool JsonUtil::LoadFromFileShowErrors(Json::Value &root, const RString &sFile) return LoadFromFileShowErrors(root, f); } -bool JsonUtil::LoadFromStringShowErrors(Json::Value &root, RString sData) +bool JsonUtil::LoadFromStringShowErrors(Json::Value &root, const RString &sData) { RString sError; if(!LoadFromString(root, sData, sError)) diff --git a/src/JsonUtil.h b/src/JsonUtil.h index 3cb1bdf673..fe135c0435 100644 --- a/src/JsonUtil.h +++ b/src/JsonUtil.h @@ -7,8 +7,8 @@ class RageFileBasic; namespace JsonUtil { - bool LoadFromString( Json::Value &root, RString sData, RString &sErrorOut ); - bool LoadFromStringShowErrors(Json::Value &root, const RString sData); + bool LoadFromString( Json::Value &root, const RString &sData, RString &sErrorOut ); + bool LoadFromStringShowErrors(Json::Value &root, const RString &sData); bool LoadFromFileShowErrors(Json::Value &root, const RString &sFile); bool LoadFromFileShowErrors(Json::Value &root, RageFileBasic &f); diff --git a/src/MemoryCardManager.cpp b/src/MemoryCardManager.cpp index adf8ef14a9..a0d7a138bb 100644 --- a/src/MemoryCardManager.cpp +++ b/src/MemoryCardManager.cpp @@ -672,7 +672,7 @@ void MemoryCardManager::UnmountCard( PlayerNumber pn ) } } -bool MemoryCardManager::PathIsMemCard( RString sDir ) const +bool MemoryCardManager::PathIsMemCard( const RString &sDir ) const { FOREACH_PlayerNumber( p ) if( !sDir.Left(MEM_CARD_MOUNT_POINT[p].size()).CompareNoCase( MEM_CARD_MOUNT_POINT[p] ) ) diff --git a/src/MemoryCardManager.h b/src/MemoryCardManager.h index 0244907638..9ef2e66ebd 100644 --- a/src/MemoryCardManager.h +++ b/src/MemoryCardManager.h @@ -37,7 +37,7 @@ class MemoryCardManager bool GetCardLocked( PlayerNumber pn ) const { return m_bCardLocked[pn]; } - bool PathIsMemCard( RString sDir ) const; + bool PathIsMemCard( const RString &sDir ) const; bool IsNameAvailable( PlayerNumber pn ) const; RString GetName( PlayerNumber pn ) const; diff --git a/src/MenuTimer.cpp b/src/MenuTimer.cpp index e7ebd1d474..9bb39bbef1 100644 --- a/src/MenuTimer.cpp +++ b/src/MenuTimer.cpp @@ -27,7 +27,7 @@ MenuTimer::~MenuTimer() delete WARNING_COMMAND; } -void MenuTimer::Load( RString sMetricsGroup ) +void MenuTimer::Load( const RString &sMetricsGroup ) { m_sprFrame.Load( THEME->GetPathG(sMetricsGroup, "Frame") ); m_sprFrame->SetName( "Frame" ); diff --git a/src/MenuTimer.h b/src/MenuTimer.h index f95c5c5c1b..8f733e43ec 100644 --- a/src/MenuTimer.h +++ b/src/MenuTimer.h @@ -16,7 +16,7 @@ class MenuTimer : public ActorFrame public: MenuTimer(); virtual ~MenuTimer(); - void Load( RString sMetricsGroup ); + void Load( const RString &sMetricsGroup ); virtual void Update( float fDeltaTime ); diff --git a/src/MessageManager.cpp b/src/MessageManager.cpp index 671871fba2..5e403bb474 100644 --- a/src/MessageManager.cpp +++ b/src/MessageManager.cpp @@ -245,7 +245,7 @@ bool MessageManager::IsSubscribedToMessage( IMessageSubscriber* pSubscriber, con return subs.find( pSubscriber ) != subs.end(); } -void IMessageSubscriber::ClearMessages( const RString sMessage ) +void IMessageSubscriber::ClearMessages( const RString &sMessage ) { } diff --git a/src/MessageManager.h b/src/MessageManager.h index 6d77e1d7e2..6e8fffbda3 100644 --- a/src/MessageManager.h +++ b/src/MessageManager.h @@ -157,7 +157,7 @@ class IMessageSubscriber public: virtual ~IMessageSubscriber() { } virtual void HandleMessage( const Message &msg ) = 0; - void ClearMessages( const RString sMessage = "" ); + void ClearMessages( const RString &sMessage = "" ); private: friend class MessageManager; diff --git a/src/MeterDisplay.cpp b/src/MeterDisplay.cpp index fc485e9014..3fd4247650 100644 --- a/src/MeterDisplay.cpp +++ b/src/MeterDisplay.cpp @@ -15,7 +15,7 @@ MeterDisplay::MeterDisplay() { } -void MeterDisplay::Load( RString sStreamPath, float fStreamWidth, RString sTipPath ) +void MeterDisplay::Load( const RString &sStreamPath, float fStreamWidth, const RString &sTipPath ) { m_sprStream.Load( sStreamPath ); this->AddChild( m_sprStream ); diff --git a/src/MeterDisplay.h b/src/MeterDisplay.h index 1b941f6f41..bc63f6df82 100644 --- a/src/MeterDisplay.h +++ b/src/MeterDisplay.h @@ -11,7 +11,7 @@ class MeterDisplay : public ActorFrame { public: MeterDisplay(); - void Load( RString sStreamPath, float fStreamWidth, RString sTipPath ); + void Load( const RString &sStreamPath, float fStreamWidth, const RString &sTipPath ); virtual void LoadFromNode( const XNode* pNode ); virtual MeterDisplay *Copy() const; diff --git a/src/ModIcon.cpp b/src/ModIcon.cpp index 4b14fab92f..7fc552d4c3 100644 --- a/src/ModIcon.cpp +++ b/src/ModIcon.cpp @@ -24,7 +24,7 @@ ModIcon::ModIcon( const ModIcon &cpy ): this->AddChild( &m_text ); } -void ModIcon::Load( RString sMetricsGroup ) +void ModIcon::Load( const RString &sMetricsGroup ) { m_sprFilled.Load( THEME->GetPathG(sMetricsGroup,"Filled") ); m_sprFilled->SetName("Filled"); diff --git a/src/ModIcon.h b/src/ModIcon.h index 11fb08bbbd..a151412fca 100644 --- a/src/ModIcon.h +++ b/src/ModIcon.h @@ -12,7 +12,7 @@ class ModIcon : public ActorFrame public: ModIcon(); ModIcon( const ModIcon &cpy ); - void Load( RString sMetricsGroup ); + void Load( const RString &sMetricsGroup ); void Set( const RString &sText ); protected: diff --git a/src/Model.cpp b/src/Model.cpp index 4f79646d24..befa97e157 100644 --- a/src/Model.cpp +++ b/src/Model.cpp @@ -484,7 +484,7 @@ void Model::DrawMesh( int i ) const DISPLAY->PopMatrix(); } -void Model::SetDefaultAnimation( RString sAnimation, float fPlayRate ) +void Model::SetDefaultAnimation( const RString &sAnimation, float fPlayRate ) { m_sDefaultAnimation = sAnimation; m_fDefaultAnimationRate = fPlayRate; diff --git a/src/Model.h b/src/Model.h index af54269f45..f3ccc9c8b4 100644 --- a/src/Model.h +++ b/src/Model.h @@ -49,7 +49,7 @@ class Model : public Actor virtual void SetSecondsIntoAnimation( float fSeconds ); RString GetDefaultAnimation() const { return m_sDefaultAnimation; }; - void SetDefaultAnimation( RString sAnimation, float fPlayRate = 1 ); + void SetDefaultAnimation( const RString &sAnimation, float fPlayRate = 1 ); bool MaterialsNeedNormals() const; diff --git a/src/ModelTypes.cpp b/src/ModelTypes.cpp index b45b363674..e5bc1eddda 100644 --- a/src/ModelTypes.cpp +++ b/src/ModelTypes.cpp @@ -216,7 +216,7 @@ RageVector2 AnimatedTexture::GetTextureTranslate() #define THROW RageException::Throw( "Parse error in \"%s\" at line %d: \"%s\".", sPath.c_str(), iLineNum, sLine.c_str() ) -bool msAnimation::LoadMilkshapeAsciiBones( RString sAniName, RString sPath ) +bool msAnimation::LoadMilkshapeAsciiBones( const RString &sAniName, RString sPath ) { FixSlashesInPlace(sPath); const RString sDir = Dirname( sPath ); diff --git a/src/ModelTypes.h b/src/ModelTypes.h index 3c2c2150b1..de2f3bcf5b 100644 --- a/src/ModelTypes.h +++ b/src/ModelTypes.h @@ -128,7 +128,7 @@ struct msAnimation return -1; } - bool LoadMilkshapeAsciiBones( RString sAniName, RString sPath ); + bool LoadMilkshapeAsciiBones( const RString &sAniName, RString sPath ); vector Bones; int nTotalFrames; diff --git a/src/MsdFile.cpp b/src/MsdFile.cpp index 7c52a95625..e2af1a809d 100644 --- a/src/MsdFile.cpp +++ b/src/MsdFile.cpp @@ -143,7 +143,7 @@ void MsdFile::ReadBuf( const char *buf, int len, bool bUnescape ) } // returns true if successful, false otherwise -bool MsdFile::ReadFile( RString sNewPath, bool bUnescape ) +bool MsdFile::ReadFile( const RString &sNewPath, bool bUnescape ) { error = ""; diff --git a/src/MsdFile.h b/src/MsdFile.h index 7d43d2aec4..e1237e3d21 100644 --- a/src/MsdFile.h +++ b/src/MsdFile.h @@ -35,7 +35,7 @@ class MsdFile * @param bUnescape a flag to see if we need to unescape values. * @return its success or failure. */ - bool ReadFile( RString sFilePath, bool bUnescape ); + bool ReadFile( const RString &sFilePath, bool bUnescape ); /** * @brief Attempt to read an MSD file. * @param sString the path to the file. diff --git a/src/MusicWheel.cpp b/src/MusicWheel.cpp index 0964b1f884..36622038d5 100644 --- a/src/MusicWheel.cpp +++ b/src/MusicWheel.cpp @@ -70,7 +70,7 @@ MusicWheelItem *MusicWheel::MakeItem() return new MusicWheelItem; } -void MusicWheel::Load( RString sType ) +void MusicWheel::Load( const RString &sType ) { ROULETTE_SWITCH_SECONDS .Load(sType,"RouletteSwitchSeconds"); ROULETTE_SLOW_DOWN_SWITCHES .Load(sType,"RouletteSlowDownSwitches"); @@ -1368,7 +1368,7 @@ void MusicWheel::StartRandom() RebuildWheelItems(); } -void MusicWheel::SetOpenSection( RString group ) +void MusicWheel::SetOpenSection( const RString &group ) { //LOG->Trace( "SetOpenSection %s", group.c_str() ); m_sExpandedSectionName = group; diff --git a/src/MusicWheel.h b/src/MusicWheel.h index e894820066..475a9940d9 100644 --- a/src/MusicWheel.h +++ b/src/MusicWheel.h @@ -20,7 +20,7 @@ class MusicWheel : public WheelBase public: virtual ~MusicWheel(); - virtual void Load( RString sType ); + virtual void Load( const RString &sType ); void BeginScreen(); bool ChangeSort( SortOrder new_so, bool allowSameSort = false ); // return true if change successful @@ -40,7 +40,7 @@ class MusicWheel : public WheelBase bool SelectSong( const Song *p ); bool SelectCourse( const Course *p ); bool SelectSection( const RString & SectionName ); - void SetOpenSection( RString group ); + void SetOpenSection( const RString &group ); SortOrder GetSortOrder() const { return m_SortOrder; } virtual void ChangeMusic( int dist ); /* +1 or -1 */ //CHECK THIS void FinishChangingSorts(); diff --git a/src/NoteSkinManager.cpp b/src/NoteSkinManager.cpp index 012651611c..cc87c68085 100644 --- a/src/NoteSkinManager.cpp +++ b/src/NoteSkinManager.cpp @@ -208,7 +208,7 @@ void NoteSkinManager::GetNoteSkinNames( const Game* pGame, vector &AddT GetAllNoteSkinNamesForGame( pGame, AddTo ); } -bool NoteSkinManager::NoteSkinNameInList(const RString name, vector name_list) +bool NoteSkinManager::NoteSkinNameInList(const RString &name, const vector &name_list) { for(size_t i= 0; i < name_list.size(); ++i) { diff --git a/src/NoteSkinManager.h b/src/NoteSkinManager.h index 0bcd96eb43..2e675d43f1 100644 --- a/src/NoteSkinManager.h +++ b/src/NoteSkinManager.h @@ -20,7 +20,7 @@ class NoteSkinManager void RefreshNoteSkinData( const Game* game ); void GetNoteSkinNames( const Game* game, vector &AddTo ); void GetNoteSkinNames( vector &AddTo ); // looks up current const Game* in GAMESTATE - bool NoteSkinNameInList(const RString name, vector name_list); + bool NoteSkinNameInList(const RString &name, const vector &name_list); bool DoesNoteSkinExist( const RString &sNoteSkin ); // looks up current const Game* in GAMESTATE bool DoNoteSkinsExistForGame( const Game *pGame ); RString GetDefaultNoteSkinName(); // looks up current const Game* in GAMESTATE diff --git a/src/NotesLoaderSM.cpp b/src/NotesLoaderSM.cpp index 2300a3095a..e007696e4e 100644 --- a/src/NotesLoaderSM.cpp +++ b/src/NotesLoaderSM.cpp @@ -266,28 +266,28 @@ bool SMLoader::LoadFromDir( const RString &sPath, Song &out, bool load_autosave return LoadFromSimfile( sPath + aFileNames[0], out ); } -float SMLoader::RowToBeat( RString line, const int rowsPerBeat ) +float SMLoader::RowToBeat( const RString &line, const int rowsPerBeat ) { - RString backup = line; - Trim(line, "r"); - Trim(line, "R"); - if( backup != line ) + RString trimmed = line; + Trim(trimmed, "r"); + Trim(trimmed, "R"); + if(trimmed != line ) { - return StringToFloat( line ) / rowsPerBeat; + return StringToFloat( trimmed ) / rowsPerBeat; } else { - return StringToFloat( line ); + return StringToFloat( trimmed ); } } void SMLoader::LoadFromTokens( - RString sStepsType, - RString sDescription, - RString sDifficulty, - RString sMeter, - RString sRadarValues, - RString sNoteData, + RString &sStepsType, + RString &sDescription, + RString &sDifficulty, + RString &sMeter, + RString &sRadarValues, + RString &sNoteData, Steps &out ) { @@ -437,7 +437,7 @@ void SMLoader::ProcessInstrumentTracks( Song &out, const RString &sParam ) } } -void SMLoader::ParseBPMs( vector< pair > &out, const RString line, const int rowsPerBeat ) +void SMLoader::ParseBPMs( vector< pair > &out, const RString &line, const int rowsPerBeat ) { vector arrayBPMChangeExpressions; split( line, ",", arrayBPMChangeExpressions ); @@ -733,7 +733,7 @@ void SMLoader::ProcessBPMsAndStops(TimingData &out, } } -void SMLoader::ProcessDelays( TimingData &out, const RString line, const int rowsPerBeat ) +void SMLoader::ProcessDelays( TimingData &out, const RString &line, const int rowsPerBeat ) { vector arrayDelayExpressions; split( line, ",", arrayDelayExpressions ); @@ -765,7 +765,7 @@ void SMLoader::ProcessDelays( TimingData &out, const RString line, const int row } } -void SMLoader::ProcessTimeSignatures( TimingData &out, const RString line, const int rowsPerBeat ) +void SMLoader::ProcessTimeSignatures( TimingData &out, const RString &line, const int rowsPerBeat ) { vector vs1; split( line, ",", vs1 ); @@ -819,7 +819,7 @@ void SMLoader::ProcessTimeSignatures( TimingData &out, const RString line, const } } -void SMLoader::ProcessTickcounts( TimingData &out, const RString line, const int rowsPerBeat ) +void SMLoader::ProcessTickcounts( TimingData &out, const RString &line, const int rowsPerBeat ) { vector arrayTickcountExpressions; split( line, ",", arrayTickcountExpressions ); @@ -844,7 +844,7 @@ void SMLoader::ProcessTickcounts( TimingData &out, const RString line, const int } } -void SMLoader::ProcessSpeeds( TimingData &out, const RString line, const int rowsPerBeat ) +void SMLoader::ProcessSpeeds( TimingData &out, const RString &line, const int rowsPerBeat ) { vector vs1; split( line, ",", vs1 ); @@ -904,7 +904,7 @@ void SMLoader::ProcessSpeeds( TimingData &out, const RString line, const int row } } -void SMLoader::ProcessFakes( TimingData &out, const RString line, const int rowsPerBeat ) +void SMLoader::ProcessFakes( TimingData &out, const RString &line, const int rowsPerBeat ) { vector arrayFakeExpressions; split( line, ",", arrayFakeExpressions ); @@ -1170,7 +1170,7 @@ bool SMLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache return true; } -bool SMLoader::LoadEditFromFile( RString sEditFilePath, ProfileSlot slot, bool bAddStepsToSong, Song *givenSong /* =NULL */ ) +bool SMLoader::LoadEditFromFile( const RString &sEditFilePath, ProfileSlot slot, bool bAddStepsToSong, Song *givenSong /* =NULL */ ) { LOG->Trace( "SMLoader::LoadEditFromFile(%s)", sEditFilePath.c_str() ); diff --git a/src/NotesLoaderSM.h b/src/NotesLoaderSM.h index 56f44062ba..4f896a2765 100644 --- a/src/NotesLoaderSM.h +++ b/src/NotesLoaderSM.h @@ -62,7 +62,7 @@ struct SMLoader * @param out a vector of files found in the path. */ virtual void GetApplicableFiles( const RString &sPath, vector &out, bool load_autosave= false ); - virtual bool LoadEditFromFile( RString sEditFilePath, ProfileSlot slot, bool bAddStepsToSong, Song *givenSong=NULL ); + virtual bool LoadEditFromFile( const RString &sEditFilePath, ProfileSlot slot, bool bAddStepsToSong, Song *givenSong=NULL ); virtual bool LoadEditFromBuffer( const RString &sBuffer, const RString &sEditFilePath, ProfileSlot slot, Song *givenSong=NULL ); virtual bool LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath, ProfileSlot slot, bool bAddStepsToSong, Song *givenSong=NULL ); virtual bool LoadFromBGChangesString(BackgroundChange &change, @@ -74,7 +74,7 @@ struct SMLoader * @param line the string in question. * @param rowsPerBeat the number of rows per beat for this purpose. */ void ParseBPMs(vector< pair > &out, - const RString line, + const RString &line, const int rowsPerBeat = -1); /** * @brief Process the BPM Segments from the string. @@ -110,7 +110,7 @@ struct SMLoader * @param line the string in question. * @param rowsPerBeat the number of rows per beat for this purpose. */ void ProcessDelays(TimingData & out, - const RString line, + const RString &line, const int rowsPerBeat = -1); /** * @brief Process the Time Signature Segments from the string. @@ -118,7 +118,7 @@ struct SMLoader * @param line the string in question. * @param rowsPerBeat the number of rows per beat for this purpose. */ void ProcessTimeSignatures(TimingData & out, - const RString line, + const RString &line, const int rowsPerBeat = -1); /** * @brief Process the Tickcount Segments from the string. @@ -126,7 +126,7 @@ struct SMLoader * @param line the string in question. * @param rowsPerBeat the number of rows per beat for this purpose. */ void ProcessTickcounts(TimingData & out, - const RString line, + const RString &line, const int rowsPerBeat = -1); /** @@ -135,11 +135,11 @@ struct SMLoader * @param line the string in question. * @param rowsPerBeat the number of rows per beat for this purpose. */ virtual void ProcessSpeeds(TimingData & out, - const RString line, + const RString &line, const int rowsPerBeat = -1); virtual void ProcessCombos(TimingData & /* out */, - const RString line, + const RString &line, const int /* rowsPerBeat */ = -1) {} /** @@ -148,7 +148,7 @@ struct SMLoader * @param line the string in question. * @param rowsPerBeat the number of rows per beat for this purpose. */ virtual void ProcessFakes(TimingData & out, - const RString line, + const RString &line, const int rowsPerBeat = -1); virtual void ProcessBGChanges( Song &out, const RString &sValueName, @@ -174,7 +174,7 @@ struct SMLoader * @param line The line that contains the value. * @param rowsPerBeat the number of rows per beat according to the original file. * @return the converted beat value. */ - float RowToBeat(RString line, const int rowsPerBeat); + float RowToBeat(const RString &line, const int rowsPerBeat); protected: /** @@ -186,12 +186,12 @@ struct SMLoader * @param radarValues the calculated radar values. * @param noteData the note data itself. * @param out the Steps getting the data. */ - virtual void LoadFromTokens(RString sStepsType, - RString sDescription, - RString sDifficulty, - RString sMeter, - RString sRadarValues, - RString sNoteData, + virtual void LoadFromTokens(RString &sStepsType, + RString &sDescription, + RString &sDifficulty, + RString &sMeter, + RString &sRadarValues, + RString &sNoteData, Steps &out); /** diff --git a/src/NotesLoaderSMA.cpp b/src/NotesLoaderSMA.cpp index 57216c60be..1e869a7350 100644 --- a/src/NotesLoaderSMA.cpp +++ b/src/NotesLoaderSMA.cpp @@ -14,7 +14,7 @@ #include "Steps.h" #include "Attack.h" -void SMALoader::ProcessMultipliers( TimingData &out, const int iRowsPerBeat, const RString sParam ) +void SMALoader::ProcessMultipliers( TimingData &out, const int iRowsPerBeat, const RString &sParam ) { vector arrayMultiplierExpressions; split( sParam, ",", arrayMultiplierExpressions ); @@ -42,7 +42,7 @@ void SMALoader::ProcessMultipliers( TimingData &out, const int iRowsPerBeat, con } } -void SMALoader::ProcessBeatsPerMeasure( TimingData &out, const RString sParam ) +void SMALoader::ProcessBeatsPerMeasure( TimingData &out, const RString &sParam ) { vector vs1; split( sParam, ",", vs1 ); @@ -84,7 +84,7 @@ void SMALoader::ProcessBeatsPerMeasure( TimingData &out, const RString sParam ) } } -void SMALoader::ProcessSpeeds( TimingData &out, const RString line, const int rowsPerBeat ) +void SMALoader::ProcessSpeeds( TimingData &out, const RString &line, const int rowsPerBeat ) { vector vs1; split( line, ",", vs1 ); diff --git a/src/NotesLoaderSMA.h b/src/NotesLoaderSMA.h index 844731905d..bce8f83e9d 100644 --- a/src/NotesLoaderSMA.h +++ b/src/NotesLoaderSMA.h @@ -18,14 +18,14 @@ struct SMALoader : public SMLoader virtual bool LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache = false ); - void ProcessBeatsPerMeasure( TimingData &out, const RString sParam ); - void ProcessMultipliers( TimingData &out, const int iRowsPerBeat, const RString sParam ); + void ProcessBeatsPerMeasure( TimingData &out, const RString &sParam ); + void ProcessMultipliers( TimingData &out, const int iRowsPerBeat, const RString &sParam ); /** * @brief Process the Speed Segments from the string. * @param out the TimingData being modified. * @param line the string in question. * @param rowsPerBeat the number of rows per beat for this purpose. */ - virtual void ProcessSpeeds( TimingData &out, const RString line, const int rowsPerBeat ); + virtual void ProcessSpeeds( TimingData &out, const RString &line, const int rowsPerBeat ); }; #endif diff --git a/src/NotesLoaderSSC.cpp b/src/NotesLoaderSSC.cpp index 07a11a0346..ebbee41001 100644 --- a/src/NotesLoaderSSC.cpp +++ b/src/NotesLoaderSSC.cpp @@ -645,7 +645,7 @@ ssc_parser_helper_t parser_helper; // End parser_helper related functions. -Kyz /****************************************************************/ -void SSCLoader::ProcessBPMs( TimingData &out, const RString sParam ) +void SSCLoader::ProcessBPMs( TimingData &out, const RString &sParam ) { vector arrayBPMExpressions; split( sParam, ",", arrayBPMExpressions ); @@ -679,7 +679,7 @@ void SSCLoader::ProcessBPMs( TimingData &out, const RString sParam ) } } -void SSCLoader::ProcessStops( TimingData &out, const RString sParam ) +void SSCLoader::ProcessStops( TimingData &out, const RString &sParam ) { vector arrayStopExpressions; split( sParam, ",", arrayStopExpressions ); @@ -711,7 +711,7 @@ void SSCLoader::ProcessStops( TimingData &out, const RString sParam ) } } -void SSCLoader::ProcessWarps( TimingData &out, const RString sParam, const float fVersion ) +void SSCLoader::ProcessWarps( TimingData &out, const RString &sParam, const float fVersion ) { vector arrayWarpExpressions; split( sParam, ",", arrayWarpExpressions ); @@ -748,7 +748,7 @@ void SSCLoader::ProcessWarps( TimingData &out, const RString sParam, const float } } -void SSCLoader::ProcessLabels( TimingData &out, const RString sParam ) +void SSCLoader::ProcessLabels( TimingData &out, const RString &sParam ) { vector arrayLabelExpressions; split( sParam, ",", arrayLabelExpressions ); @@ -782,7 +782,7 @@ void SSCLoader::ProcessLabels( TimingData &out, const RString sParam ) } } -void SSCLoader::ProcessCombos( TimingData &out, const RString line, const int rowsPerBeat ) +void SSCLoader::ProcessCombos( TimingData &out, const RString &line, const int rowsPerBeat ) { vector arrayComboExpressions; split( line, ",", arrayComboExpressions ); @@ -1051,7 +1051,7 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach return true; } -bool SSCLoader::LoadEditFromFile( RString sEditFilePath, ProfileSlot slot, bool bAddStepsToSong, Song *givenSong /* =NULL */ ) +bool SSCLoader::LoadEditFromFile( const RString &sEditFilePath, ProfileSlot slot, bool bAddStepsToSong, Song *givenSong /* =NULL */ ) { LOG->Trace( "SSCLoader::LoadEditFromFile(%s)", sEditFilePath.c_str() ); diff --git a/src/NotesLoaderSSC.h b/src/NotesLoaderSSC.h index 7a63914dac..95c14d901d 100644 --- a/src/NotesLoaderSSC.h +++ b/src/NotesLoaderSSC.h @@ -58,7 +58,7 @@ struct SSCLoader : public SMLoader * @param bAddStepsToSong a flag to determine if we add the edit steps to the song file. * @return its success or failure. */ - bool LoadEditFromFile( RString sEditFilePath, ProfileSlot slot, bool bAddStepsToSong, Song *givenSong=NULL ); + bool LoadEditFromFile( const RString &sEditFilePath, ProfileSlot slot, bool bAddStepsToSong, Song *givenSong=NULL ); /** * @brief Attempt to parse the edit file in question. * @param msd the edit file itself. @@ -76,11 +76,11 @@ struct SSCLoader : public SMLoader * @return true if successful, false otherwise. */ virtual bool LoadNoteDataFromSimfile( const RString &cachePath, Steps &out ); - void ProcessBPMs( TimingData &, const RString ); - void ProcessStops( TimingData &, const RString ); - void ProcessWarps( TimingData &, const RString, const float ); - void ProcessLabels( TimingData &, const RString ); - virtual void ProcessCombos( TimingData &, const RString, const int = -1 ); + void ProcessBPMs( TimingData &, const RString &sParam ); + void ProcessStops( TimingData &, const RString &sParam ); + void ProcessWarps( TimingData &, const RString &sParam, const float ); + void ProcessLabels( TimingData &, const RString ¶m ); + virtual void ProcessCombos( TimingData &, const RString &line, const int = -1 ); void ProcessScrolls( TimingData &, const RString ); }; diff --git a/src/NotesWriterDWI.cpp b/src/NotesWriterDWI.cpp index 3704aaf208..3206f898dd 100644 --- a/src/NotesWriterDWI.cpp +++ b/src/NotesWriterDWI.cpp @@ -342,7 +342,7 @@ static bool WriteDWINotesTag( RageFile &f, const Steps &out ) return true; } -bool NotesWriterDWI::Write( RString sPath, const Song &out ) +bool NotesWriterDWI::Write( const RString &sPath, const Song &out ) { RageFile f; if( !f.Open( sPath, RageFile::WRITE ) ) diff --git a/src/NotesWriterDWI.h b/src/NotesWriterDWI.h index 9bfda58301..f6d131eafd 100644 --- a/src/NotesWriterDWI.h +++ b/src/NotesWriterDWI.h @@ -10,7 +10,7 @@ namespace NotesWriterDWI * @param sPath the path to write the file. * @param out the Song to be written out. * @return its success or failure. */ - bool Write( RString sPath, const Song &out ); + bool Write( const RString &sPath, const Song &out ); } #endif diff --git a/src/NotesWriterSM.cpp b/src/NotesWriterSM.cpp index f03affbb22..41cab1e2f9 100644 --- a/src/NotesWriterSM.cpp +++ b/src/NotesWriterSM.cpp @@ -252,7 +252,7 @@ static RString GetSMNotesTag( const Song &song, const Steps &in ) return JoinLineList( lines ); } -bool NotesWriterSM::Write( RString sPath, Song &out, const vector& vpStepsToSave ) +bool NotesWriterSM::Write( const RString &sPath, Song &out, const vector& vpStepsToSave ) { int flags = RageFile::WRITE; diff --git a/src/NotesWriterSM.h b/src/NotesWriterSM.h index 580953cdac..39158c1800 100644 --- a/src/NotesWriterSM.h +++ b/src/NotesWriterSM.h @@ -11,7 +11,7 @@ namespace NotesWriterSM * @param sPath the path to write the file. * @param out the Song to be written out. * @return its success or failure. */ - bool Write( RString sPath, Song &out, const vector& vpStepsToSave ); + bool Write( const RString &sPath, Song &out, const vector& vpStepsToSave ); /** * @brief Get some contents about the edit file first. * @param pSong the Song in question. diff --git a/src/NotesWriterSSC.cpp b/src/NotesWriterSSC.cpp index 7a1b3b15f2..b619e9a01f 100644 --- a/src/NotesWriterSSC.cpp +++ b/src/NotesWriterSSC.cpp @@ -434,7 +434,7 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa return JoinLineList( lines ); } -bool NotesWriterSSC::Write( RString sPath, const Song &out, const vector& vpStepsToSave, bool bSavingCache ) +bool NotesWriterSSC::Write( RString &sPath, const Song &out, const vector& vpStepsToSave, bool bSavingCache ) { int flags = RageFile::WRITE; diff --git a/src/NotesWriterSSC.h b/src/NotesWriterSSC.h index 4fdac9bef7..ea70d55a03 100644 --- a/src/NotesWriterSSC.h +++ b/src/NotesWriterSSC.h @@ -13,7 +13,7 @@ namespace NotesWriterSSC * @param vpStepsToSave the Steps to save. * @param bSavingCache a flag to see if we're saving certain cache data. * @return its success or failure. */ - bool Write( RString sPath, const Song &out, const vector& vpStepsToSave, bool bSavingCache ); + bool Write( RString &sPath, const Song &out, const vector& vpStepsToSave, bool bSavingCache ); /** * @brief Get some contents about the edit file first. * @param pSong the Song in question. diff --git a/src/OptionRow.cpp b/src/OptionRow.cpp index 74aaabd17d..88a80fbc9f 100644 --- a/src/OptionRow.cpp +++ b/src/OptionRow.cpp @@ -825,7 +825,7 @@ bool OptionRow::GoToFirstOnStart() return m_pHand->GoToFirstOnStart(); } -void OptionRow::SetExitText( RString sExitText ) +void OptionRow::SetExitText( const RString &sExitText ) { BitmapText *bt = m_textItems.back(); bt->SetText( sExitText ); diff --git a/src/OptionRow.h b/src/OptionRow.h index 2992d97f5b..b4e27e5c31 100644 --- a/src/OptionRow.h +++ b/src/OptionRow.h @@ -116,7 +116,7 @@ class OptionRow : public ActorFrame RString GetThemedItemText( int iChoice ) const; - void SetExitText( RString sExitText ); + void SetExitText( const RString &sExitText ); void Reload(); diff --git a/src/OptionsList.cpp b/src/OptionsList.cpp index 80f2410217..0a5bdb73f1 100644 --- a/src/OptionsList.cpp +++ b/src/OptionsList.cpp @@ -181,7 +181,7 @@ OptionsList::~OptionsList() delete hand->second; } -void OptionsList::Load( RString sType, PlayerNumber pn ) +void OptionsList::Load( const RString &sType, PlayerNumber pn ) { TOP_MENU.Load( sType, "TopMenu" ); @@ -296,7 +296,7 @@ const OptionRowHandler *OptionsList::GetCurrentHandler() return m_Rows[sCurrentRow]; } -int OptionsList::GetOneSelection( RString sRow, bool bAllowFail ) const +int OptionsList::GetOneSelection( const RString &sRow, bool bAllowFail ) const { map >::const_iterator it = m_bSelections.find(sRow); ASSERT_M( it != m_bSelections.end(), sRow ); @@ -523,7 +523,7 @@ void OptionsList::TweenOnCurrentRow( bool bForward ) NewRow.PlayCommand( "TweenInBackward" ); } -void OptionsList::ImportRow( RString sRow ) +void OptionsList::ImportRow( const RString &sRow ) { vector aSelections[NUM_PLAYERS]; vector vpns; @@ -537,7 +537,7 @@ void OptionsList::ImportRow( RString sRow ) fill( m_bSelections[sRow].begin(), m_bSelections[sRow].end(), false ); } -void OptionsList::ExportRow( RString sRow ) +void OptionsList::ExportRow( const RString &sRow ) { if( m_setTopMenus.find(sRow) != m_setTopMenus.end() ) return; @@ -567,7 +567,7 @@ void OptionsList::SetDefaultCurrentRow() } } -int OptionsList::FindScreenInHandler( const OptionRowHandler *pHandler, RString sScreen ) +int OptionsList::FindScreenInHandler( const OptionRowHandler *pHandler, const RString &sScreen ) { for( size_t i = 0; i < pHandler->m_Def.m_vsChoices.size(); ++i ) { @@ -602,7 +602,7 @@ void OptionsList::Pop() TweenOnCurrentRow( false ); } -void OptionsList::Push( RString sDest ) +void OptionsList::Push( const RString &sDest ) { m_asMenuStack.push_back( sDest ); SetDefaultCurrentRow(); diff --git a/src/OptionsList.h b/src/OptionsList.h index 6a03f166fb..da47274695 100644 --- a/src/OptionsList.h +++ b/src/OptionsList.h @@ -44,7 +44,7 @@ class OptionsList: public ActorFrame OptionsList(); ~OptionsList(); - void Load( RString sType, PlayerNumber pn ); + void Load( const RString &sType, PlayerNumber pn ); void Reset(); void Link( OptionsList *pLink ) { m_pLinked = pLink; } @@ -71,15 +71,15 @@ class OptionsList: public ActorFrame void UpdateMenuFromSelections(); RString GetCurrentRow() const; const OptionRowHandler *GetCurrentHandler(); - int GetOneSelection( RString sRow, bool bAllowFail=false ) const; + int GetOneSelection( const RString &sRow, bool bAllowFail=false ) const; void SwitchToCurrentRow(); void TweenOnCurrentRow( bool bForward ); void SetDefaultCurrentRow(); - void Push( RString sDest ); + void Push( const RString &sDest ); void Pop(); - void ImportRow( RString sRow ); - void ExportRow( RString sRow ); - static int FindScreenInHandler( const OptionRowHandler *pHandler, RString sScreen ); + void ImportRow( const RString &sRow ); + void ExportRow( const RString &sRow ); + static int FindScreenInHandler( const OptionRowHandler *pHandler, const RString &sScreen ); InputQueueCodeSet m_Codes; diff --git a/src/Player.cpp b/src/Player.cpp index 3cfae16382..1b7e3ca9a6 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -491,7 +491,6 @@ void Player::Init( m_soundAttackLaunch.SetProperty( "Pan", fBalance ); m_soundAttackEnding.SetProperty( "Pan", fBalance ); - if( HasVisibleParts() ) { LuaThreadVariable var( "Player", LuaReference::Create(m_pPlayerState->m_PlayerNumber) ); @@ -669,7 +668,7 @@ void Player::Load() // Mina garbage - Mina m_Timing = GAMESTATE->m_pCurSteps[pn]->GetTimingData(); m_Timing->NegStopAndBPMCheck(); - m_Timing->SetElapsedTimesAtAllRows(GAMESTATE->m_pCurSteps[pn]->GetElapsedTimesAtAllRows()); + m_Timing->SetElapsedTimesAtAllRows(GAMESTATE->m_pCurSteps[pn]->ElapsedTimesAtAllRows); /* Apply transforms. */ NoteDataUtil::TransformNoteData(m_NoteData, *m_Timing, m_pPlayerState->m_PlayerOptions.GetStage(), GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->m_StepsType); @@ -1454,10 +1453,10 @@ void Player::UpdateHoldNotes( int iSongRow, float fDeltaTime, vector *pVolume = Preference::GetPreferenceByName("SoundVolume"); + static Preference *pVolume = Preference::GetPreferenceByName("SoundVolume"); if (pVolume != NULL) { - float fVol = pVolume->Get(); + static float fVol = pVolume->Get(); if( tn.iKeysoundIndex >= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() ) { @@ -1959,8 +1958,8 @@ void Player::PlayKeysound( const TapNote &tn, TapNoteScore score ) } } m_vKeysounds[tn.iKeysoundIndex].Play(false); - Preference *pVolume = Preference::GetPreferenceByName("SoundVolume"); - float fVol = pVolume->Get(); + static Preference *pVolume = Preference::GetPreferenceByName("SoundVolume"); + static float fVol = pVolume->Get(); m_vKeysounds[tn.iKeysoundIndex].SetProperty ("Volume", fVol); } } diff --git a/src/Profile.cpp b/src/Profile.cpp index df9f8243df..15160d6eef 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -220,7 +220,7 @@ Character *Profile::GetCharacter() const return CHARMAN->GetDefaultCharacter(); } -void Profile::SetCharacter(const RString sCharacterID) +void Profile::SetCharacter(const RString &sCharacterID) { if(CHARMAN->GetCharacterFromID(sCharacterID)) m_sCharacterID = sCharacterID; @@ -549,7 +549,7 @@ void Profile::SetDefaultModifiers( const Game* pGameType, const RString &sModifi m_sDefaultModifiers[pGameType->m_szName] = sModifiers; } -bool Profile::IsCodeUnlocked( RString sUnlockEntryID ) const +bool Profile::IsCodeUnlocked( const RString &sUnlockEntryID ) const { return m_UnlockedEntryIDs.find( sUnlockEntryID ) != m_UnlockedEntryIDs.end(); } @@ -1044,7 +1044,7 @@ void Profile::IncrementCategoryPlayCount( StepsType st, RankingCategory rc ) if( X==NULL ) LOG->Warn("Failed to read section " #X); \ else Load##X##FromNode(X); } -void Profile::LoadCustomFunction( RString sDir ) +void Profile::LoadCustomFunction( const RString &sDir ) { /* Get the theme's custom load function: * [Profile] @@ -1132,7 +1132,7 @@ void Profile::HandleStatsPrefixChange(RString dir, bool require_signature) } } -ProfileLoadResult Profile::LoadAllFromDir( RString sDir, bool bRequireSignature ) +ProfileLoadResult Profile::LoadAllFromDir( const RString &sDir, bool bRequireSignature ) { LOG->Trace( "Profile::LoadAllFromDir( %s )", sDir.c_str() ); @@ -1155,7 +1155,7 @@ ProfileLoadResult Profile::LoadAllFromDir( RString sDir, bool bRequireSignature ProfileLoadResult Profile::LoadStatsFromDir(RString dir, bool require_signature) { - dir= dir + PROFILEMAN->GetStatsPrefix(); + dir += PROFILEMAN->GetStatsPrefix(); // Check for the existance of stats.xml RString fn = dir + STATS_XML; bool compressed = false; @@ -1236,7 +1236,7 @@ ProfileLoadResult Profile::LoadStatsFromDir(RString dir, bool require_signature) return LoadStatsXmlFromNode(&xml); } -void Profile::LoadTypeFromDir(RString dir) +void Profile::LoadTypeFromDir(const RString &dir) { m_Type= ProfileType_Normal; m_ListPriority= 0; @@ -1309,7 +1309,7 @@ ProfileLoadResult Profile::LoadStatsXmlFromNode( const XNode *xml, bool bIgnoreE return ProfileLoadResult_Success; } -bool Profile::SaveAllToDir( RString sDir, bool bSignData ) const +bool Profile::SaveAllToDir( const RString &sDir, bool bSignData ) const { m_sLastPlayedMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid; m_LastPlayedDate = DateTime::GetNowDate(); @@ -1373,7 +1373,7 @@ bool Profile::SaveStatsXmlToDir( RString sDir, bool bSignData ) const LOG->Trace( "SaveStatsXmlToDir: %s", sDir.c_str() ); auto_ptr xml( SaveStatsXmlCreateNode() ); - sDir= sDir + PROFILEMAN->GetStatsPrefix(); + sDir += PROFILEMAN->GetStatsPrefix(); // Save stats.xml RString fn = sDir + (g_bProfileDataCompress? STATS_XML_GZ:STATS_XML); @@ -1424,7 +1424,7 @@ bool Profile::SaveStatsXmlToDir( RString sDir, bool bSignData ) const return true; } -void Profile::SaveTypeToDir(RString dir) const +void Profile::SaveTypeToDir(const RString &dir) const { IniFile ini; ini.SetValue("ListPosition", "Type", ProfileTypeToString(m_Type)); @@ -1432,7 +1432,7 @@ void Profile::SaveTypeToDir(RString dir) const ini.WriteFile(dir + TYPE_INI); } -void Profile::SaveEditableDataToDir( RString sDir ) const +void Profile::SaveEditableDataToDir( const RString &sDir ) const { IniFile ini; @@ -1605,7 +1605,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const return pGeneralDataNode; } -ProfileLoadResult Profile::LoadEditableDataFromDir( RString sDir ) +ProfileLoadResult Profile::LoadEditableDataFromDir( const RString &sDir ) { RString fn = sDir + EDITABLE_INI; @@ -2170,12 +2170,12 @@ void Profile::LoadCategoryScoresFromNode( const XNode* pCategoryScores ) } } -void Profile::SaveStatsWebPageToDir( RString ) const +void Profile::SaveStatsWebPageToDir( const RString &sDir) const { ASSERT( PROFILEMAN != NULL ); } -void Profile::SaveMachinePublicKeyToDir( RString sDir ) const +void Profile::SaveMachinePublicKeyToDir( const RString &sDir ) const { if( PREFSMAN->m_bSignProfileData && IsAFile(CRYPTMAN->GetPublicKeyFileName()) ) FileCopy( CRYPTMAN->GetPublicKeyFileName(), sDir+PUBLIC_KEY_FILE ); @@ -2409,7 +2409,7 @@ XNode* Profile::SaveCoinDataCreateNode() const return pNode; } -void Profile::MoveBackupToDir( RString sFromDir, RString sToDir ) +void Profile::MoveBackupToDir( const RString &sFromDir, const RString &sToDir ) { if( FILEMAN->IsAFile(sFromDir + STATS_XML) && FILEMAN->IsAFile(sFromDir+STATS_XML+SIGNATURE_APPEND) ) @@ -2430,7 +2430,7 @@ void Profile::MoveBackupToDir( RString sFromDir, RString sToDir ) FILEMAN->Move( sFromDir+DONT_SHARE_SIG, sToDir+DONT_SHARE_SIG ); } -RString Profile::MakeUniqueFileNameNoExtension( RString sDir, RString sFileNameBeginning ) +RString Profile::MakeUniqueFileNameNoExtension( const RString &sDir, const RString &sFileNameBeginning ) { FILEMAN->FlushDirCache( sDir ); // Find a file name for the screenshot @@ -2455,7 +2455,7 @@ RString Profile::MakeUniqueFileNameNoExtension( RString sDir, RString sFileNameB return MakeFileNameNoExtension( sFileNameBeginning, iIndex ); } -RString Profile::MakeFileNameNoExtension( RString sFileNameBeginning, int iIndex ) +RString Profile::MakeFileNameNoExtension( const RString &sFileNameBeginning, int iIndex ) { return sFileNameBeginning + ssprintf( "%05d", iIndex ); } diff --git a/src/Profile.h b/src/Profile.h index 45c17bd642..8a8e3abf13 100644 --- a/src/Profile.h +++ b/src/Profile.h @@ -137,7 +137,7 @@ class Profile // smart accessors RString GetDisplayNameOrHighScoreName() const; Character *GetCharacter() const; - void SetCharacter(const RString sCharacterID); + void SetCharacter(const RString &sCharacterID); RString GetDisplayTotalCaloriesBurned() const; // remove me and use Lua instead RString GetDisplayTotalCaloriesBurnedToday() const; // remove me and use Lua instead int GetCalculatedWeightPounds() const; // returns a default value if m_iWeightPounds isn't set @@ -155,7 +155,7 @@ class Profile float GetSongsAndCoursesPercentCompleteAllDifficulties( StepsType st ) const; bool GetDefaultModifiers( const Game* pGameType, RString &sModifiersOut ) const; void SetDefaultModifiers( const Game* pGameType, const RString &sModifiers ); - bool IsCodeUnlocked( RString sUnlockEntryID ) const; + bool IsCodeUnlocked( const RString &sUnlockEntryID ) const; Song *GetMostPopularSong() const; Course *GetMostPopularCourse() const; @@ -391,13 +391,13 @@ class Profile // Loading and saving void HandleStatsPrefixChange(RString dir, bool require_signature); - ProfileLoadResult LoadAllFromDir( RString sDir, bool bRequireSignature ); + ProfileLoadResult LoadAllFromDir( const RString &sDir, bool bRequireSignature ); ProfileLoadResult LoadStatsFromDir(RString dir, bool require_signature); - void LoadTypeFromDir(RString dir); - void LoadCustomFunction( RString sDir ); - bool SaveAllToDir( RString sDir, bool bSignData ) const; + void LoadTypeFromDir(const RString &dir); + void LoadCustomFunction( const RString &sDir ); + bool SaveAllToDir( const RString &sDir, bool bSignData ) const; - ProfileLoadResult LoadEditableDataFromDir( RString sDir ); + ProfileLoadResult LoadEditableDataFromDir( const RString &sDir ); ProfileLoadResult LoadStatsXmlFromNode( const XNode* pNode, bool bIgnoreEditable = true ); void LoadGeneralDataFromNode( const XNode* pNode ); void LoadSongScoresFromNode( const XNode* pNode ); @@ -406,8 +406,8 @@ class Profile void LoadScreenshotDataFromNode( const XNode* pNode ); void LoadCalorieDataFromNode( const XNode* pNode ); - void SaveTypeToDir(RString dir) const; - void SaveEditableDataToDir( RString sDir ) const; + void SaveTypeToDir(const RString &dir) const; + void SaveEditableDataToDir( const RString &sDir ) const; bool SaveStatsXmlToDir( RString sDir, bool bSignData ) const; XNode* SaveStatsXmlCreateNode() const; XNode* SaveGeneralDataCreateNode() const; @@ -419,12 +419,12 @@ class Profile XNode* SaveCoinDataCreateNode() const; - void SaveStatsWebPageToDir( RString sDir ) const; - void SaveMachinePublicKeyToDir( RString sDir ) const; + void SaveStatsWebPageToDir( const RString &sDir ) const; + void SaveMachinePublicKeyToDir( const RString &sDir ) const; - static void MoveBackupToDir( RString sFromDir, RString sToDir ); - static RString MakeUniqueFileNameNoExtension( RString sDir, RString sFileNameBeginning ); - static RString MakeFileNameNoExtension( RString sFileNameBeginning, int iIndex ); + static void MoveBackupToDir( const RString &sFromDir, const RString &sToDir ); + static RString MakeUniqueFileNameNoExtension( const RString &sDir, const RString &sFileNameBeginning ); + static RString MakeFileNameNoExtension( const RString &sFileNameBeginning, int iIndex ); // Lua void PushSelf( lua_State *L ); diff --git a/src/ProfileManager.cpp b/src/ProfileManager.cpp index c673e61a0e..de1c8532b0 100644 --- a/src/ProfileManager.cpp +++ b/src/ProfileManager.cpp @@ -143,7 +143,7 @@ bool ProfileManager::FixedProfiles() const return FIXED_PROFILES; } -ProfileLoadResult ProfileManager::LoadProfile( PlayerNumber pn, RString sProfileDir, bool bIsMemCard ) +ProfileLoadResult ProfileManager::LoadProfile( PlayerNumber pn, const RString &sProfileDir, bool bIsMemCard ) { LOG->Trace( "LoadingProfile P%d, %s, %d", pn+1, sProfileDir.c_str(), bIsMemCard ); @@ -302,7 +302,7 @@ bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn, bool bLoadEdits } -bool ProfileManager::FastLoadProfileNameFromMemoryCard( RString sRootDir, RString &sName ) const +bool ProfileManager::FastLoadProfileNameFromMemoryCard( const RString &sRootDir, RString &sName ) const { vector asDirsToTry; GetMemoryCardProfileDirectoriesToTry( asDirsToTry ); @@ -350,7 +350,7 @@ bool ProfileManager::SaveProfile( PlayerNumber pn ) const return b; } -bool ProfileManager::SaveLocalProfile( RString sProfileID ) +bool ProfileManager::SaveLocalProfile( const RString &sProfileID ) { const Profile *pProfile = GetLocalProfile( sProfileID ); ASSERT( pProfile != NULL ); @@ -484,7 +484,7 @@ const Profile *ProfileManager::GetLocalProfile( const RString &sProfileID ) cons return NULL; } -bool ProfileManager::CreateLocalProfile( RString sName, RString &sProfileIDOut ) +bool ProfileManager::CreateLocalProfile( const RString &sName, RString &sProfileIDOut ) { ASSERT( !sName.empty() ); @@ -574,7 +574,7 @@ static void InsertProfileIntoList(DirAndProfile& derp) } } -void ProfileManager::AddLocalProfileByID( Profile *pProfile, RString sProfileID ) +void ProfileManager::AddLocalProfileByID( Profile *pProfile, const RString &sProfileID ) { // make sure this id doesn't already exist ASSERT_M( GetLocalProfile(sProfileID) == NULL, @@ -587,7 +587,7 @@ void ProfileManager::AddLocalProfileByID( Profile *pProfile, RString sProfileID InsertProfileIntoList(derp); } -bool ProfileManager::RenameLocalProfile( RString sProfileID, RString sNewName ) +bool ProfileManager::RenameLocalProfile( const RString &sProfileID, const RString &sNewName ) { ASSERT( !sProfileID.empty() ); @@ -599,7 +599,7 @@ bool ProfileManager::RenameLocalProfile( RString sProfileID, RString sNewName ) return pProfile->SaveAllToDir( sProfileDir, PREFSMAN->m_bSignProfileData ); } -bool ProfileManager::DeleteLocalProfile( RString sProfileID ) +bool ProfileManager::DeleteLocalProfile( const RString &sProfileID ) { Profile *pProfile = ProfileManager::GetLocalProfile( sProfileID ); ASSERT( pProfile != NULL ); @@ -978,7 +978,7 @@ void ProfileManager::GetLocalProfileDisplayNames( vector &vsProfileDisp vsProfileDisplayNamesOut.push_back( i->profile.m_sDisplayName ); } -int ProfileManager::GetLocalProfileIndexFromID( RString sProfileID ) const +int ProfileManager::GetLocalProfileIndexFromID( const RString &sProfileID ) const { RString sDir = LocalProfileIDToDir( sProfileID ); FOREACH_CONST( DirAndProfile, g_vLocalProfile, i ) diff --git a/src/ProfileManager.h b/src/ProfileManager.h index cf3bf8a4d0..74398c4172 100644 --- a/src/ProfileManager.h +++ b/src/ProfileManager.h @@ -34,13 +34,13 @@ class ProfileManager Profile *GetLocalProfileFromIndex( int iIndex ); RString GetLocalProfileIDFromIndex( int iIndex ); - bool CreateLocalProfile( RString sName, RString &sProfileIDOut ); - void AddLocalProfileByID( Profile *pProfile, RString sProfileID ); // transfers ownership of pProfile - bool RenameLocalProfile( RString sProfileID, RString sNewName ); - bool DeleteLocalProfile( RString sProfileID ); + bool CreateLocalProfile( const RString &sName, RString &sProfileIDOut ); + void AddLocalProfileByID( Profile *pProfile, const RString &sProfileID ); // transfers ownership of pProfile + bool RenameLocalProfile( const RString &sProfileID, const RString &sNewName ); + bool DeleteLocalProfile( const RString &sProfileID ); void GetLocalProfileIDs( vector &vsProfileIDsOut ) const; void GetLocalProfileDisplayNames( vector &vsProfileDisplayNamesOut ) const; - int GetLocalProfileIndexFromID( RString sProfileID ) const; + int GetLocalProfileIndexFromID( const RString &sProfileID ) const; int GetNumLocalProfiles() const; RString GetStatsPrefix() { return m_stats_prefix; } @@ -49,9 +49,9 @@ class ProfileManager bool LoadFirstAvailableProfile( PlayerNumber pn, bool bLoadEdits = true ); // memory card or local profile bool LoadLocalProfileFromMachine( PlayerNumber pn ); bool LoadProfileFromMemoryCard( PlayerNumber pn, bool bLoadEdits = true ); - bool FastLoadProfileNameFromMemoryCard( RString sRootDir, RString &sName ) const; + bool FastLoadProfileNameFromMemoryCard( const RString &sRootDir, RString &sName ) const; bool SaveProfile( PlayerNumber pn ) const; - bool SaveLocalProfile( RString sProfileID ); + bool SaveLocalProfile( const RString &sProfileID ); void UnloadProfile( PlayerNumber pn ); void MergeLocalProfiles(RString const& from_id, RString const& to_id); @@ -112,7 +112,7 @@ class ProfileManager static Preference1D m_sDefaultLocalProfileID; private: - ProfileLoadResult LoadProfile( PlayerNumber pn, RString sProfileDir, bool bIsMemCard ); + ProfileLoadResult LoadProfile( PlayerNumber pn, const RString &sProfileDir, bool bIsMemCard ); // Directory that contains the profile. Either on local machine or // on a memory card. diff --git a/src/RadarValues.cpp b/src/RadarValues.cpp index ea04503a8c..c7ca6c686f 100644 --- a/src/RadarValues.cpp +++ b/src/RadarValues.cpp @@ -84,7 +84,7 @@ RString RadarValues::ToString( int iMaxValues ) const return join( ",",asRadarValues ); } -void RadarValues::FromString( RString sRadarValues ) +void RadarValues::FromString( const RString &sRadarValues ) { vector saValues; split( sRadarValues, ",", saValues, true ); diff --git a/src/RadarValues.h b/src/RadarValues.h index 2825f29f08..95cde9cf7b 100644 --- a/src/RadarValues.h +++ b/src/RadarValues.h @@ -67,7 +67,7 @@ struct RadarValues void LoadFromNode( const XNode* pNode ); RString ToString( int iMaxValues = -1 ) const; // default = all - void FromString( RString sValues ); + void FromString( const RString &sValues ); static ThemeMetric WRITE_SIMPLE_VALIES; static ThemeMetric WRITE_COMPLEX_VALIES; diff --git a/src/RageBitmapTexture.cpp b/src/RageBitmapTexture.cpp index 79b19b64dd..df60b70505 100644 --- a/src/RageBitmapTexture.cpp +++ b/src/RageBitmapTexture.cpp @@ -37,7 +37,7 @@ static void GetResolutionFromFileName( RString sPath, int &iWidth, int &iHeight iHeight = maybe_height; } -RageBitmapTexture::RageBitmapTexture( RageTextureID name ) : +RageBitmapTexture::RageBitmapTexture( const RageTextureID &name ) : RageTexture( name ), m_uTexHandle(0) { Create(); diff --git a/src/RageBitmapTexture.h b/src/RageBitmapTexture.h index 49356c7351..f48264f95c 100644 --- a/src/RageBitmapTexture.h +++ b/src/RageBitmapTexture.h @@ -8,7 +8,7 @@ class RageBitmapTexture : public RageTexture { public: - RageBitmapTexture( RageTextureID name ); + RageBitmapTexture( const RageTextureID &name ); virtual ~RageBitmapTexture(); /* only called by RageTextureManager::InvalidateTextures */ virtual void Invalidate() { m_uTexHandle = 0; /* don't Destroy() */} diff --git a/src/RageDisplay.cpp b/src/RageDisplay.cpp index 6aa2e408e0..8378c0d437 100644 --- a/src/RageDisplay.cpp +++ b/src/RageDisplay.cpp @@ -749,7 +749,7 @@ void RageDisplay::UpdateCentering() (float) p.m_iTranslateX, (float) p.m_iTranslateY, (float) p.m_iAddWidth, (float) p.m_iAddHeight ); } -bool RageDisplay::SaveScreenshot( RString sPath, GraphicsFileFormat format ) +bool RageDisplay::SaveScreenshot( const RString &sPath, GraphicsFileFormat format ) { RageTimer timer; RageSurface *surface = this->CreateScreenshot(); @@ -950,7 +950,6 @@ void RageDisplay::FrameLimitBeforeVsync( int iFPS ) while (advanceDelay > 0.0) advanceDelay -= g_LastFrameEndedAt.GetDeltaTime(); } - } void RageDisplay::FrameLimitAfterVsync() diff --git a/src/RageDisplay.h b/src/RageDisplay.h index a834172c13..28e959909b 100644 --- a/src/RageDisplay.h +++ b/src/RageDisplay.h @@ -88,8 +88,8 @@ class VideoModeParams bool bSmoothLines_, bool bTrilinearFiltering_, bool bAnisotropicFiltering_, - RString sWindowTitle_, - RString sIconFile_, + const RString &sWindowTitle_, + const RString &sIconFile_, bool PAL_, float fDisplayAspectRatio_ ): @@ -311,7 +311,7 @@ class RageDisplay SAVE_LOSSY_LOW_QUAL, // jpg SAVE_LOSSY_HIGH_QUAL // jpg }; - bool SaveScreenshot( RString sPath, GraphicsFileFormat format ); + bool SaveScreenshot( const RString &sPath, GraphicsFileFormat format ); virtual RString GetTextureDiagnostics( unsigned /* id */ ) const { return RString(); } virtual RageSurface* CreateScreenshot() = 0; // allocates a surface. Caller must delete it. diff --git a/src/RageFileDriverDirectHelpers.cpp b/src/RageFileDriverDirectHelpers.cpp index 219878103c..02384b78fa 100644 --- a/src/RageFileDriverDirectHelpers.cpp +++ b/src/RageFileDriverDirectHelpers.cpp @@ -61,7 +61,7 @@ static bool WinMoveFileInternal( const RString &sOldPath, const RString &sNewPat return !!MoveFile( sOldPath, sNewPath ); } -bool WinMoveFile( RString sOldPath, RString sNewPath ) +bool WinMoveFile( const RString &sOldPath, const RString &sNewPath ) { if( WinMoveFileInternal( DoPathReplace(sOldPath), DoPathReplace(sNewPath) ) ) return true; @@ -75,7 +75,7 @@ bool WinMoveFile( RString sOldPath, RString sNewPath ) #endif /* mkdir -p. Doesn't fail if Path already exists and is a directory. */ -bool CreateDirectories( RString Path ) +bool CreateDirectories( const RString &Path ) { // XXX: handle "//foo/bar" paths in Windows vector parts; @@ -137,14 +137,14 @@ bool CreateDirectories( RString Path ) return true; } -DirectFilenameDB::DirectFilenameDB( RString root_ ) +DirectFilenameDB::DirectFilenameDB( const RString &root_ ) { ExpireSeconds = 30; SetRoot( root_ ); } -void DirectFilenameDB::SetRoot( RString root_ ) +void DirectFilenameDB::SetRoot( const RString &root_ ) { root = root_; diff --git a/src/RageFileDriverDirectHelpers.h b/src/RageFileDriverDirectHelpers.h index 7d37f08f2e..75357acd87 100644 --- a/src/RageFileDriverDirectHelpers.h +++ b/src/RageFileDriverDirectHelpers.h @@ -17,21 +17,21 @@ RString DoPathReplace( const RString &sPath ); #if defined(WIN32) -bool WinMoveFile( RString sOldPath, RString sNewPath ); +bool WinMoveFile( const RString &sOldPath, const RString &sNewPath ); #endif #if !defined(O_BINARY) #define O_BINARY 0 #endif -bool CreateDirectories( RString sPath ); +bool CreateDirectories( const RString &sPath ); #include "RageUtil_FileDB.h" class DirectFilenameDB: public FilenameDB { public: - DirectFilenameDB( RString root ); - void SetRoot( RString root ); + DirectFilenameDB( const RString &root ); + void SetRoot( const RString &root ); void CacheFile( const RString &sPath ); protected: virtual void PopulateFileSet( FileSet &fs, const RString &sPath ); diff --git a/src/RageFileManager.cpp b/src/RageFileManager.cpp index 733998bca9..92376da966 100644 --- a/src/RageFileManager.cpp +++ b/src/RageFileManager.cpp @@ -673,7 +673,7 @@ void RageFileManager::Unmount( const RString &sType, const RString &sRoot_, cons } } -void RageFileManager::Remount( RString sMountpoint, RString sPath ) +void RageFileManager::Remount( const RString &sMountpoint, const RString &sPath ) { RageFileDriver *pDriver = GetFileDriver( sMountpoint ); if( pDriver == NULL ) @@ -691,7 +691,7 @@ void RageFileManager::Remount( RString sMountpoint, RString sPath ) ReleaseFileDriver( pDriver ); } -bool RageFileManager::IsMounted( RString MountPoint ) +bool RageFileManager::IsMounted( const RString &MountPoint ) { LockMut( *g_Mutex ); diff --git a/src/RageFileManager.h b/src/RageFileManager.h index c6ef53520c..61b3ac68e1 100644 --- a/src/RageFileManager.h +++ b/src/RageFileManager.h @@ -55,8 +55,8 @@ class RageFileManager /* Change the root of a filesystem. Only a couple drivers support this; it's * used to change memory card mountpoints without having to actually unmount * the driver. */ - void Remount( RString sMountpoint, RString sPath ); - bool IsMounted( RString MountPoint ); + void Remount( const RString &sMountpoint, const RString &sPath ); + bool IsMounted( const RString &MountPoint ); struct DriverLocation { RString Type, Root, MountPoint; diff --git a/src/RageInputDevice.h b/src/RageInputDevice.h index 6c29b995e3..b2ac3f1fea 100644 --- a/src/RageInputDevice.h +++ b/src/RageInputDevice.h @@ -61,7 +61,7 @@ inline bool IsMouse( InputDevice id ) { return id == DEVICE_MOUSE; } struct InputDeviceInfo { - InputDeviceInfo( InputDevice id_, RString sDesc_ ): + InputDeviceInfo( InputDevice id_, const RString &sDesc_ ): id(id_), sDesc(sDesc_) {} InputDevice id; diff --git a/src/RageMath.cpp b/src/RageMath.cpp index b8d16e52d1..c1d1ff37b1 100644 --- a/src/RageMath.cpp +++ b/src/RageMath.cpp @@ -503,7 +503,7 @@ void RageQuatFromPRH(RageVector4* pOut, RageVector3 prh ) pOut->z = cX * cY * sZ - sX * sY * cZ; } -void RageMatrixFromQuat( RageMatrix* pOut, const RageVector4 q ) +void RageMatrixFromQuat( RageMatrix* pOut, const RageVector4 &q ) { // D3DXMatrixRotationQuaternion is slower float xx = q.x * (q.x + q.x); diff --git a/src/RageMath.h b/src/RageMath.h index 12b91fe556..fb40da06c1 100644 --- a/src/RageMath.h +++ b/src/RageMath.h @@ -40,7 +40,7 @@ void RageMatrixRotationXYZ( RageMatrix* pOut, float rX, float rY, float rZ ); void RageAARotate(RageVector3* inret, RageVector3 const* axis, float angle); void RageQuatFromHPR(RageVector4* pOut, RageVector3 hpr ); void RageQuatFromPRH(RageVector4* pOut, RageVector3 prh ); -void RageMatrixFromQuat( RageMatrix* pOut, const RageVector4 q ); +void RageMatrixFromQuat( RageMatrix* pOut, const RageVector4 &q ); void RageQuatSlerp(RageVector4 *pOut, const RageVector4 &from, const RageVector4 &to, float t); RageVector4 RageQuatFromH(float theta); RageVector4 RageQuatFromP(float theta); diff --git a/src/RageSound.cpp b/src/RageSound.cpp index de046aacdc..33ccf4b31f 100644 --- a/src/RageSound.cpp +++ b/src/RageSound.cpp @@ -155,14 +155,14 @@ class RageSoundReader_Silence: public RageSoundReader }; -bool RageSound::Load( RString sSoundFilePath ) +bool RageSound::Load( const RString &sSoundFilePath ) { /* Automatically determine whether to precache */ /* TODO: Hook this up to a pref? */ return Load( sSoundFilePath, false ); } -bool RageSound::Load( RString sSoundFilePath, bool bPrecache, const RageSoundLoadParams *pParams ) +bool RageSound::Load( const RString &sSoundFilePath, bool bPrecache, const RageSoundLoadParams *pParams ) { LOG->Trace( "RageSound: Load \"%s\" (precache: %i)", sSoundFilePath.c_str(), bPrecache ); diff --git a/src/RageSound.h b/src/RageSound.h index 28b32a08d7..d4407cad5b 100644 --- a/src/RageSound.h +++ b/src/RageSound.h @@ -98,11 +98,11 @@ class RageSound: public RageSoundBase * they can be ignored most of the time, so we continue to work if a file * is broken or missing. */ - bool Load( RString sFile, bool bPrecache, const RageSoundLoadParams *pParams = NULL ); + bool Load( const RString &sFile, bool bPrecache, const RageSoundLoadParams *pParams = NULL ); /* Using this version means the "don't care" about caching. Currently, * this always will not cache the sound; this may become a preference. */ - bool Load( RString sFile ); + bool Load( const RString &sFile ); /* Load a RageSoundReader that you've set up yourself. Sample rate conversion * will be set up only if needed. Doesn't fail. */ diff --git a/src/RageSoundReader_FileReader.cpp b/src/RageSoundReader_FileReader.cpp index 53afb856e5..f733c2c9e1 100644 --- a/src/RageSoundReader_FileReader.cpp +++ b/src/RageSoundReader_FileReader.cpp @@ -18,7 +18,7 @@ #include "RageSoundReader_Vorbisfile.h" #endif -RageSoundReader_FileReader *RageSoundReader_FileReader::TryOpenFile( RageFileBasic *pFile, RString &error, RString format, bool &bKeepTrying ) +RageSoundReader_FileReader *RageSoundReader_FileReader::TryOpenFile( RageFileBasic *pFile, RString &error, const RString &format, bool &bKeepTrying ) { RageSoundReader_FileReader *Sample = NULL; @@ -89,7 +89,7 @@ RageSoundReader_FileReader *RageSoundReader_FileReader::TryOpenFile( RageFileBas #include "RageFileDriverMemory.h" -RageSoundReader_FileReader *RageSoundReader_FileReader::OpenFile( RString filename, RString &error, bool *pPrebuffer ) +RageSoundReader_FileReader *RageSoundReader_FileReader::OpenFile( const RString &filename, RString &error, bool *pPrebuffer ) { HiddenPtr pFile; { diff --git a/src/RageSoundReader_FileReader.h b/src/RageSoundReader_FileReader.h index 7184939a33..98d6f8db61 100644 --- a/src/RageSoundReader_FileReader.h +++ b/src/RageSoundReader_FileReader.h @@ -34,14 +34,14 @@ class RageSoundReader_FileReader: public RageSoundReader /* Open a file. If pPrebuffer is non-NULL, and the file is sufficiently small, * the (possibly compressed) data will be loaded entirely into memory, and pPrebuffer * will be set to true. */ - static RageSoundReader_FileReader *OpenFile( RString filename, RString &error, bool *pPrebuffer = NULL ); + static RageSoundReader_FileReader *OpenFile( const RString &filename, RString &error, bool *pPrebuffer = NULL ); protected: - void SetError( RString sError ) const { m_sError = sError; } + void SetError( const RString &sError ) const { m_sError = sError; } HiddenPtr m_pFile; private: - static RageSoundReader_FileReader *TryOpenFile( RageFileBasic *pFile, RString &error, RString format, bool &bKeepTrying ); + static RageSoundReader_FileReader *TryOpenFile( RageFileBasic *pFile, RString &error, const RString &format, bool &bKeepTrying ); mutable RString m_sError; }; diff --git a/src/RageSurfaceUtils.cpp b/src/RageSurfaceUtils.cpp index 3060ec69af..a28a9a8b82 100644 --- a/src/RageSurfaceUtils.cpp +++ b/src/RageSurfaceUtils.cpp @@ -737,7 +737,7 @@ struct SurfaceHeader }; // Save and load RageSurfaces to disk, in a very fast, nonportable way. -bool RageSurfaceUtils::SaveSurface( const RageSurface *img, RString file ) +bool RageSurfaceUtils::SaveSurface( const RageSurface *img, const RString &file ) { RageFile f; if( !f.Open( file, RageFile::WRITE ) ) @@ -768,7 +768,7 @@ bool RageSurfaceUtils::SaveSurface( const RageSurface *img, RString file ) return true; } -RageSurface *RageSurfaceUtils::LoadSurface( RString file ) +RageSurface *RageSurfaceUtils::LoadSurface( const RString &file ) { RageFile f; if( !f.Open( file ) ) diff --git a/src/RageSurfaceUtils.h b/src/RageSurfaceUtils.h index 533d74e11a..268101d823 100644 --- a/src/RageSurfaceUtils.h +++ b/src/RageSurfaceUtils.h @@ -51,8 +51,8 @@ namespace RageSurfaceUtils void Blit( const RageSurface *src, RageSurface *dst, int width = -1, int height = -1 ); void CorrectBorderPixels( RageSurface *img, int width, int height ); - bool SaveSurface( const RageSurface *img, RString file ); - RageSurface *LoadSurface( RString file ); + bool SaveSurface( const RageSurface *img, const RString &file ); + RageSurface *LoadSurface( const RString &file ); /* Quickly palettize to an gray/alpha texture. */ RageSurface *PalettizeToGrayscale( const RageSurface *src_surf, int GrayBits, int AlphaBits ); diff --git a/src/RageTexture.cpp b/src/RageTexture.cpp index 55586ef849..6e77c036bf 100644 --- a/src/RageTexture.cpp +++ b/src/RageTexture.cpp @@ -6,7 +6,7 @@ #include -RageTexture::RageTexture( RageTextureID name ): +RageTexture::RageTexture( const RageTextureID &name ): m_iRefCount(1), m_bWasUsed(false), m_ID(name), m_iSourceWidth(0), m_iSourceHeight(0), m_iTextureWidth(0), m_iTextureHeight(0), @@ -42,7 +42,7 @@ void RageTexture::CreateFrameRects() } } -void RageTexture::GetFrameDimensionsFromFileName( RString sPath, int* piFramesWide, int* piFramesHigh, int source_width, int source_height ) +void RageTexture::GetFrameDimensionsFromFileName( const RString &sPath, int* piFramesWide, int* piFramesHigh, int source_width, int source_height ) { static Regex match( " ([0-9]+)x([0-9]+)([\\. ]|$)" ); vector asMatch; diff --git a/src/RageTexture.h b/src/RageTexture.h index 043cf03a7f..d9aea79c9a 100644 --- a/src/RageTexture.h +++ b/src/RageTexture.h @@ -10,7 +10,7 @@ struct lua_State; class RageTexture { public: - RageTexture( RageTextureID file ); + RageTexture( const RageTextureID &file ); virtual ~RageTexture() = 0; virtual void Update( float /* fDeltaTime */ ) {} virtual void Reload() {} @@ -61,7 +61,7 @@ class RageTexture // The ID that we were asked to load: const RageTextureID &GetID() const { return m_ID; } - static void GetFrameDimensionsFromFileName( RString sPath, int* puFramesWide, int* puFramesHigh, int source_width= 0, int source_height= 0 ); + static void GetFrameDimensionsFromFileName( const RString &sPath, int* puFramesWide, int* puFramesHigh, int source_width= 0, int source_height= 0 ); // Lua virtual void PushSelf( lua_State *L ); diff --git a/src/RageTextureManager.cpp b/src/RageTextureManager.cpp index a5bad909f4..42aa6fb5ed 100644 --- a/src/RageTextureManager.cpp +++ b/src/RageTextureManager.cpp @@ -100,7 +100,7 @@ void RageTextureManager::RegisterTexture( RageTextureID ID, RageTexture *pTextur m_texture_ids_by_pointer[pTexture]= ID; } -void RageTextureManager::RegisterTextureForUpdating(RageTextureID id, RageTexture* tex) +void RageTextureManager::RegisterTextureForUpdating(const RageTextureID &id, RageTexture* tex) { m_textures_to_update[id]= tex; } @@ -180,7 +180,7 @@ RageTexture* RageTextureManager::LoadTextureInternal( RageTextureID ID ) } /* Load a normal texture. Use this call to actually use a texture. */ -RageTexture* RageTextureManager::LoadTexture( RageTextureID ID ) +RageTexture* RageTextureManager::LoadTexture( const RageTextureID &ID ) { RageTexture* pTexture = LoadTextureInternal( ID ); if( pTexture ) @@ -194,7 +194,7 @@ RageTexture* RageTextureManager::CopyTexture( RageTexture *pCopy ) return pCopy; } -void RageTextureManager::VolatileTexture( RageTextureID ID ) +void RageTextureManager::VolatileTexture( const RageTextureID &ID ) { RageTexture* pTexture = LoadTextureInternal( ID ); pTexture->GetPolicy() = min( pTexture->GetPolicy(), RageTextureID::TEX_VOLATILE ); diff --git a/src/RageTextureManager.h b/src/RageTextureManager.h index 50cdd9ddfd..8ce36d094d 100644 --- a/src/RageTextureManager.h +++ b/src/RageTextureManager.h @@ -52,21 +52,21 @@ class RageTextureManager ~RageTextureManager(); void Update( float fDeltaTime ); - RageTexture* LoadTexture( RageTextureID ID ); + RageTexture* LoadTexture( const RageTextureID &ID ); RageTexture* CopyTexture( RageTexture *pCopy ); // returns a ref to the same texture, not a deep copy bool IsTextureRegistered( RageTextureID ID ) const; void RegisterTexture( RageTextureID ID, RageTexture *p ); - void VolatileTexture( RageTextureID ID ); + void VolatileTexture( const RageTextureID &ID ); void UnloadTexture( RageTexture *t ); void ReloadAll(); - void RegisterTextureForUpdating(RageTextureID id, RageTexture* tex); + void RegisterTextureForUpdating(const RageTextureID &id, RageTexture* tex); bool SetPrefs( RageTextureManagerPrefs prefs ); RageTextureManagerPrefs GetPrefs() { return m_Prefs; }; RageTextureID::TexPolicy GetDefaultTexturePolicy() const { return m_TexturePolicy; } - void SetDefaultTexturePolicy( RageTextureID::TexPolicy p ) { m_TexturePolicy = p; } + void SetDefaultTexturePolicy( const RageTextureID::TexPolicy &p ) { m_TexturePolicy = p; } // call this between Screens void DeleteCachedTextures() { GarbageCollect( screen_changed ); } diff --git a/src/RageTextureRenderTarget.cpp b/src/RageTextureRenderTarget.cpp index d62c307883..c622b0c522 100644 --- a/src/RageTextureRenderTarget.cpp +++ b/src/RageTextureRenderTarget.cpp @@ -2,7 +2,7 @@ #include "RageTextureRenderTarget.h" #include "RageDisplay.h" -RageTextureRenderTarget::RageTextureRenderTarget( RageTextureID name, const RenderTargetParam ¶m ): +RageTextureRenderTarget::RageTextureRenderTarget( const RageTextureID &name, const RenderTargetParam ¶m ): RageTexture( name ), m_Param( param ) { diff --git a/src/RageTextureRenderTarget.h b/src/RageTextureRenderTarget.h index 2932637013..65b348f84b 100644 --- a/src/RageTextureRenderTarget.h +++ b/src/RageTextureRenderTarget.h @@ -10,7 +10,7 @@ class RageTextureRenderTarget: public RageTexture { public: - RageTextureRenderTarget( RageTextureID name, const RenderTargetParam ¶m ); + RageTextureRenderTarget( const RageTextureID &name, const RenderTargetParam ¶m ); virtual ~RageTextureRenderTarget(); virtual void Invalidate() { m_iTexHandle = 0; /* don't Destroy() */ } virtual void Reload(); diff --git a/src/RageThreads.cpp b/src/RageThreads.cpp index e3aeb6b946..47507270ef 100644 --- a/src/RageThreads.cpp +++ b/src/RageThreads.cpp @@ -689,7 +689,7 @@ void LockMutex::Unlock() } } -RageEvent::RageEvent( RString name ): +RageEvent::RageEvent( const RString &name ): RageMutex( name ), m_pEvent(MakeEvent(m_pMutex)) {} RageEvent::~RageEvent() @@ -731,7 +731,7 @@ bool RageEvent::WaitTimeoutSupported() const return m_pEvent->WaitTimeoutSupported(); } -RageSemaphore::RageSemaphore( RString sName, int iInitialValue ): +RageSemaphore::RageSemaphore( const RString &sName, int iInitialValue ): m_pSema(MakeSemaphore( iInitialValue )), m_sName(sName) {} RageSemaphore::~RageSemaphore() diff --git a/src/RageThreads.h b/src/RageThreads.h index ef56261246..b452c328f3 100644 --- a/src/RageThreads.h +++ b/src/RageThreads.h @@ -151,7 +151,7 @@ class EventImpl; class RageEvent: public RageMutex { public: - RageEvent( RString name ); + RageEvent( const RString &name ); ~RageEvent(); /* @@ -176,7 +176,7 @@ class SemaImpl; class RageSemaphore { public: - RageSemaphore( RString sName, int iInitialValue = 0 ); + RageSemaphore( const RString &sName, int iInitialValue = 0 ); ~RageSemaphore(); RString GetName() const { return m_sName; } diff --git a/src/RageTypes.cpp b/src/RageTypes.cpp index e6cdd4fbbf..2e5876085a 100644 --- a/src/RageTypes.cpp +++ b/src/RageTypes.cpp @@ -64,7 +64,7 @@ RString RageColor::ToString() const return ssprintf( "#%02X%02X%02X%02X", iR, iG, iB, iA ); } -RString RageColor::NormalizeColorString( RString sColor ) +RString RageColor::NormalizeColorString( const RString &sColor ) { if( sColor.empty() ) return ""; diff --git a/src/RageTypes.h b/src/RageTypes.h index 66bb371476..0f4dc1a488 100644 --- a/src/RageTypes.h +++ b/src/RageTypes.h @@ -244,7 +244,7 @@ struct RageColor } RString ToString() const; - static RString NormalizeColorString( RString sColor ); + static RString NormalizeColorString( const RString &sColor ); void PushTable( lua_State *L ) const; void FromStack( lua_State *L, int iPos ); diff --git a/src/RageUtil.h b/src/RageUtil.h index aaa6d8aa5a..4a653d61b7 100644 --- a/src/RageUtil.h +++ b/src/RageUtil.h @@ -432,7 +432,7 @@ struct LanguageInfo }; void GetLanguageInfos( vector &vAddTo ); const LanguageInfo *GetLanguageInfo( const RString &sIsoCode ); -RString GetLanguageNameFromISO639Code( RString sName ); +RString GetLanguageNameFromISO639Code( const RString &sName ); // Splits a RString into an vector according the Delimitor. void split( const RString &sSource, const RString &sDelimitor, vector& asAddIt, const bool bIgnoreEmpty = true ); diff --git a/src/RageUtil_BackgroundLoader.cpp b/src/RageUtil_BackgroundLoader.cpp index 51cccb9ef2..9a6186732e 100644 --- a/src/RageUtil_BackgroundLoader.cpp +++ b/src/RageUtil_BackgroundLoader.cpp @@ -81,7 +81,7 @@ RString BackgroundLoader::GetRequest() return ret; } -RString BackgroundLoader::GetCachePath( RString sPath ) const +RString BackgroundLoader::GetCachePath( const RString &sPath ) const { return m_sCachePathPrefix + sPath; } @@ -204,7 +204,7 @@ bool BackgroundLoader::IsCacheFileFinished( const RString &sFile, RString &sActu return true; } -void BackgroundLoader::FinishedWithCachedFile( RString sFile ) +void BackgroundLoader::FinishedWithCachedFile( const RString &sFile ) { if( !g_bEnableBackgroundLoading ) return; diff --git a/src/RageUtil_BackgroundLoader.h b/src/RageUtil_BackgroundLoader.h index 36b0a142f5..02806d4497 100644 --- a/src/RageUtil_BackgroundLoader.h +++ b/src/RageUtil_BackgroundLoader.h @@ -25,7 +25,7 @@ class BackgroundLoader bool IsCacheFileFinished( const RString &sFile, RString &sActualPath ); /* Call this when finished with a cached file, to release any resources. */ - void FinishedWithCachedFile( RString sFile ); + void FinishedWithCachedFile( const RString &sFile ); /* Abort all loads. */ void Abort(); @@ -38,7 +38,7 @@ class BackgroundLoader RString GetRequest(); - RString GetCachePath( RString sPath ) const; + RString GetCachePath( const RString &sPath ) const; RString m_sCachePathPrefix; RageSemaphore m_StartSem; diff --git a/src/RandomSample.cpp b/src/RandomSample.cpp index 1e9ee8fae4..89b10f038e 100644 --- a/src/RandomSample.cpp +++ b/src/RandomSample.cpp @@ -16,7 +16,7 @@ RandomSample::~RandomSample() UnloadAll(); } -bool RandomSample::Load( RString sFilePath, int iMaxToLoad ) +bool RandomSample::Load( const RString &sFilePath, int iMaxToLoad ) { if( GetExtension(sFilePath) == "" ) return LoadSoundDir( sFilePath, iMaxToLoad ); @@ -65,7 +65,7 @@ bool RandomSample::LoadSoundDir( RString sDir, int iMaxToLoad ) return true; } -bool RandomSample::LoadSound( RString sSoundFilePath ) +bool RandomSample::LoadSound( const RString &sSoundFilePath ) { LOG->Trace( "RandomSample::LoadSound( %s )", sSoundFilePath.c_str() ); diff --git a/src/RandomSample.h b/src/RandomSample.h index 6d1b26461f..1dc8554475 100644 --- a/src/RandomSample.h +++ b/src/RandomSample.h @@ -11,7 +11,7 @@ class RandomSample RandomSample(); virtual ~RandomSample(); - bool Load( RString sFilePath, int iMaxToLoad = 1000 /*load all*/ ); + bool Load( const RString &sFilePath, int iMaxToLoad = 1000 /*load all*/ ); void UnloadAll(); void PlayRandom(); void PlayCopyOfRandom(); @@ -19,7 +19,7 @@ class RandomSample private: bool LoadSoundDir( RString sDir, int iMaxToLoad ); - bool LoadSound( RString sSoundFilePath ); + bool LoadSound( const RString &sSoundFilePath ); int GetNextToPlay(); vector m_pSamples; diff --git a/src/RoomInfoDisplay.cpp b/src/RoomInfoDisplay.cpp index 847db6846f..76f36187c8 100644 --- a/src/RoomInfoDisplay.cpp +++ b/src/RoomInfoDisplay.cpp @@ -48,7 +48,7 @@ void RoomInfoDisplay::RetractInfoBox() m_state = LOCKED; } -void RoomInfoDisplay::Load( RString sType ) +void RoomInfoDisplay::Load( const RString &sType ) { DEPLOY_DELAY.Load( sType, "DeployDelay" ); RETRACT_DELAY.Load( sType, "RetractDelay" ); diff --git a/src/RoomInfoDisplay.h b/src/RoomInfoDisplay.h index 6f5157de32..706c81961d 100644 --- a/src/RoomInfoDisplay.h +++ b/src/RoomInfoDisplay.h @@ -11,7 +11,7 @@ class RoomInfoDisplay : public ActorFrame public: RoomInfoDisplay(); ~RoomInfoDisplay(); - virtual void Load( RString sType ); + virtual void Load( const RString &sType ); virtual void Update( float fDeltaTime ); void SetRoom( const RoomWheelItemData* roomData ); void SetRoomInfo( const RoomInfo& info); diff --git a/src/RoomWheel.cpp b/src/RoomWheel.cpp index 80313dfbb1..01374930ad 100644 --- a/src/RoomWheel.cpp +++ b/src/RoomWheel.cpp @@ -22,7 +22,7 @@ RoomWheel::~RoomWheel() m_CurWheelItemData.clear(); } -void RoomWheel::Load( RString sType ) +void RoomWheel::Load( const RString &sType ) { WheelBase::Load( sType ); @@ -40,7 +40,7 @@ WheelItemBase *RoomWheel::MakeItem() return new RoomWheelItem; } -RoomWheelItem::RoomWheelItem( RString sType ): +RoomWheelItem::RoomWheelItem( const RString &sType ): WheelItemBase( sType ) { Load( sType ); @@ -64,7 +64,7 @@ RoomWheelItem::RoomWheelItem( const RoomWheelItem &cpy ): } } -void RoomWheelItem::Load( RString sType ) +void RoomWheelItem::Load( const RString &sType ) { // colorpart gets added first in MusicWheelItem, so follow that here. m_sprColorPart.Load( THEME->GetPathG(sType,"ColorPart") ); diff --git a/src/RoomWheel.h b/src/RoomWheel.h index ff6a12d18f..59010df1f6 100644 --- a/src/RoomWheel.h +++ b/src/RoomWheel.h @@ -10,7 +10,7 @@ struct RoomWheelItemData : public WheelItemBaseData { RoomWheelItemData() : m_iFlags(0) { } - RoomWheelItemData( WheelItemDataType type, const RString& sTitle, const RString& sDesc, RageColor color ): + RoomWheelItemData( WheelItemDataType type, const RString& sTitle, const RString& sDesc, const RageColor &color ): WheelItemBaseData( type, sTitle, color ), m_sDesc(sDesc), m_iFlags(0) { }; RString m_sDesc; @@ -20,10 +20,10 @@ struct RoomWheelItemData : public WheelItemBaseData class RoomWheelItem : public WheelItemBase { public: - RoomWheelItem( RString sType = "RoomWheelItem" ); + RoomWheelItem( const RString &sType = "RoomWheelItem" ); RoomWheelItem( const RoomWheelItem &cpy ); - void Load( RString sType ); + void Load( const RString &sType ); virtual void LoadFromWheelItemData( const WheelItemBaseData* pWID, int iIndex, bool bHasFocus, int iDrawIndex ); virtual RoomWheelItem *Copy() const { return new RoomWheelItem(*this); } @@ -49,7 +49,7 @@ class RoomWheel : public WheelBase { public: virtual ~RoomWheel(); - virtual void Load( RString sType ); + virtual void Load( const RString &sType ); virtual void BuildWheelItemsData( vector &arrayWheelItemDatas ); virtual unsigned int GetNumItems() const; virtual bool Select(); diff --git a/src/ScoreDisplayNormal.h b/src/ScoreDisplayNormal.h index 6be0186405..6ef3d8301d 100644 --- a/src/ScoreDisplayNormal.h +++ b/src/ScoreDisplayNormal.h @@ -14,7 +14,7 @@ class ScoreDisplayNormal : public ScoreDisplay virtual void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ); virtual void SetScore( int iNewScore ); - virtual void SetText( RString s ) { m_text.SetText(s); } + virtual void SetText( const RString &s ) { m_text.SetText(s); } protected: AutoActor m_sprFrame; diff --git a/src/ScoreKeeper.cpp b/src/ScoreKeeper.cpp index fb85102464..bfc3a0c983 100644 --- a/src/ScoreKeeper.cpp +++ b/src/ScoreKeeper.cpp @@ -31,7 +31,7 @@ void ScoreKeeper::GetScoreOfLastTapInRow( const NoteData &nd, int iRow, #include "ScoreKeeperRave.h" #include "ScoreKeeperShared.h" -ScoreKeeper* ScoreKeeper::MakeScoreKeeper( RString sClassName, PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ) +ScoreKeeper* ScoreKeeper::MakeScoreKeeper( const RString &sClassName, PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ) { if( sClassName == "ScoreKeeperNormal" ) return new ScoreKeeperNormal( pPlayerState, pPlayerStageStats ); diff --git a/src/ScoreKeeper.h b/src/ScoreKeeper.h index 27a19df516..f9bbd81baf 100644 --- a/src/ScoreKeeper.h +++ b/src/ScoreKeeper.h @@ -21,7 +21,7 @@ struct AttackArray; class ScoreKeeper { public: - static ScoreKeeper* MakeScoreKeeper( RString sClassName, PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ); + static ScoreKeeper* MakeScoreKeeper( const RString &sClassName, PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ); protected: PlayerState *m_pPlayerState; diff --git a/src/ScreenHighScores.cpp b/src/ScreenHighScores.cpp index 5dc17180dc..a5432e9386 100644 --- a/src/ScreenHighScores.cpp +++ b/src/ScreenHighScores.cpp @@ -177,7 +177,7 @@ void ScoreScroller::LoadCourses( CourseType ct, int iNumRecentScores ) m_vScoreRowItemData[i].m_pCourse = vpCourses[i]; } -void ScoreScroller::Load( RString sMetricsGroup ) +void ScoreScroller::Load( const RString &sMetricsGroup ) { SCROLLER_ITEMS_TO_DRAW.Load(sMetricsGroup, "ScrollerItemsToDraw"); SCROLLER_SECONDS_PER_ITEM.Load(sMetricsGroup, "ScrollerSecondsPerItem"); diff --git a/src/ScreenHighScores.h b/src/ScreenHighScores.h index 15c27d0730..1faa8de5f4 100644 --- a/src/ScreenHighScores.h +++ b/src/ScreenHighScores.h @@ -26,7 +26,7 @@ class ScoreScroller: public DynamicActorScroller ScoreScroller(); void LoadSongs( int iNumRecentScores ); void LoadCourses( CourseType ct, int iNumRecentScores ); - void Load( RString sClassName ); + void Load( const RString &sClassName ); void SetDisplay( const vector &DifficultiesToShow ); bool Scroll( int iDir ); void ScrollTop(); diff --git a/src/ScreenMiniMenu.h b/src/ScreenMiniMenu.h index f7e8167e0a..8cb748da6c 100644 --- a/src/ScreenMiniMenu.h +++ b/src/ScreenMiniMenu.h @@ -23,7 +23,7 @@ struct MenuRowDef MenuRowDef(): iRowCode(0), sName(""), bEnabled(false), pfnEnabled(), emShowIn(), iDefaultChoice(0), choices(), bThemeTitle(false), bThemeItems(false) {} - MenuRowDef( int r, RString n, MenuRowUpdateEnabled pe, EditMode s, + MenuRowDef( int r, const RString &n, MenuRowUpdateEnabled pe, EditMode s, bool bTT, bool bTI, int d, const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, @@ -51,8 +51,8 @@ struct MenuRowDef #undef PUSH } - MenuRowDef(int r, RString n, bool e, EditMode s, - bool bTT, bool bTI, int d, vector options): + MenuRowDef(int r, const RString &n, bool e, EditMode s, + bool bTT, bool bTI, int d, vector &options): iRowCode(r), sName(n), bEnabled(e), pfnEnabled(NULL), emShowIn(s), iDefaultChoice(d), choices(), bThemeTitle(bTT), bThemeItems(bTI) @@ -63,7 +63,7 @@ struct MenuRowDef } } - MenuRowDef( int r, RString n, bool e, EditMode s, bool bTT, bool bTI, + MenuRowDef( int r, const RString &n, bool e, EditMode s, bool bTT, bool bTI, int d, const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, @@ -90,7 +90,7 @@ struct MenuRowDef #undef PUSH } - MenuRowDef( int r, RString n, bool e, EditMode s, bool bTT, bool bTI, + MenuRowDef( int r, const RString &n, bool e, EditMode s, bool bTT, bool bTI, int d, int low, int high ): iRowCode(r), sName(n), bEnabled(e), pfnEnabled(NULL), emShowIn(s), iDefaultChoice(d), choices(), diff --git a/src/ScreenReloadSongs.cpp b/src/ScreenReloadSongs.cpp index 27a737cb2c..85dfbac87b 100644 --- a/src/ScreenReloadSongs.cpp +++ b/src/ScreenReloadSongs.cpp @@ -21,7 +21,7 @@ class ScreenReloadSongsLoadingWindow: public LoadingWindow { } - void SetText( RString str ) + void SetText( const RString &str ) { m_BitmapText.SetText( str ); Paint(); diff --git a/src/ScreenTextEntry.cpp b/src/ScreenTextEntry.cpp index fa269e93e3..163d224b30 100644 --- a/src/ScreenTextEntry.cpp +++ b/src/ScreenTextEntry.cpp @@ -39,7 +39,7 @@ namespace void(*g_pOnOK)(const RString &sAnswer); void(*g_pOnCancel)(); bool g_bPassword; - bool (*g_pValidateAppend)(const RString &sAnswerBeforeChar, RString &sAppend); + bool (*g_pValidateAppend)(const RString &sAnswerBeforeChar, const RString &sAppend); RString (*g_pFormatAnswerForDisplay)(const RString &sAnswer); // Lua bridge @@ -58,7 +58,7 @@ void ScreenTextEntry::SetTextEntrySettings( void(*OnOK)(const RString &sAnswer), void(*OnCancel)(), bool bPassword, - bool (*ValidateAppend)(const RString &sAnswerBeforeChar, RString &sAppend), + bool (*ValidateAppend)(const RString &sAnswerBeforeChar, const RString &sAppend), RString (*FormatAnswerForDisplay)(const RString &sAnswer) ) { @@ -81,7 +81,7 @@ void ScreenTextEntry::TextEntry( void(*OnOK)(const RString &sAnswer), void(*OnCancel)(), bool bPassword, - bool (*ValidateAppend)(const RString &sAnswerBeforeChar, RString &sAppend), + bool (*ValidateAppend)(const RString &sAnswerBeforeChar, const RString &sAppend), RString (*FormatAnswerForDisplay)(const RString &sAnswer) ) { @@ -277,7 +277,7 @@ bool ScreenTextEntry::Input( const InputEventPlus &input ) return ScreenWithMenuElements::Input( input ) || bHandled; } -void ScreenTextEntry::TryAppendToAnswer( RString s ) +void ScreenTextEntry::TryAppendToAnswer( const RString &s ) { { wstring sNewAnswer = m_sAnswer+RStringToWstring(s); @@ -513,7 +513,7 @@ static void OnCancelFromLua() LUA->Release(L); } -static bool ValidateAppendFromLua( const RString &sAnswerBeforeChar, RString &sAppend ) +static bool ValidateAppendFromLua( const RString &sAnswerBeforeChar, const RString &sAppend ) { if(g_ValidateAppendFunc.IsNil() || !g_ValidateAppendFunc.IsSet()) { diff --git a/src/ScreenTextEntry.h b/src/ScreenTextEntry.h index 7c15eef8b4..ee30f42898 100644 --- a/src/ScreenTextEntry.h +++ b/src/ScreenTextEntry.h @@ -46,7 +46,7 @@ class ScreenTextEntry : public ScreenWithMenuElements void(*OnOK)(const RString &sAnswer) = NULL, void(*OnCancel)() = NULL, bool bPassword = false, - bool (*ValidateAppend)(const RString &sAnswerBeforeChar, RString &sAppend) = NULL, + bool (*ValidateAppend)(const RString &sAnswerBeforeChar, const RString &sAppend) = NULL, RString (*FormatAnswerForDisplay)(const RString &sAnswer) = NULL ); static void TextEntry( @@ -58,7 +58,7 @@ class ScreenTextEntry : public ScreenWithMenuElements void(*OnOK)(const RString &sAnswer) = NULL, void(*OnCancel)() = NULL, bool bPassword = false, - bool (*ValidateAppend)(const RString &sAnswerBeforeChar, RString &sAppend) = NULL, + bool (*ValidateAppend)(const RString &sAnswerBeforeChar, const RString &sAppend) = NULL, RString (*FormatAnswerForDisplay)(const RString &sAnswer) = NULL ); static void Password( @@ -112,7 +112,7 @@ class ScreenTextEntry : public ScreenWithMenuElements virtual void PushSelf( lua_State *L ); protected: - void TryAppendToAnswer( RString s ); + void TryAppendToAnswer( const RString &s ); void BackspaceInAnswer(); virtual void TextEnteredDirectly() { } diff --git a/src/ScreenWithMenuElements.cpp b/src/ScreenWithMenuElements.cpp index db5e328a6f..17711f74a3 100644 --- a/src/ScreenWithMenuElements.cpp +++ b/src/ScreenWithMenuElements.cpp @@ -171,7 +171,7 @@ ScreenWithMenuElements::~ScreenWithMenuElements() delete *actor; } -void ScreenWithMenuElements::SetHelpText( RString s ) +void ScreenWithMenuElements::SetHelpText( const RString &s ) { Message msg("SetHelpText"); msg.SetParam( "Text", s ); diff --git a/src/ScreenWithMenuElements.h b/src/ScreenWithMenuElements.h index 227b56629c..b9b407b587 100644 --- a/src/ScreenWithMenuElements.h +++ b/src/ScreenWithMenuElements.h @@ -40,7 +40,7 @@ class ScreenWithMenuElements : public Screen protected: RString HandleLuaMusicFile(RString const& path); virtual void StartPlayingMusic(); - void SetHelpText( RString s ); + void SetHelpText( const RString &s ); AutoActor m_sprUnderlay; MemoryCardDisplay *m_MemoryCardDisplay[NUM_PLAYERS]; diff --git a/src/Song.cpp b/src/Song.cpp index 872409d3c5..dc316c6686 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -397,7 +397,7 @@ bool Song::LoadFromSongDir( RString sDir, bool load_autosave ) /* This function feels EXTREMELY hacky - copying things on top of pointers so * they don't break elsewhere. Maybe it could be rewritten to politely ask the * Song/Steps objects to reload themselves. -- djpohly */ -bool Song::ReloadFromSongDir( RString sDir ) +bool Song::ReloadFromSongDir( const RString &sDir ) { // Remove the cache file to force the song to reload from its dir instead // of loading from the cache. -Kyz @@ -489,7 +489,7 @@ bool Song::ReloadFromSongDir( RString sDir ) return true; } -void Song::LoadEditsFromSongDir(RString dir) +void Song::LoadEditsFromSongDir(const RString &dir) { // Load any .edit files in the song folder. // Doing this BEFORE setting up AutoGen just in case. @@ -1222,7 +1222,7 @@ bool Song::SaveToSMFile() } -bool Song::SaveToSSCFile( RString sPath, bool bSavingCache, bool autosave ) +bool Song::SaveToSSCFile( const RString &sPath, bool bSavingCache, bool autosave ) { RString path = sPath; if (!bSavingCache) @@ -1296,7 +1296,7 @@ bool Song::SaveToSSCFile( RString sPath, bool bSavingCache, bool autosave ) return true; } -bool Song::SaveToJsonFile( RString sPath ) +bool Song::SaveToJsonFile( const RString &sPath ) { LOG->Trace( "Song::SaveToJsonFile('%s')", sPath.c_str() ); return NotesWriterJson::WriteSong(sPath, *this, true); @@ -1805,7 +1805,7 @@ void Song::DeleteSteps( const Steps* pSteps, bool bReAutoGen ) AddAutoGenNotes(); } -bool Song::Matches(RString sGroup, RString sSong) const +bool Song::Matches(const RString &sGroup, const RString &sSong) const { if( sGroup.size() && sGroup.CompareNoCase(this->m_sGroupName) != 0) return false; diff --git a/src/Song.h b/src/Song.h index 8058df65ad..74a303a723 100644 --- a/src/Song.h +++ b/src/Song.h @@ -17,7 +17,7 @@ struct lua_State; struct BackgroundChange; void FixupPath( RString &path, const RString &sSongPath ); -RString GetSongAssetPath( RString sPath, const RString &sSongPath ); +RString GetSongAssetPath( const RString &sPath, const RString &sSongPath ); /** @brief The version of the .ssc file format. */ const static float STEPFILE_VERSION_NUMBER = 0.83f; @@ -67,7 +67,7 @@ class Song { RString m_sSongDir; public: - void SetSongDir( const RString sDir ) { m_sSongDir = sDir; } + void SetSongDir( const RString &sDir ) { m_sSongDir = sDir; } RString GetSongDir() { return m_sSongDir; } /** @brief When should this song be displayed in the music wheel? */ @@ -89,9 +89,9 @@ class Song * @param sDir the song directory from which to load. */ bool LoadFromSongDir( RString sDir, bool load_autosave= false ); // This one takes the effort to reuse Steps pointers as best as it can - bool ReloadFromSongDir( RString sDir ); + bool ReloadFromSongDir( const RString &sDir ); bool ReloadFromSongDir() { return ReloadFromSongDir(GetSongDir()); } - void LoadEditsFromSongDir(RString dir); + void LoadEditsFromSongDir(const RString &dir); bool HasAutosaveFile(); bool LoadAutosaveFile(); @@ -118,13 +118,13 @@ class Song * @param sPath the path where we're saving the file. * @param bSavingCache a flag to determine if we're saving cache data. */ - bool SaveToSSCFile(RString sPath, bool bSavingCache, bool autosave= false); + bool SaveToSSCFile(const RString &sPath, bool bSavingCache, bool autosave= false); /** @brief Save to the SSC and SM files no matter what. */ void Save(bool autosave= false); /** * @brief Save the current Song to a JSON file. * @return its success or failure. */ - bool SaveToJsonFile( RString sPath ); + bool SaveToJsonFile( const RString &sPath ); /** * @brief Save the current Song to a cache file using the preferred format. * @return its success or failure. */ @@ -295,7 +295,7 @@ class Song bool HasAttacks() const; bool HasPreviewVid() const; - bool Matches(RString sGroup, RString sSong) const; + bool Matches(const RString &sGroup, const RString &sSong) const; /** @brief The Song's TimingData. */ TimingData m_SongTiming; diff --git a/src/SongManager.cpp b/src/SongManager.cpp index e31fccc54e..6a9eac54aa 100644 --- a/src/SongManager.cpp +++ b/src/SongManager.cpp @@ -171,7 +171,7 @@ void SongManager::InitSongsFromDisk( LoadingWindow *ld ) } static LocalizedString FOLDER_CONTAINS_MUSIC_FILES( "SongManager", "The folder \"%s\" appears to be a song folder. All song folders must reside in a group folder. For example, \"Songs/Originals/My Song\"." ); -void SongManager::SanityCheckGroupDir( RString sDir ) const +void SongManager::SanityCheckGroupDir( const RString &sDir ) const { // Check to see if they put a song directly inside the group folder. vector arrayFiles; @@ -191,7 +191,7 @@ void SongManager::SanityCheckGroupDir( RString sDir ) const } } -void SongManager::AddGroup( RString sDir, RString sGroupDirName ) +void SongManager::AddGroup( const RString &sDir, const RString &sGroupDirName ) { unsigned j; for(j = 0; j < m_sSongGroupNames.size(); ++j) @@ -382,7 +382,7 @@ void SongManager::LoadStepManiaSongDir( RString sDir, LoadingWindow *ld ) } // Instead of "symlinks", songs should have membership in multiple groups. -Chris -void SongManager::LoadGroupSymLinks(RString sDir, RString sGroupFolder) +void SongManager::LoadGroupSymLinks(const RString &sDir, const RString &sGroupFolder) { // Find all symlink files in this folder vector arraySymLinks; @@ -497,7 +497,7 @@ bool SongManager::IsGroupNeverCached(const RString& group) const return m_GroupsToNeverCache.find(group) != m_GroupsToNeverCache.end(); } -RString SongManager::GetSongGroupBannerPath( RString sSongGroup ) const +RString SongManager::GetSongGroupBannerPath( const RString &sSongGroup ) const { for( unsigned i = 0; i < m_sSongGroupNames.size(); ++i ) { @@ -524,7 +524,7 @@ void SongManager::GetSongGroupNames( vector &AddTo ) const AddTo.insert(AddTo.end(), m_sSongGroupNames.begin(), m_sSongGroupNames.end() ); } -bool SongManager::DoesSongGroupExist( RString sSongGroup ) const +bool SongManager::DoesSongGroupExist( const RString &sSongGroup ) const { return find( m_sSongGroupNames.begin(), m_sSongGroupNames.end(), sSongGroup ) != m_sSongGroupNames.end(); } @@ -823,7 +823,7 @@ int SongManager::GetNumCourseGroups() const return m_mapCourseGroupToInfo.size(); } -RString SongManager::ShortenGroupName( RString sLongGroupName ) +RString SongManager::ShortenGroupName( const RString &sLongGroupName ) { static TitleSubst tsub("Groups"); @@ -1224,7 +1224,7 @@ void SongManager::GetCoursesInGroup( vector &AddTo, const RString &sCou AddTo.push_back( m_pCourses[i] ); } -bool SongManager::GetExtraStageInfoFromCourse( bool bExtra2, RString sPreferredGroup, Song*& pSongOut, Steps*& pStepsOut, StepsType stype ) +bool SongManager::GetExtraStageInfoFromCourse( bool bExtra2, const RString &sPreferredGroup, Song*& pSongOut, Steps*& pStepsOut, StepsType stype ) { const RString sCourseSuffix = sPreferredGroup + (bExtra2 ? "/extra2.crs" : "/extra1.crs"); RString sCoursePath = SpecialFiles::SONGS_DIR + sCourseSuffix; @@ -1405,7 +1405,7 @@ Song* SongManager::GetSongFromDir(RString dir) const return NULL; } -Course* SongManager::GetCourseFromPath( RString sPath ) const +Course* SongManager::GetCourseFromPath( const RString &sPath ) const { if( sPath == "" ) return NULL; @@ -1419,7 +1419,7 @@ Course* SongManager::GetCourseFromPath( RString sPath ) const return NULL; } -Course* SongManager::GetCourseFromName( RString sName ) const +Course* SongManager::GetCourseFromName( const RString &sName ) const { if( sName == "" ) return NULL; @@ -1546,7 +1546,7 @@ void SongManager::UpdateShuffled() random_shuffle( m_pShuffledCourses.begin(), m_pShuffledCourses.end(), g_RandomNumberGenerator ); } -void SongManager::UpdatePreferredSort(RString sPreferredSongs, RString sPreferredCourses) +void SongManager::UpdatePreferredSort(const RString &sPreferredSongs, const RString &sPreferredCourses) { ASSERT( UNLOCKMAN != NULL ); diff --git a/src/SongManager.h b/src/SongManager.h index f7802193af..85d898331b 100644 --- a/src/SongManager.h +++ b/src/SongManager.h @@ -52,7 +52,7 @@ class SongManager int GetNumStepsLoadedFromProfile(); void FreeAllLoadedFromProfile( ProfileSlot slot = ProfileSlot_Invalid ); - void LoadGroupSymLinks( RString sDir, RString sGroupFolder ); + void LoadGroupSymLinks( const RString &sDir, const RString &sGroupFolder ); void InitCoursesFromDisk( LoadingWindow *ld ); void InitAutogenCourses(); @@ -70,10 +70,10 @@ class SongManager bool IsGroupNeverCached(const RString& group) const; - RString GetSongGroupBannerPath( RString sSongGroup ) const; + RString GetSongGroupBannerPath( const RString &sSongGroup ) const; //RString GetSongGroupBackgroundPath( RString sSongGroup ) const; void GetSongGroupNames( vector &AddTo ) const; - bool DoesSongGroupExist( RString sSongGroup ) const; + bool DoesSongGroupExist( const RString &sSongGroup ) const; RageColor GetSongGroupColor( const RString &sSongGroupName ) const; RageColor GetSongColor( const Song* pSong ) const; @@ -86,7 +86,7 @@ class SongManager void ResetGroupColors(); - static RString ShortenGroupName( RString sLongGroupName ); + static RString ShortenGroupName( const RString &sLongGroupName ); // Lookup /** @@ -158,12 +158,12 @@ class SongManager void GetExtraStageInfo( bool bExtra2, const Style *s, Song*& pSongOut, Steps*& pStepsOut ); Song* GetSongFromDir( RString sDir ) const; - Course* GetCourseFromPath( RString sPath ) const; // path to .crs file, or path to song group dir - Course* GetCourseFromName( RString sName ) const; + Course* GetCourseFromPath( const RString &sPath ) const; // path to .crs file, or path to song group dir + Course* GetCourseFromName( const RString &sName ) const; void UpdatePopular(); void UpdateShuffled(); // re-shuffle songs and courses - void UpdatePreferredSort(RString sPreferredSongs = "PreferredSongs.txt", RString sPreferredCourses = "PreferredCourses.txt"); + void UpdatePreferredSort(const RString &sPreferredSongs = "PreferredSongs.txt", const RString &sPreferredCourses = "PreferredCourses.txt"); void SortSongs(); // sort m_pSongs by CompareSongPointersByTitle void UpdateRankingCourses(); // courses shown on the ranking screen @@ -174,10 +174,10 @@ class SongManager protected: void LoadStepManiaSongDir( RString sDir, LoadingWindow *ld ); - void LoadDWISongDir( RString sDir ); - bool GetExtraStageInfoFromCourse( bool bExtra2, RString sPreferredGroup, Song*& pSongOut, Steps*& pStepsOut, StepsType stype ); - void SanityCheckGroupDir( RString sDir ) const; - void AddGroup( RString sDir, RString sGroupDirName ); + void LoadDWISongDir( const RString &sDir ); + bool GetExtraStageInfoFromCourse( bool bExtra2, const RString &sPreferredGroup, Song*& pSongOut, Steps*& pStepsOut, StepsType stype ); + void SanityCheckGroupDir( const RString &sDir ) const; + void AddGroup( const RString &sDir, const RString &sGroupDirName ); int GetNumEditsLoadedFromProfile( ProfileSlot slot ) const; void AddSongToList(Song* new_song); diff --git a/src/SongUtil.cpp b/src/SongUtil.cpp index b9fefeaee5..429491f345 100644 --- a/src/SongUtil.cpp +++ b/src/SongUtil.cpp @@ -199,7 +199,7 @@ Steps* SongUtil::GetStepsByMeter( const Song *pSong, StepsType st, int iMeterLow return NULL; } -Steps* SongUtil::GetStepsByDescription( const Song *pSong, StepsType st, RString sDescription ) +Steps* SongUtil::GetStepsByDescription( const Song *pSong, StepsType st, const RString &sDescription ) { vector vNotes; GetSteps( pSong, vNotes, st, Difficulty_Invalid, -1, -1, sDescription, "" ); @@ -209,7 +209,7 @@ Steps* SongUtil::GetStepsByDescription( const Song *pSong, StepsType st, RString return vNotes[0]; } -Steps* SongUtil::GetStepsByCredit( const Song *pSong, StepsType st, RString sCredit ) +Steps* SongUtil::GetStepsByCredit( const Song *pSong, StepsType st, const RString &sCredit ) { vector vNotes; GetSteps(pSong, vNotes, st, Difficulty_Invalid, -1, -1, "", sCredit ); diff --git a/src/SongUtil.h b/src/SongUtil.h index fa2f6b124d..f144dedccf 100644 --- a/src/SongUtil.h +++ b/src/SongUtil.h @@ -125,8 +125,8 @@ namespace SongUtil ); Steps* GetStepsByDifficulty( const Song *pSong, StepsType st, Difficulty dc, bool bIncludeAutoGen = true ); Steps* GetStepsByMeter( const Song *pSong, StepsType st, int iMeterLow, int iMeterHigh ); - Steps* GetStepsByDescription( const Song *pSong, StepsType st, RString sDescription ); - Steps* GetStepsByCredit( const Song *pSong, StepsType st, RString sCredit ); + Steps* GetStepsByDescription( const Song *pSong, StepsType st, const RString &sDescription ); + Steps* GetStepsByCredit( const Song *pSong, StepsType st, const RString &sCredit ); Steps* GetClosestNotes( const Song *pSong, StepsType st, Difficulty dc, bool bIgnoreLocked=false ); void AdjustDuplicateSteps( Song *pSong ); // part of TidyUpData diff --git a/src/Sprite.cpp b/src/Sprite.cpp index cd3d86b1af..569b60bde5 100644 --- a/src/Sprite.cpp +++ b/src/Sprite.cpp @@ -143,7 +143,7 @@ RageTextureID Sprite::SongBannerTexture( RageTextureID ID ) return ID; } -void Sprite::Load( RageTextureID ID ) +void Sprite::Load( const RageTextureID &ID ) { if( !ID.filename.empty() ) LoadFromTexture( ID ); @@ -324,7 +324,7 @@ void Sprite::SetTexture( RageTexture *pTexture ) LoadStatesFromTexture(); } -void Sprite::LoadFromTexture( RageTextureID ID ) +void Sprite::LoadFromTexture( const RageTextureID &ID ) { // LOG->Trace( "Sprite::LoadFromTexture( %s )", ID.filename.c_str() ); diff --git a/src/Sprite.h b/src/Sprite.h index f6d907ed7b..ab8943d410 100644 --- a/src/Sprite.h +++ b/src/Sprite.h @@ -43,7 +43,7 @@ class Sprite: public Actor // Adjust texture properties for song banners. static RageTextureID SongBannerTexture( RageTextureID ID ); - virtual void Load( RageTextureID ID ); + virtual void Load( const RageTextureID &ID ); void SetTexture( RageTexture *pTexture ); void UnloadTexture(); @@ -97,7 +97,7 @@ class Sprite: public Actor bool m_use_effect_clock_for_texcoords; protected: - void LoadFromTexture( RageTextureID ID ); + void LoadFromTexture( const RageTextureID &ID ); private: void LoadStatesFromTexture(); diff --git a/src/StepMania.cpp b/src/StepMania.cpp index 998d3e1c5c..3078547117 100644 --- a/src/StepMania.cpp +++ b/src/StepMania.cpp @@ -1220,7 +1220,7 @@ int sm_main(int argc, char* argv[]) return 0; } -RString StepMania::SaveScreenshot( RString Dir, bool SaveCompressed, bool MakeSignature, RString NamePrefix, RString NameSuffix ) +RString StepMania::SaveScreenshot( const RString &Dir, bool SaveCompressed, bool MakeSignature, const RString &NamePrefix, const RString &NameSuffix ) { /* As of sm-ssc v1.0 rc2, screenshots are no longer named by an arbitrary * index. This was causing naming issues for some unknown reason, so we have diff --git a/src/StepMania.h b/src/StepMania.h index eed115ad2e..4cd24478c5 100644 --- a/src/StepMania.h +++ b/src/StepMania.h @@ -18,7 +18,7 @@ namespace StepMania void InitializeCurrentGame(const Game* g); // If successful, return filename of screenshot in sDir, else return "" - RString SaveScreenshot( RString Dir, bool SaveCompressed, bool MakeSignature, RString NamePrefix, RString NameSuffix ); + RString SaveScreenshot( const RString &Dir, bool SaveCompressed, bool MakeSignature, const RString &NamePrefix, const RString &NameSuffix ); void InsertCoin( int iNum = 1, bool bCountInBookkeeping = true ); void InsertCredit(); diff --git a/src/Steps.cpp b/src/Steps.cpp index a8a3d3eb29..abc65d8eb1 100644 --- a/src/Steps.cpp +++ b/src/Steps.cpp @@ -604,7 +604,7 @@ void Steps::CreateBlank( StepsType ntTo ) this->SetNoteData( noteData ); } -void Steps::SetDifficultyAndDescription( Difficulty dc, RString sDescription ) +void Steps::SetDifficultyAndDescription( Difficulty dc, const RString &sDescription ) { DeAutogen(); m_Difficulty = dc; @@ -613,13 +613,13 @@ void Steps::SetDifficultyAndDescription( Difficulty dc, RString sDescription ) MakeValidEditDescription( m_sDescription ); } -void Steps::SetCredit( RString sCredit ) +void Steps::SetCredit( const RString &sCredit ) { DeAutogen(); m_sCredit = sCredit; } -void Steps::SetChartStyle( RString sChartStyle ) +void Steps::SetChartStyle( const RString &sChartStyle ) { DeAutogen(); m_sChartStyle = sChartStyle; diff --git a/src/Steps.h b/src/Steps.h index 615533723c..9c9c095232 100644 --- a/src/Steps.h +++ b/src/Steps.h @@ -112,16 +112,16 @@ class Steps vector m_sAttackString; RString GetChartName() const { return parent ? Real()->GetChartName() : this->chartName; } - void SetChartName(const RString name) { this->chartName = name; } - void SetFilename( RString fn ) { m_sFilename = fn; } + void SetChartName(const RString &name) { this->chartName = name; } + void SetFilename( const RString &fn ) { m_sFilename = fn; } RString GetFilename() const { return m_sFilename; } void SetSavedToDisk( bool b ) { DeAutogen(); m_bSavedToDisk = b; } bool GetSavedToDisk() const { return Real()->m_bSavedToDisk; } void SetDifficulty( Difficulty dc ) { SetDifficultyAndDescription( dc, GetDescription() ); } - void SetDescription( RString sDescription ) { SetDifficultyAndDescription( this->GetDifficulty(), sDescription ); } - void SetDifficultyAndDescription( Difficulty dc, RString sDescription ); - void SetCredit( RString sCredit ); - void SetChartStyle( RString sChartStyle ); + void SetDescription( const RString &sDescription ) { SetDifficultyAndDescription( this->GetDifficulty(), sDescription ); } + void SetDifficultyAndDescription( Difficulty dc, const RString &sDescription ); + void SetCredit( const RString &sCredit ); + void SetChartStyle( const RString &sChartStyle ); static bool MakeValidEditDescription( RString &sPreferredDescription ); // return true if was modified void SetLoadedFromProfile( ProfileSlot slot ) { m_LoadedFromProfile = slot; } @@ -171,13 +171,12 @@ class Steps /* Needs to be generated with timingdata and stored in timingdata - Mina */ vector ElapsedTimesAtAllRows; - vector GetElapsedTimesAtAllRows() { return ElapsedTimesAtAllRows; }; void SetElapsedTimesAtAllRows(vector& etar) { ElapsedTimesAtAllRows = etar; }; void UnsetElapsedTimesAtAllRows() { std::vector emptyVector; ElapsedTimesAtAllRows.swap(emptyVector); }; vector ElapsedTimesAtTapRows; vector GetElapsedTimesAtTapRows() { return ElapsedTimesAtTapRows; } - void SetElapsedTimesAtTapRows(vector etat) { ElapsedTimesAtTapRows = etat; }; + void SetElapsedTimesAtTapRows(vector &etat) { ElapsedTimesAtTapRows = etat; }; float GetElapsedTimeAtRow(int irow) const { return ElapsedTimesAtAllRows[irow]; }; float GetElapsedTimeAtTapRow(int irow) const { return ElapsedTimesAtTapRows[irow]; }; @@ -189,7 +188,7 @@ class Steps RString ChartKeyRecord = "Invalid"; RString GetChartKey() const; RString GetChartKeyRecord() const; - void SetChartKey(const RString k) { this->ChartKey = k; }; + void SetChartKey(const RString &k) { this->ChartKey = k; }; /* This is a reimplementation of the lua version of the script to generate chart keys, except this time using the notedata stored in game memory immediately after reading it than parsing it using lua. - Mina */ diff --git a/src/TextBanner.cpp b/src/TextBanner.cpp index 5fa8fbc32f..a4106dde0b 100644 --- a/src/TextBanner.cpp +++ b/src/TextBanner.cpp @@ -14,7 +14,7 @@ void TextBanner::LoadFromNode( const XNode* pNode ) ActorFrame::LoadFromNode( pNode ); } -void TextBanner::Load( RString sMetricsGroup ) +void TextBanner::Load( const RString &sMetricsGroup ) { m_bInitted = true; diff --git a/src/TextBanner.h b/src/TextBanner.h index 7e4b619025..20afe1094d 100644 --- a/src/TextBanner.h +++ b/src/TextBanner.h @@ -15,7 +15,7 @@ class TextBanner : public ActorFrame virtual TextBanner *Copy() const; void LoadFromNode( const XNode* pNode ); - void Load( RString sMetricsGroup ); // load metrics + void Load( const RString &sMetricsGroup ); // load metrics void SetFromSong( const Song *pSong ); void SetFromString( const RString &sDisplayTitle, const RString &sTranslitTitle, diff --git a/src/ThemeMetric.h b/src/ThemeMetric.h index f74d1c4e0b..a6219b6da6 100644 --- a/src/ThemeMetric.h +++ b/src/ThemeMetric.h @@ -269,11 +269,11 @@ class ThemeMetricMap : public IThemeMetric map m_metric; public: - ThemeMetricMap( const RString& sGroup = "", MetricNameMap pfn = NULL, const vector vsValueNames = vector() ) + ThemeMetricMap( const RString& sGroup = "", MetricNameMap pfn = NULL, const vector &vsValueNames = vector() ) { Load( sGroup, pfn, vsValueNames ); } - void Load( const RString& sGroup, MetricNameMap pfn, const vector vsValueNames ) + void Load( const RString& sGroup, MetricNameMap pfn, const vector &vsValueNames ) { m_metric.clear(); FOREACH_CONST( RString, vsValueNames, s ) @@ -291,7 +291,7 @@ class ThemeMetricMap : public IThemeMetric for( typename map >::iterator m = m_metric.begin(); m != m_metric.end(); ++m ) m->second.Clear(); } - const T& GetValue( RString s ) const + const T& GetValue( const RString &s ) const { // HACK: GCC (3.4) takes this and pretty much nothing else. // I don't know why. diff --git a/src/TimingData.h b/src/TimingData.h index 6eea807763..105981d1bf 100644 --- a/src/TimingData.h +++ b/src/TimingData.h @@ -278,7 +278,7 @@ class TimingData const RString& GetLabelAtRow( int iNoteRow ) const { return GetLabelSegmentAtRow(iNoteRow)->GetLabel(); } const RString& GetLabelAtBeat( float fBeat ) const { return GetLabelAtRow( BeatToNoteRow(fBeat) ); } void SetLabelAtRow( int iNoteRow, const RString& sLabel ) { AddSegment( LabelSegment(iNoteRow,sLabel) ); } - void SetLabelAtBeat( float fBeat, const RString sLabel ) { SetLabelAtRow( BeatToNoteRow( fBeat ), sLabel ); } + void SetLabelAtBeat( float fBeat, const RString &sLabel ) { SetLabelAtRow( BeatToNoteRow( fBeat ), sLabel ); } bool DoesLabelExist( const RString& sLabel ) const; float GetSpeedPercentAtRow( int iNoteRow ) const { return GetSpeedSegmentAtRow(iNoteRow)->GetRatio(); } diff --git a/src/Transition.cpp b/src/Transition.cpp index 5f774fc02b..dbc453d99a 100644 --- a/src/Transition.cpp +++ b/src/Transition.cpp @@ -7,7 +7,7 @@ Transition::Transition() m_State = waiting; } -void Transition::Load( RString sBGAniDir ) +void Transition::Load( const RString &sBGAniDir ) { this->RemoveAllChildren(); diff --git a/src/Transition.h b/src/Transition.h index b39c2dba9d..980ad737dd 100644 --- a/src/Transition.h +++ b/src/Transition.h @@ -13,7 +13,7 @@ class Transition : public ActorFrame public: Transition(); - void Load( RString sBGAniDir ); + void Load( const RString &sBGAniDir ); virtual void UpdateInternal( float fDeltaTime ); diff --git a/src/UnlockManager.cpp b/src/UnlockManager.cpp index fca32edc61..3e55cf61ee 100644 --- a/src/UnlockManager.cpp +++ b/src/UnlockManager.cpp @@ -683,7 +683,7 @@ float UnlockManager::PointsUntilNextUnlock( UnlockRequirement t ) const return fSmallestPoints - fScores[t]; } -void UnlockManager::UnlockEntryID( RString sEntryID ) +void UnlockManager::UnlockEntryID( const RString &sEntryID ) { PROFILEMAN->GetMachineProfile()->m_UnlockedEntryIDs.insert( sEntryID ); SONGMAN->InvalidateCachedTrails(); @@ -707,7 +707,7 @@ void UnlockManager::LockEntryIndex( int entryIndex ) LockEntryID( entryID ); } -void UnlockManager::PreferUnlockEntryID( RString sUnlockEntryID ) +void UnlockManager::PreferUnlockEntryID( const RString &sUnlockEntryID ) { for( unsigned i = 0; i < m_UnlockEntries.size(); ++i ) { @@ -770,7 +770,7 @@ void UnlockManager::GetSongsUnlockedByEntryID( vector &apSongsOut, RStri apSongsOut.push_back( apEntries[i]->m_Song.ToSong() ); } -void UnlockManager::GetStepsUnlockedByEntryID( vector &apSongsOut, vector &apDifficultyOut, RString sUnlockEntryID ) +void UnlockManager::GetStepsUnlockedByEntryID( vector &apSongsOut, vector &apDifficultyOut, const RString &sUnlockEntryID ) { vector apEntries; GetUnlocksByType( UnlockRewardType_Steps, apEntries ); diff --git a/src/UnlockManager.h b/src/UnlockManager.h index 940ffa86c5..0ad8fcb305 100644 --- a/src/UnlockManager.h +++ b/src/UnlockManager.h @@ -137,7 +137,7 @@ class UnlockManager void GetPoints( const Profile *pProfile, float fScores[NUM_UnlockRequirement] ) const; // Unlock an entry by code. - void UnlockEntryID( RString sEntryID ); + void UnlockEntryID( const RString &sEntryID ); void UnlockEntryIndex( int iEntryIndex ); // Lock an entry by code. @@ -148,7 +148,7 @@ class UnlockManager * If a code is associated with at least one song or course, set the preferred song * and/or course in GAMESTATE to them. */ - void PreferUnlockEntryID( RString sEntryID ); + void PreferUnlockEntryID( const RString &sEntryID ); // Unlocks a song. void UnlockSong( const Song *pSong ); @@ -161,7 +161,7 @@ class UnlockManager void GetUnlocksByType( UnlockRewardType t, vector &apEntries ); void GetSongsUnlockedByEntryID( vector &apSongsOut, RString sEntryID ); - void GetStepsUnlockedByEntryID( vector &apSongsOut, vector &apStepsOut, RString sEntryID ); + void GetStepsUnlockedByEntryID( vector &apSongsOut, vector &apStepsOut, const RString &sEntryID ); const UnlockEntry *FindSong( const Song *pSong ) const; const UnlockEntry *FindSteps( const Song *pSong, const Steps *pSteps ) const; diff --git a/src/WheelBase.cpp b/src/WheelBase.cpp index 63648f12f1..55be4e8e5f 100644 --- a/src/WheelBase.cpp +++ b/src/WheelBase.cpp @@ -40,7 +40,7 @@ WheelBase::~WheelBase() m_LastSelection = NULL; } -void WheelBase::Load( RString sType ) +void WheelBase::Load( const RString &sType ) { LOG->Trace( "WheelBase::Load('%s')", sType.c_str() ); ASSERT( this->GetNumChildren() == 0 ); // only load once diff --git a/src/WheelBase.h b/src/WheelBase.h index 73a9ae98ac..4b1ce68408 100644 --- a/src/WheelBase.h +++ b/src/WheelBase.h @@ -34,7 +34,7 @@ class WheelBase : public ActorFrame { public: virtual ~WheelBase(); - virtual void Load( RString sType ); + virtual void Load( const RString &sType ); void BeginScreen(); virtual void Update( float fDeltaTime ); @@ -42,7 +42,7 @@ class WheelBase : public ActorFrame virtual void Move(int n); void ChangeMusicUnlessLocked( int n ); /* +1 or -1 */ virtual void ChangeMusic(int dist); /* +1 or -1 */ - virtual void SetOpenSection( RString group ) { } + virtual void SetOpenSection( const RString &group ) { } // Return true if we're moving fast automatically. int IsMoving() const; diff --git a/src/WheelItemBase.cpp b/src/WheelItemBase.cpp index 08bb71d362..c363bf459a 100644 --- a/src/WheelItemBase.cpp +++ b/src/WheelItemBase.cpp @@ -17,7 +17,7 @@ XToString( WheelItemDataType ); StringToX( WheelItemDataType ); LuaXType( WheelItemDataType ); -WheelItemBaseData::WheelItemBaseData( WheelItemDataType type, RString sText, RageColor color ) +WheelItemBaseData::WheelItemBaseData( WheelItemDataType type, const RString &sText, const RageColor &color ) { m_Type = type; m_sText = sText; @@ -35,16 +35,16 @@ WheelItemBase::WheelItemBase( const WheelItemBase &cpy ): // m_pGrayBar = m_sprBar; } -WheelItemBase::WheelItemBase(RString sType) +WheelItemBase::WheelItemBase(const RString &sType) { SetName( sType ); m_pData = NULL; m_bExpanded = false; m_pGrayBar = NULL; - Load(sType); + Load(); } -void WheelItemBase::Load( RString sType ) +void WheelItemBase::Load() { m_colorLocked = RageColor(0,0,0,0.25f); } diff --git a/src/WheelItemBase.h b/src/WheelItemBase.h index 2eea82e4db..e4fc37990c 100644 --- a/src/WheelItemBase.h +++ b/src/WheelItemBase.h @@ -28,7 +28,7 @@ LuaDeclareType( WheelItemDataType ); struct WheelItemBaseData { WheelItemBaseData() {} - WheelItemBaseData( WheelItemDataType type, RString sText, RageColor color ); + WheelItemBaseData( WheelItemDataType type, const RString &sText, const RageColor &color ); virtual ~WheelItemBaseData() {} WheelItemDataType m_Type; RString m_sText; @@ -38,12 +38,12 @@ struct WheelItemBaseData class WheelItemBase : public ActorFrame { public: - WheelItemBase( RString sType ); + WheelItemBase( const RString &sType ); WheelItemBase( const WheelItemBase &cpy ); virtual void DrawPrimitives(); virtual WheelItemBase *Copy() const { return new WheelItemBase(*this); } - void Load( RString sType ); + void Load(); void DrawGrayBar( Actor& bar ); void SetExpanded( bool bExpanded ) { m_bExpanded = bExpanded; } diff --git a/src/arch/ArchHooks/ArchHooks.cpp b/src/arch/ArchHooks/ArchHooks.cpp index 5ba40f84b1..fb2ddddced 100644 --- a/src/arch/ArchHooks/ArchHooks.cpp +++ b/src/arch/ArchHooks/ArchHooks.cpp @@ -51,7 +51,7 @@ bool ArchHooks::AppFocusChanged() return bFocusChanged; } -bool ArchHooks::GoToURL( RString sUrl ) +bool ArchHooks::GoToURL( const RString &sUrl ) { return false; } diff --git a/src/arch/ArchHooks/ArchHooks.h b/src/arch/ArchHooks/ArchHooks.h index d1b6d5fcac..3532b8652c 100644 --- a/src/arch/ArchHooks/ArchHooks.h +++ b/src/arch/ArchHooks/ArchHooks.h @@ -114,7 +114,7 @@ class ArchHooks /* * Open a URL in the default web browser */ - virtual bool GoToURL( RString sUrl ); + virtual bool GoToURL( const RString &sUrl ); virtual float GetDisplayAspectRatio() = 0; diff --git a/src/arch/ArchHooks/ArchHooks_Win32.cpp b/src/arch/ArchHooks/ArchHooks_Win32.cpp index 4919f75f11..ed5d40ec16 100644 --- a/src/arch/ArchHooks/ArchHooks_Win32.cpp +++ b/src/arch/ArchHooks/ArchHooks_Win32.cpp @@ -183,7 +183,7 @@ void ArchHooks_Win32::SetupConcurrentRenderingThread() SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL ); } -bool ArchHooks_Win32::GoToURL( RString sUrl ) +bool ArchHooks_Win32::GoToURL( const RString &sUrl ) { return ::GotoURL( sUrl ); } diff --git a/src/arch/ArchHooks/ArchHooks_Win32.h b/src/arch/ArchHooks/ArchHooks_Win32.h index 3afa17f315..3c157cb330 100644 --- a/src/arch/ArchHooks/ArchHooks_Win32.h +++ b/src/arch/ArchHooks/ArchHooks_Win32.h @@ -20,7 +20,7 @@ class ArchHooks_Win32: public ArchHooks void UnBoostPriority(); void SetupConcurrentRenderingThread(); - bool GoToURL( RString sUrl ); + bool GoToURL( const RString &sUrl ); virtual float GetDisplayAspectRatio(); RString GetClipboard(); }; diff --git a/src/arch/Dialog/Dialog.cpp b/src/arch/Dialog/Dialog.cpp index dd8d44f17f..3bd499dcdc 100644 --- a/src/arch/Dialog/Dialog.cpp +++ b/src/arch/Dialog/Dialog.cpp @@ -80,7 +80,7 @@ void Dialog::Shutdown() g_pImpl = NULL; } -static bool MessageIsIgnored( RString sID ) +static bool MessageIsIgnored( const RString &sID ) { #if !defined(SMPACKAGE) vector asList; @@ -92,7 +92,7 @@ static bool MessageIsIgnored( RString sID ) return false; } -void Dialog::IgnoreMessage( RString sID ) +void Dialog::IgnoreMessage( const RString &sID ) { // We can't ignore messages before PREFSMAN is around. #if !defined(SMPACKAGE) @@ -117,7 +117,7 @@ void Dialog::IgnoreMessage( RString sID ) #endif } -void Dialog::Error( RString sMessage, RString sID ) +void Dialog::Error( const RString &sMessage, const RString &sID ) { Dialog::Init(); @@ -139,7 +139,7 @@ void Dialog::SetWindowed( bool bWindowed ) g_bWindowed = bWindowed; } -void Dialog::OK( RString sMessage, RString sID ) +void Dialog::OK( const RString &sMessage, const RString &sID ) { Dialog::Init(); @@ -160,7 +160,7 @@ void Dialog::OK( RString sMessage, RString sID ) RageThread::SetIsShowingDialog( false ); } -Dialog::Result Dialog::OKCancel( RString sMessage, RString sID ) +Dialog::Result Dialog::OKCancel( const RString &sMessage, const RString &sID ) { Dialog::Init(); @@ -184,7 +184,7 @@ Dialog::Result Dialog::OKCancel( RString sMessage, RString sID ) return ret; } -Dialog::Result Dialog::AbortRetryIgnore( RString sMessage, RString sID ) +Dialog::Result Dialog::AbortRetryIgnore( const RString &sMessage, const RString &sID ) { Dialog::Init(); @@ -208,7 +208,7 @@ Dialog::Result Dialog::AbortRetryIgnore( RString sMessage, RString sID ) return ret; } -Dialog::Result Dialog::AbortRetry( RString sMessage, RString sID ) +Dialog::Result Dialog::AbortRetry( const RString &sMessage, const RString &sID ) { Dialog::Init(); @@ -232,7 +232,7 @@ Dialog::Result Dialog::AbortRetry( RString sMessage, RString sID ) return ret; } -Dialog::Result Dialog::YesNo( RString sMessage, RString sID ) +Dialog::Result Dialog::YesNo( const RString &sMessage, const RString &sID ) { Dialog::Init(); diff --git a/src/arch/Dialog/Dialog.h b/src/arch/Dialog/Dialog.h index d115c85b6d..86a8742283 100644 --- a/src/arch/Dialog/Dialog.h +++ b/src/arch/Dialog/Dialog.h @@ -11,15 +11,15 @@ namespace Dialog void SetWindowed( bool bWindowed ); enum Result { ok, cancel, abort, retry, ignore, yes, no }; - void Error( RString sError, RString sID = "" ); - void OK( RString sMessage, RString sID = "" ); - Result OKCancel( RString sMessage, RString sID = "" ); - Result AbortRetryIgnore( RString sMessage, RString sID = "" ); - Result AbortRetry( RString sMessage, RString sID = "" ); - Result YesNo( RString sMessage, RString sID = "" ); + void Error( const RString &sError, const RString &sID = "" ); + void OK( const RString &sMessage, const RString &sID = "" ); + Result OKCancel( const RString &sMessage, const RString &sID = "" ); + Result AbortRetryIgnore( const RString &sMessage, const RString &sID = "" ); + Result AbortRetry( const RString &sMessage, const RString &sID = "" ); + Result YesNo( const RString &sMessage, const RString &sID = "" ); /* for DialogDrivers */ - void IgnoreMessage( RString sID ); + void IgnoreMessage( const RString &sID ); } #endif diff --git a/src/arch/Dialog/DialogDriver.h b/src/arch/Dialog/DialogDriver.h index 5e377328ba..cac4ec458a 100644 --- a/src/arch/Dialog/DialogDriver.h +++ b/src/arch/Dialog/DialogDriver.h @@ -9,12 +9,12 @@ class DialogDriver public: static DialogDriver *Create(); - virtual void Error( RString sMessage, RString sID ) { printf("Error: %s\n", sMessage.c_str()); } - virtual void OK( RString sMessage, RString sID ) {} - virtual Dialog::Result OKCancel( RString sMessage, RString sID ) { return Dialog::ok; } - virtual Dialog::Result AbortRetryIgnore( RString sMessage, RString sID ) { return Dialog::ignore; } - virtual Dialog::Result AbortRetry( RString sMessage, RString sID ) { return Dialog::abort; } - virtual Dialog::Result YesNo( RString sMessage, RString sID ) { return Dialog::no; } + virtual void Error( const RString &sMessage, const RString &sID ) { printf("Error: %s\n", sMessage.c_str()); } + virtual void OK( const RString &sMessage, const RString &sID ) {} + virtual Dialog::Result OKCancel( const RString &sMessage, const RString &sID ) { return Dialog::ok; } + virtual Dialog::Result AbortRetryIgnore( const RString &sMessage, const RString &sID ) { return Dialog::ignore; } + virtual Dialog::Result AbortRetry( const RString &sMessage, const RString &sID ) { return Dialog::abort; } + virtual Dialog::Result YesNo( const RString &sMessage, const RString &sID ) { return Dialog::no; } virtual RString Init() { return RString(); } virtual ~DialogDriver() { } diff --git a/src/arch/Dialog/DialogDriver_Win32.cpp b/src/arch/Dialog/DialogDriver_Win32.cpp index d58eb4c38f..1e569ab6a9 100644 --- a/src/arch/Dialog/DialogDriver_Win32.cpp +++ b/src/arch/Dialog/DialogDriver_Win32.cpp @@ -98,7 +98,7 @@ static RString GetWindowTitle() } #endif -void DialogDriver_Win32::OK( RString sMessage, RString sID ) +void DialogDriver_Win32::OK( const RString &sMessage, const RString &sID ) { g_bAllowHush = sID != ""; g_sMessage = sMessage; @@ -112,7 +112,7 @@ void DialogDriver_Win32::OK( RString sMessage, RString sID ) Dialog::IgnoreMessage( sID ); } -Dialog::Result DialogDriver_Win32::OKCancel( RString sMessage, RString sID ) +Dialog::Result DialogDriver_Win32::OKCancel( const RString &sMessage, const RString &sID ) { g_bAllowHush = sID != ""; g_sMessage = sMessage; @@ -215,7 +215,7 @@ static BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP } #endif -void DialogDriver_Win32::Error( RString sError, RString sID ) +void DialogDriver_Win32::Error( const RString &sError, const RString &sID ) { #if !defined(SMPACKAGE) g_sErrorString = sError; @@ -228,7 +228,7 @@ void DialogDriver_Win32::Error( RString sError, RString sID ) #endif } -Dialog::Result DialogDriver_Win32::AbortRetryIgnore( RString sMessage, RString ID ) +Dialog::Result DialogDriver_Win32::AbortRetryIgnore( const RString &sMessage, const RString &ID ) { int iRet = 0; #if !defined(SMPACKAGE) @@ -246,7 +246,7 @@ Dialog::Result DialogDriver_Win32::AbortRetryIgnore( RString sMessage, RString I } } -Dialog::Result DialogDriver_Win32::AbortRetry( RString sMessage, RString sID ) +Dialog::Result DialogDriver_Win32::AbortRetry( const RString &sMessage, const RString &sID ) { int iRet = 0; #if !defined(SMPACKAGE) @@ -263,7 +263,7 @@ Dialog::Result DialogDriver_Win32::AbortRetry( RString sMessage, RString sID ) } } -Dialog::Result DialogDriver_Win32::YesNo( RString sMessage, RString sID ) +Dialog::Result DialogDriver_Win32::YesNo( const RString &sMessage, const RString &sID ) { int iRet = 0; #if !defined(SMPACKAGE) diff --git a/src/arch/Dialog/DialogDriver_Win32.h b/src/arch/Dialog/DialogDriver_Win32.h index 3edc6e1544..cb3a75bc30 100644 --- a/src/arch/Dialog/DialogDriver_Win32.h +++ b/src/arch/Dialog/DialogDriver_Win32.h @@ -6,12 +6,12 @@ class DialogDriver_Win32: public DialogDriver { public: - void Error( RString sMessage, RString sID ); - void OK( RString sMessage, RString sID ); - Dialog::Result OKCancel( RString sMessage, RString sID ); - Dialog::Result AbortRetryIgnore( RString sMessage, RString sID ); - Dialog::Result AbortRetry( RString sMessage, RString sID ); - Dialog::Result YesNo( RString sMessage, RString sID ); + void Error( const RString &sMessage, const RString &sID ); + void OK( const RString &sMessage, const RString &sID ); + Dialog::Result OKCancel( const RString &sMessage, const RString &sID ); + Dialog::Result AbortRetryIgnore( const RString &sMessage, const RString &sID ); + Dialog::Result AbortRetry( const RString &sMessage, const RString &sID ); + Dialog::Result YesNo( const RString &sMessage, const RString &sID ); }; #endif diff --git a/src/arch/LoadingWindow/LoadingWindow.h b/src/arch/LoadingWindow/LoadingWindow.h index 63dcb963c4..6a283cb727 100644 --- a/src/arch/LoadingWindow/LoadingWindow.h +++ b/src/arch/LoadingWindow/LoadingWindow.h @@ -11,7 +11,7 @@ class LoadingWindow virtual RString Init() { return RString(); } virtual ~LoadingWindow() { } - virtual void SetText( RString str ) = 0; + virtual void SetText( const RString &str ) = 0; virtual void SetIcon( const RageSurface *pIcon ) { } virtual void SetSplash( const RageSurface *pSplash ) { } virtual void SetProgress( const int progress ) { m_progress=progress; } diff --git a/src/arch/LoadingWindow/LoadingWindow_Gtk.h b/src/arch/LoadingWindow/LoadingWindow_Gtk.h index 952638d414..dae99cddf1 100644 --- a/src/arch/LoadingWindow/LoadingWindow_Gtk.h +++ b/src/arch/LoadingWindow/LoadingWindow_Gtk.h @@ -11,7 +11,7 @@ class LoadingWindow_Gtk: public LoadingWindow LoadingWindow_Gtk(); RString Init(); ~LoadingWindow_Gtk(); - void SetText( RString str ); + void SetText( const RString &str ); void SetIcon( const RageSurface *pIcon ); void SetSplash( const RageSurface *pSplash ); void SetProgress( const int progress ); diff --git a/src/arch/LoadingWindow/LoadingWindow_MacOSX.h b/src/arch/LoadingWindow/LoadingWindow_MacOSX.h index 7db7e62ebf..03b7aec7d1 100644 --- a/src/arch/LoadingWindow/LoadingWindow_MacOSX.h +++ b/src/arch/LoadingWindow/LoadingWindow_MacOSX.h @@ -8,7 +8,7 @@ class LoadingWindow_MacOSX : public LoadingWindow public: LoadingWindow_MacOSX(); ~LoadingWindow_MacOSX(); - void SetText( RString str ); + void SetText( const RString &str ); void SetSplash( const RageSurface *pSplash ); void SetProgress( const int progress ); void SetTotalWork( const int totalWork ); diff --git a/src/arch/LoadingWindow/LoadingWindow_Null.h b/src/arch/LoadingWindow/LoadingWindow_Null.h index efaed7ea49..3135d585cb 100644 --- a/src/arch/LoadingWindow/LoadingWindow_Null.h +++ b/src/arch/LoadingWindow/LoadingWindow_Null.h @@ -6,7 +6,7 @@ class LoadingWindow_Null: public LoadingWindow { public: - void SetText( RString str ) { } + void SetText( const RString &str ) { } void SetSplash( const RageSurface *pSplash ) { } }; #define USE_LOADING_WINDOW_NULL diff --git a/src/arch/LoadingWindow/LoadingWindow_Win32.cpp b/src/arch/LoadingWindow/LoadingWindow_Win32.cpp index 9de5ece9b6..6fb4d77a83 100644 --- a/src/arch/LoadingWindow/LoadingWindow_Win32.cpp +++ b/src/arch/LoadingWindow/LoadingWindow_Win32.cpp @@ -175,7 +175,7 @@ void LoadingWindow_Win32::Paint() } } -void LoadingWindow_Win32::SetText( RString sText ) +void LoadingWindow_Win32::SetText( const RString &sText ) { vector asMessageLines; split( sText, "\n", asMessageLines, false ); diff --git a/src/arch/LoadingWindow/LoadingWindow_Win32.h b/src/arch/LoadingWindow/LoadingWindow_Win32.h index bce72a4de4..bebba37354 100644 --- a/src/arch/LoadingWindow/LoadingWindow_Win32.h +++ b/src/arch/LoadingWindow/LoadingWindow_Win32.h @@ -14,7 +14,7 @@ class LoadingWindow_Win32: public LoadingWindow ~LoadingWindow_Win32(); void Paint(); - void SetText( RString sText ); + void SetText( const RString &sText ); void SetIcon( const RageSurface *pIcon ); void SetSplash( const RageSurface *pSplash ); void SetProgress( const int progress ); diff --git a/src/arch/LowLevelWindow/LowLevelWindow.h b/src/arch/LowLevelWindow/LowLevelWindow.h index 88b72475e6..3c7700b4a8 100644 --- a/src/arch/LowLevelWindow/LowLevelWindow.h +++ b/src/arch/LowLevelWindow/LowLevelWindow.h @@ -16,7 +16,7 @@ class LowLevelWindow virtual ~LowLevelWindow() { } - virtual void *GetProcAddress( RString s ) = 0; + virtual void *GetProcAddress( const RString &s ) = 0; // Return "" if mode change was successful, otherwise an error message. // bNewDeviceOut is set true if a new device was created and textures diff --git a/src/arch/LowLevelWindow/LowLevelWindow_Win32.cpp b/src/arch/LowLevelWindow/LowLevelWindow_Win32.cpp index ab753482da..09578ca3b6 100644 --- a/src/arch/LowLevelWindow/LowLevelWindow_Win32.cpp +++ b/src/arch/LowLevelWindow/LowLevelWindow_Win32.cpp @@ -36,7 +36,7 @@ static void DestroyGraphicsWindowAndOpenGLContext() GraphicsWindow::DestroyGraphicsWindow(); } -void *LowLevelWindow_Win32::GetProcAddress( RString s ) +void *LowLevelWindow_Win32::GetProcAddress( const RString &s ) { void *pRet = (void*) wglGetProcAddress( s ); if( pRet != NULL ) diff --git a/src/arch/LowLevelWindow/LowLevelWindow_Win32.h b/src/arch/LowLevelWindow/LowLevelWindow_Win32.h index 812ffbfbd1..ab409e0933 100644 --- a/src/arch/LowLevelWindow/LowLevelWindow_Win32.h +++ b/src/arch/LowLevelWindow/LowLevelWindow_Win32.h @@ -8,7 +8,7 @@ class LowLevelWindow_Win32: public LowLevelWindow public: LowLevelWindow_Win32(); ~LowLevelWindow_Win32(); - void *GetProcAddress( RString s ); + void *GetProcAddress( const RString &s ); RString TryVideoMode( const VideoModeParams &p, bool &bNewDeviceOut ); void GetDisplayResolutions( DisplayResolutions &out ) const; bool IsSoftwareRenderer( RString &sError ); diff --git a/src/arch/MovieTexture/MovieTexture.cpp b/src/arch/MovieTexture/MovieTexture.cpp index 8c9190117f..83cbe97710 100644 --- a/src/arch/MovieTexture/MovieTexture.cpp +++ b/src/arch/MovieTexture/MovieTexture.cpp @@ -16,7 +16,7 @@ void ForceToAscii( RString &str ) str[i] = '?'; } -bool RageMovieTexture::GetFourCC( RString fn, RString &handler, RString &type ) +bool RageMovieTexture::GetFourCC( const RString &fn, RString &handler, RString &type ) { RString ignore, ext; splitpath( fn, ignore, ignore, ext); @@ -78,7 +78,7 @@ static Preference g_sMovieDrivers( "MovieDrivers", "" ); // "" == defau /* Try drivers in order of preference until we find one that works. */ static LocalizedString MOVIE_DRIVERS_EMPTY ( "Arch", "Movie Drivers cannot be empty." ); static LocalizedString COULDNT_CREATE_MOVIE_DRIVER ( "Arch", "Couldn't create a movie driver." ); -RageMovieTexture *RageMovieTexture::Create( RageTextureID ID ) +RageMovieTexture *RageMovieTexture::Create( const RageTextureID &ID ) { DumpAVIDebugInfo( ID.filename ); diff --git a/src/arch/MovieTexture/MovieTexture.h b/src/arch/MovieTexture/MovieTexture.h index 4ab84e843c..986b254e6b 100644 --- a/src/arch/MovieTexture/MovieTexture.h +++ b/src/arch/MovieTexture/MovieTexture.h @@ -10,9 +10,9 @@ void ForceToAscii( RString &str ); class RageMovieTexture : public RageTexture { public: - static RageMovieTexture *Create( RageTextureID ID ); + static RageMovieTexture *Create( const RageTextureID &ID ); - RageMovieTexture( RageTextureID ID ): RageTexture(ID) { } + RageMovieTexture( const RageTextureID &ID ): RageTexture(ID) { } virtual ~RageMovieTexture() { } virtual void Update( float /* fDeltaTime */ ) { } @@ -24,14 +24,14 @@ class RageMovieTexture : public RageTexture bool IsAMovie() const { return true; } - static bool GetFourCC( RString fn, RString &handler, RString &type ); + static bool GetFourCC( const RString &fn, RString &handler, RString &type ); }; class RageMovieTextureDriver: public RageDriver { public: virtual ~RageMovieTextureDriver() { } - virtual RageMovieTexture *Create( RageTextureID ID, RString &sError ) = 0; + virtual RageMovieTexture *Create( const RageTextureID &ID, RString &sError ) = 0; static DriverList m_pDriverList; }; diff --git a/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp b/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp index bdf23563c9..254fded9e9 100644 --- a/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +++ b/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp @@ -409,7 +409,7 @@ static int64_t AVIORageFile_Seek( void *opaque, int64_t offset, int whence ) return f->Seek( (int) offset, whence ); } -RString MovieDecoder_FFMpeg::Open( RString sFile ) +RString MovieDecoder_FFMpeg::Open( const RString &sFile ) { MovieTexture_FFMpeg::RegisterProtocols(); @@ -515,12 +515,12 @@ RageSurface *MovieDecoder_FFMpeg::CreateCompatibleSurface( int iTextureWidth, in return RageMovieTextureDriver_FFMpeg::AVCodecCreateCompatibleSurface( iTextureWidth, iTextureHeight, bPreferHighColor, *ConvertValue(&m_AVTexfmt), fmtout ); } -MovieTexture_FFMpeg::MovieTexture_FFMpeg( RageTextureID ID ): +MovieTexture_FFMpeg::MovieTexture_FFMpeg( const RageTextureID &ID ): MovieTexture_Generic( ID, new MovieDecoder_FFMpeg ) { } -RageMovieTexture *RageMovieTextureDriver_FFMpeg::Create( RageTextureID ID, RString &sError ) +RageMovieTexture *RageMovieTextureDriver_FFMpeg::Create( const RageTextureID &ID, RString &sError ) { MovieTexture_FFMpeg *pRet = new MovieTexture_FFMpeg( ID ); sError = pRet->Init(); diff --git a/src/arch/MovieTexture/MovieTexture_FFMpeg.h b/src/arch/MovieTexture/MovieTexture_FFMpeg.h index f4d25efbef..7f49e2eadd 100644 --- a/src/arch/MovieTexture/MovieTexture_FFMpeg.h +++ b/src/arch/MovieTexture/MovieTexture_FFMpeg.h @@ -22,7 +22,7 @@ static const int sws_flags = SWS_BICUBIC; // XXX: Reasonable default? class MovieTexture_FFMpeg: public MovieTexture_Generic { public: - MovieTexture_FFMpeg( RageTextureID ID ); + MovieTexture_FFMpeg( const RageTextureID &ID ); static void RegisterProtocols(); static RageSurface *AVCodecCreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor, int &iAVTexfmt, MovieDecoderPixelFormatYCbCr &fmtout ); @@ -31,7 +31,7 @@ class MovieTexture_FFMpeg: public MovieTexture_Generic class RageMovieTextureDriver_FFMpeg: public RageMovieTextureDriver { public: - virtual RageMovieTexture *Create( RageTextureID ID, RString &sError ); + virtual RageMovieTexture *Create( const RageTextureID &ID, RString &sError ); static RageSurface *AVCodecCreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor, int &iAVTexfmt, MovieDecoderPixelFormatYCbCr &fmtout ); }; @@ -41,7 +41,7 @@ class MovieDecoder_FFMpeg: public MovieDecoder MovieDecoder_FFMpeg(); ~MovieDecoder_FFMpeg(); - RString Open( RString sFile ); + RString Open( const RString &sFile ); void Close(); void Rewind(); diff --git a/src/arch/MovieTexture/MovieTexture_Generic.cpp b/src/arch/MovieTexture/MovieTexture_Generic.cpp index ec59f503d7..81f3ed6974 100644 --- a/src/arch/MovieTexture/MovieTexture_Generic.cpp +++ b/src/arch/MovieTexture/MovieTexture_Generic.cpp @@ -17,7 +17,7 @@ static Preference g_bMovieTextureDirectUpdates( "MovieTextureDirectUpdates", true ); -MovieTexture_Generic::MovieTexture_Generic( RageTextureID ID, MovieDecoder *pDecoder ): +MovieTexture_Generic::MovieTexture_Generic( const RageTextureID &ID, MovieDecoder *pDecoder ): RageMovieTexture( ID ) { LOG->Trace( "MovieTexture_Generic::MovieTexture_Generic(%s)", ID.filename.c_str() ); diff --git a/src/arch/MovieTexture/MovieTexture_Generic.h b/src/arch/MovieTexture/MovieTexture_Generic.h index 2967ddac7e..de9f7cf4b3 100644 --- a/src/arch/MovieTexture/MovieTexture_Generic.h +++ b/src/arch/MovieTexture/MovieTexture_Generic.h @@ -22,7 +22,7 @@ class MovieDecoder public: virtual ~MovieDecoder() { } - virtual RString Open( RString sFile ) = 0; + virtual RString Open( const RString &sFile ) = 0; virtual void Close() = 0; virtual void Rewind() = 0; @@ -80,7 +80,7 @@ class MovieDecoder class MovieTexture_Generic: public RageMovieTexture { public: - MovieTexture_Generic( RageTextureID ID, MovieDecoder *pDecoder ); + MovieTexture_Generic( const RageTextureID &ID, MovieDecoder *pDecoder ); virtual ~MovieTexture_Generic(); RString Init(); diff --git a/src/arch/MovieTexture/MovieTexture_Null.cpp b/src/arch/MovieTexture/MovieTexture_Null.cpp index 6777aa88cf..979aa73477 100644 --- a/src/arch/MovieTexture/MovieTexture_Null.cpp +++ b/src/arch/MovieTexture/MovieTexture_Null.cpp @@ -66,7 +66,7 @@ MovieTexture_Null::~MovieTexture_Null() REGISTER_MOVIE_TEXTURE_CLASS( Null ); -RageMovieTexture *RageMovieTextureDriver_Null::Create( RageTextureID ID, RString &sError ) +RageMovieTexture *RageMovieTextureDriver_Null::Create( const RageTextureID &ID, RString &sError ) { return new MovieTexture_Null( ID ); } diff --git a/src/arch/MovieTexture/MovieTexture_Null.h b/src/arch/MovieTexture/MovieTexture_Null.h index 8c29204e3a..f5ad1e1e18 100644 --- a/src/arch/MovieTexture/MovieTexture_Null.h +++ b/src/arch/MovieTexture/MovieTexture_Null.h @@ -6,7 +6,7 @@ class RageMovieTextureDriver_Null: public RageMovieTextureDriver { public: - virtual RageMovieTexture *Create( RageTextureID ID, RString &sError ); + virtual RageMovieTexture *Create( const RageTextureID &ID, RString &sError ); }; #endif diff --git a/src/archutils/Win32/Crash.cpp b/src/archutils/Win32/Crash.cpp index d9c9784882..ea2c0be0dd 100644 --- a/src/archutils/Win32/Crash.cpp +++ b/src/archutils/Win32/Crash.cpp @@ -562,7 +562,7 @@ static void NORETURN debug_crash() /* Get a stack trace of the current thread and the specified thread. * If iID == GetInvalidThreadId(), then output a stack trace for every thread. */ -void CrashHandler::ForceDeadlock( RString reason, uint64_t iID ) +void CrashHandler::ForceDeadlock( const RString &reason, uint64_t iID ) { strncpy( g_CrashInfo.m_CrashReason, reason, sizeof(g_CrashInfo.m_CrashReason) ); g_CrashInfo.m_CrashReason[ sizeof(g_CrashInfo.m_CrashReason)-1 ] = 0; diff --git a/src/archutils/Win32/Crash.h b/src/archutils/Win32/Crash.h index 15f0eb9a04..a51e0e9285 100644 --- a/src/archutils/Win32/Crash.h +++ b/src/archutils/Win32/Crash.h @@ -9,7 +9,7 @@ namespace CrashHandler void do_backtrace( const void **buf, size_t size, HANDLE hProcess, HANDLE hThread, const CONTEXT *pContext ); void SymLookup( const void *ptr, char *buf ); void ForceCrash( const char *reason ); - void ForceDeadlock( RString reason, uint64_t iID ); + void ForceDeadlock( const RString &reason, uint64_t iID ); /* Inform the crash handler of a foreground window that may be fullscreen. * If set, the crash handler will attempt to hide the window or reset the diff --git a/src/archutils/Win32/ErrorStrings.cpp b/src/archutils/Win32/ErrorStrings.cpp index 5e6dccc06b..fb1057f06a 100644 --- a/src/archutils/Win32/ErrorStrings.cpp +++ b/src/archutils/Win32/ErrorStrings.cpp @@ -25,7 +25,7 @@ RString werr_ssprintf( int err, const char *fmt, ... ) return s += ssprintf( " (%s)", text.c_str() ); } -RString ConvertWstringToCodepage( wstring s, int iCodePage ) +RString ConvertWstringToCodepage( const wstring &s, int iCodePage ) { if( s.empty() ) return RString(); @@ -48,7 +48,7 @@ RString ConvertUTF8ToACP( const RString &s ) return ConvertWstringToCodepage( RStringToWstring(s), CP_ACP ); } -wstring ConvertCodepageToWString( RString s, int iCodePage ) +wstring ConvertCodepageToWString( const RString &s, int iCodePage ) { if( s.empty() ) return wstring(); diff --git a/src/archutils/Win32/ErrorStrings.h b/src/archutils/Win32/ErrorStrings.h index 123a24520c..ec3c69dd81 100644 --- a/src/archutils/Win32/ErrorStrings.h +++ b/src/archutils/Win32/ErrorStrings.h @@ -2,9 +2,9 @@ #define ERROR_STRINGS_H RString werr_ssprintf( int err, const char *fmt, ... ); -RString ConvertWstringToCodepage( wstring s, int iCodePage ); +RString ConvertWstringToCodepage( const wstring &s, int iCodePage ); RString ConvertUTF8ToACP( const RString &s ); -wstring ConvertCodepageToWString( RString s, int iCodePage ); +wstring ConvertCodepageToWString( const RString &s, int iCodePage ); RString ConvertACPToUTF8( const RString &s ); #endif diff --git a/src/archutils/Win32/GetFileInformation.cpp b/src/archutils/Win32/GetFileInformation.cpp index cf9d814023..d38f750f06 100644 --- a/src/archutils/Win32/GetFileInformation.cpp +++ b/src/archutils/Win32/GetFileInformation.cpp @@ -11,7 +11,7 @@ #pragma comment(lib, "version.lib") #endif -bool GetFileVersion( RString sFile, RString &sOut ) +bool GetFileVersion( const RString &sFile, RString &sOut ) { do { // Cast away const to work around header bug in VC6. @@ -61,7 +61,7 @@ bool GetFileVersion( RString sFile, RString &sOut ) return true; } -RString FindSystemFile( RString sFile ) +RString FindSystemFile( const RString &sFile ) { char szWindowsPath[MAX_PATH]; GetWindowsDirectory( szWindowsPath, MAX_PATH ); diff --git a/src/archutils/Win32/GetFileInformation.h b/src/archutils/Win32/GetFileInformation.h index 920da1eee2..8b50ff4342 100644 --- a/src/archutils/Win32/GetFileInformation.h +++ b/src/archutils/Win32/GetFileInformation.h @@ -3,8 +3,8 @@ #ifndef GET_FILE_INFORMATION_H #define GET_FILE_INFORMATION_H -bool GetFileVersion( RString fsFile, RString &sOut ); -RString FindSystemFile( RString sFile ); +bool GetFileVersion( const RString &fsFile, RString &sOut ); +RString FindSystemFile( const RString &sFile ); bool GetProcessFileName( uint32_t iProcessID, RString &sName ); #endif diff --git a/src/archutils/Win32/GotoURL.cpp b/src/archutils/Win32/GotoURL.cpp index f6cc247506..293079441e 100644 --- a/src/archutils/Win32/GotoURL.cpp +++ b/src/archutils/Win32/GotoURL.cpp @@ -22,7 +22,7 @@ static LONG GetRegKey( HKEY key, RString subkey, LPTSTR retdata ) return ERROR_SUCCESS; } -bool GotoURL( RString sUrl ) +bool GotoURL( const RString &sUrl ) { // First try ShellExecute() int iRet = (int) ShellExecute( NULL, "open", sUrl, NULL, NULL, SW_SHOWDEFAULT ); diff --git a/src/archutils/Win32/GotoURL.h b/src/archutils/Win32/GotoURL.h index 7721eaecfd..ba233f7ea2 100644 --- a/src/archutils/Win32/GotoURL.h +++ b/src/archutils/Win32/GotoURL.h @@ -2,7 +2,7 @@ #define GOTO_URL_H /** @brief Open URLs in a browser. */ -bool GotoURL( RString sUrl ); +bool GotoURL( const RString &sUrl ); #endif diff --git a/src/archutils/Win32/USB.cpp b/src/archutils/Win32/USB.cpp index 612b0aace0..69e117afc4 100644 --- a/src/archutils/Win32/USB.cpp +++ b/src/archutils/Win32/USB.cpp @@ -125,7 +125,7 @@ WindowsFileIO::~WindowsFileIO() delete[] m_pBuffer; } -bool WindowsFileIO::Open( RString path, int iBlockSize ) +bool WindowsFileIO::Open( const RString &path, int iBlockSize ) { LOG->Trace( "WindowsFileIO::open(%s)", path.c_str() ); m_iBlockSize = iBlockSize; diff --git a/src/archutils/Win32/USB.h b/src/archutils/Win32/USB.h index 8e63a7f637..61686ac058 100644 --- a/src/archutils/Win32/USB.h +++ b/src/archutils/Win32/USB.h @@ -11,7 +11,7 @@ class WindowsFileIO public: WindowsFileIO(); ~WindowsFileIO(); - bool Open( RString sPath, int iBlockSize ); + bool Open( const RString &sPath, int iBlockSize ); bool IsOpen() const; /* Nonblocking read. size must always be the same. Returns the number of bytes