diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 636cab69d7..11f7376823 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -13,14 +13,15 @@ #include "RageUtil.h" -unsigned long randseed = time(NULL); - #include +#include #include #include #include #include +unsigned long randseed = time(NULL); + int power_of_two(int input) { int value = 1; @@ -30,7 +31,7 @@ int power_of_two(int input) return value; } -bool IsAnInt( const char *s ) +bool IsAnInt( const CString &s ) { if( s[0] == '\0' ) return false; @@ -145,8 +146,8 @@ void split( const CString &Source, const CString &Deliminator, CStringArray& Add int pos = Source.Find(Deliminator, startpos); if ( pos == -1 ) pos=Source.GetLength(); - CString AddCString = Source.Mid(startpos, pos-startpos); - if( AddCString.IsEmpty() && bIgnoreEmpty ) + CString AddCString = Source.substr(startpos, pos-startpos); + if( AddCString.empty() && bIgnoreEmpty ) ; // do nothing else AddIt.push_back(AddCString); @@ -174,7 +175,7 @@ void splitpath( bool UsingDirsOnly, const CString &Path, CString& Drive, CString else if (nSecond > nFirst) Drive = Path.Left(nSecond); } - else if (Path.Mid(1,1) == ":" ) // drive letter + else if (Path[1] == ':' ) // drive letter { nSecond = 2; Drive = Path.Left(2); @@ -199,7 +200,7 @@ void splitpath( bool UsingDirsOnly, const CString &Path, CString& Drive, CString } else { - Dir = Path.Mid(nSecond + 1, (nDirEnd - nSecond) - 1); + Dir = Path.substr(nSecond + 1, (nDirEnd - nSecond) - 1); int nFileEnd = Path.ReverseFind('.'); if (nFileEnd != -1) { @@ -209,7 +210,7 @@ void splitpath( bool UsingDirsOnly, const CString &Path, CString& Drive, CString Ext = ""; } else { - FName = Path.Mid(nDirEnd + 1, (nFileEnd - nDirEnd) - 1); + FName = Path.substr(nDirEnd + 1, (nFileEnd - nDirEnd) - 1); Ext = Path.Right((Path.GetLength() - nFileEnd) - 1); } } diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 93e9c58b7d..befea337db 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -113,7 +113,7 @@ inline float froundf( const float f, const float fRoundInterval ) } int power_of_two(int input); -bool IsAnInt( const char *s ); +bool IsAnInt( const CString &s ); float TimeToSeconds( CString sHMS ); CString SecondsToTime( float fSecs ); diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 5c905e4e8d..eff84d295e 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -72,6 +72,8 @@ HWND g_hWndMain = NULL; #endif +#include + // command line arguments CString g_sSongPath = ""; CString g_sServerIP = "";