s/throw RageException/RageException::Throw/

This commit is contained in:
Glenn Maynard
2002-12-21 18:36:10 +00:00
parent 783a9de6b0
commit 33c1fb46f7
8 changed files with 21 additions and 21 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ void Course::LoadFromCRSFile( CString sPath, CArray<Song*,Song*> &apSongs )
{ {
MsdFile msd; MsdFile msd;
if( !msd.ReadFile(sPath) ) if( !msd.ReadFile(sPath) )
throw RageException( "Error opening CRS file '%s'.", sPath.GetString() ); RageException::Throw( "Error opening CRS file '%s'.", sPath.GetString() );
CString sDir, sFName, sExt; CString sDir, sFName, sExt;
splitrelpath( sPath, sDir, sFName, sExt ); splitrelpath( sPath, sDir, sFName, sExt );
+4 -4
View File
@@ -41,7 +41,7 @@ Font::Font( const CString &sASCIITexturePath )
m_pTexture = TEXTUREMAN->LoadTexture( m_sTexturePath, RageTexturePrefs() ); m_pTexture = TEXTUREMAN->LoadTexture( m_sTexturePath, RageTexturePrefs() );
ASSERT( m_pTexture != NULL ); ASSERT( m_pTexture != NULL );
if( m_pTexture->GetNumFrames() != 16*16 ) if( m_pTexture->GetNumFrames() != 16*16 )
throw RageException( "The font '%s' has only %d frames. All fonts must have 16*16 frames.", m_sTexturePath.GetString() ); RageException::Throw( "The font '%s' has only %d frames. All fonts must have 16*16 frames.", m_sTexturePath.GetString() );
for( i=0; i<256; i++ ) for( i=0; i<256; i++ )
m_iCharToFrameNo[i] = i; m_iCharToFrameNo[i] = i;
@@ -57,7 +57,7 @@ Font::Font( const CString &sASCIITexturePath )
// load character widths // load character widths
for( i=0; i<256; i++ ) for( i=0; i<256; i++ )
if( !ini.GetValueI( "Char Widths", ssprintf("%d",i), m_iFrameNoToWidth[i] ) ) if( !ini.GetValueI( "Char Widths", ssprintf("%d",i), m_iFrameNoToWidth[i] ) )
throw RageException( "Error reading width value '%d' from '%s'.", i, sIniPath.GetString() ); RageException::Throw( "Error reading width value '%d' from '%s'.", i, sIniPath.GetString() );
m_bCapitalsOnly = false; m_bCapitalsOnly = false;
ini.GetValueB( "Char Widths", "CapitalsOnly", m_bCapitalsOnly ); ini.GetValueB( "Char Widths", "CapitalsOnly", m_bCapitalsOnly );
@@ -125,7 +125,7 @@ Font::Font( const CString &sTexturePath, const CString& sCharacters )
// //
// sanity check // sanity check
if( sCharacters.GetLength() != m_pTexture->GetNumFrames() ) if( sCharacters.GetLength() != m_pTexture->GetNumFrames() )
throw RageException( "The image '%s' doesn't have the correct number of frames. It has %d frames but should have %d frames.", RageException::Throw( "The image '%s' doesn't have the correct number of frames. It has %d frames but should have %d frames.",
m_sTexturePath.GetString(), m_pTexture->GetNumFrames(), sCharacters.GetLength() ); m_sTexturePath.GetString(), m_pTexture->GetNumFrames(), sCharacters.GetLength() );
// set the char to frame number map // set the char to frame number map
@@ -159,7 +159,7 @@ int Font::GetLineWidthInSourcePixels( const char *szLine, int iLength )
const char c = szLine[i]; const char c = szLine[i];
const int iFrameNo = m_iCharToFrameNo[ (unsigned char)c ]; const int iFrameNo = m_iCharToFrameNo[ (unsigned char)c ];
if( iFrameNo == -1 ) // this font doesn't impelemnt this character if( iFrameNo == -1 ) // this font doesn't impelemnt this character
throw RageException( "The font '%s' does not implement the character '%c'", m_sTexturePath.GetString(), c ); RageException::Throw( "The font '%s' does not implement the character '%c'", m_sTexturePath.GetString(), c );
iLineWidth += m_iFrameNoToWidth[iFrameNo]; iLineWidth += m_iFrameNoToWidth[iFrameNo];
} }
+7 -7
View File
@@ -69,7 +69,7 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Notes &out )
ifstream file(sPath); ifstream file(sPath);
if( file.bad() ) if( file.bad() )
throw RageException( "Failed to open %s for reading.", sPath.GetString() ); RageException::Throw( "Failed to open %s for reading.", sPath.GetString() );
CString line; CString line;
while( getline(file, line) ) // foreach line while( getline(file, line) ) // foreach line
@@ -116,7 +116,7 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Notes &out )
out.m_NotesType = NOTES_TYPE_DANCE_DOUBLE; out.m_NotesType = NOTES_TYPE_DANCE_DOUBLE;
break; break;
default: default:
throw RageException( "Invalid value '%d' for '#player'", atoi(value_data) ); RageException::Throw( "Invalid value '%d' for '#player'", atoi(value_data) );
} }
} }
if( -1 != value_name.Find("#title") ) if( -1 != value_name.Find("#title") )
@@ -226,7 +226,7 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Notes &out )
iTransformNewToOld[5] = DANCE_NOTE_PAD1_RIGHT; iTransformNewToOld[5] = DANCE_NOTE_PAD1_RIGHT;
break; break;
default: default:
throw RageException( "Invalid NotesType." ); RageException::Throw( "Invalid NotesType." );
} }
NoteData* pNoteData2 = new NoteData; NoteData* pNoteData2 = new NoteData;
@@ -256,7 +256,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
GetApplicableFiles( sDir, arrayBMSFileNames ); GetApplicableFiles( sDir, arrayBMSFileNames );
if( arrayBMSFileNames.empty() ) if( arrayBMSFileNames.empty() )
throw RageException( "Couldn't find any BMS files in '%s'", sDir.GetString() ); RageException::Throw( "Couldn't find any BMS files in '%s'", sDir.GetString() );
// load the Notes from the rest of the BMS files // load the Notes from the rest of the BMS files
unsigned i; unsigned i;
@@ -276,7 +276,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
ifstream file(sPath); ifstream file(sPath);
if( file.bad() ) if( file.bad() )
throw RageException( "Failed to open %s for reading.", sPath.GetString() ); RageException::Throw( "Failed to open %s for reading.", sPath.GetString() );
CString line; CString line;
while( getline(file, line) ) // foreach line while( getline(file, line) ) // foreach line
@@ -413,7 +413,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
// open the song file again and and look for this tag's value // open the song file again and and look for this tag's value
ifstream file(sPath); ifstream file(sPath);
if( file.bad() ) if( file.bad() )
throw RageException( "Failed to open %s for reading.", sPath.GetString() ); RageException::Throw( "Failed to open %s for reading.", sPath.GetString() );
CString line; CString line;
while( getline(file, line) ) // foreach line while( getline(file, line) ) // foreach line
@@ -474,7 +474,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
// open the song file again and and look for this tag's value // open the song file again and and look for this tag's value
ifstream file(sPath); ifstream file(sPath);
if( file.bad() ) if( file.bad() )
throw RageException( "Failed to open %s for reading.", sPath.GetString() ); RageException::Throw( "Failed to open %s for reading.", sPath.GetString() );
CString line; CString line;
while( getline(file, line) ) // foreach line while( getline(file, line) ) // foreach line
+2 -2
View File
@@ -250,7 +250,7 @@ bool DWILoader::LoadFromDWIFile( CString sPath, Song &out )
MsdFile msd; MsdFile msd;
bool bResult = msd.ReadFile( sPath ); bool bResult = msd.ReadFile( sPath );
if( !bResult ) if( !bResult )
throw RageException( "Error opening file '%s' for reading.", sPath.GetString() ); RageException::Throw( "Error opening file '%s' for reading.", sPath.GetString() );
for( unsigned i=0; i<msd.m_iNumValues; i++ ) for( unsigned i=0; i<msd.m_iNumValues; i++ )
{ {
@@ -378,7 +378,7 @@ bool DWILoader::LoadFromDir( CString sPath, Song &out )
GetApplicableFiles( sPath, aFileNames ); GetApplicableFiles( sPath, aFileNames );
if( aFileNames.size() > 1 ) if( aFileNames.size() > 1 )
throw RageException( "There is more than one DWI file in '%s'. There should be only one!", sPath.GetString() ); RageException::Throw( "There is more than one DWI file in '%s'. There should be only one!", sPath.GetString() );
/* We should have exactly one; if we had none, we shouldn't have been /* We should have exactly one; if we had none, we shouldn't have been
* called to begin with. */ * called to begin with. */
+3 -3
View File
@@ -16,7 +16,7 @@ bool KSFLoader::LoadFromKSFFile( const CString &sPath, Notes &out )
MsdFile msd; MsdFile msd;
bool bResult = msd.ReadFile( sPath ); bool bResult = msd.ReadFile( sPath );
if( !bResult ) if( !bResult )
throw RageException( "Error opening file '%s'.", sPath.GetString() ); RageException::Throw( "Error opening file '%s'.", sPath.GetString() );
int iTickCount = -1; // this is the value we read for TICKCOUNT int iTickCount = -1; // this is the value we read for TICKCOUNT
CString iStep; // this is the value we read for STEP CString iStep; // this is the value we read for STEP
@@ -159,7 +159,7 @@ bool KSFLoader::LoadFromDir( CString sDir, Song &out )
GetDirListing( sDir + CString("*.ksf"), arrayKSFFileNames ); GetDirListing( sDir + CString("*.ksf"), arrayKSFFileNames );
if( arrayKSFFileNames.empty() ) if( arrayKSFFileNames.empty() )
throw RageException( "Couldn't find any KSF files in '%s'", sDir.GetString() ); RageException::Throw( "Couldn't find any KSF files in '%s'", sDir.GetString() );
// load the Notes from the rest of the KSF files // load the Notes from the rest of the KSF files
unsigned i; unsigned i;
@@ -175,7 +175,7 @@ bool KSFLoader::LoadFromDir( CString sDir, Song &out )
MsdFile msd; MsdFile msd;
bool bResult = msd.ReadFile( sPath ); bool bResult = msd.ReadFile( sPath );
if( !bResult ) if( !bResult )
throw RageException( "Error opening file '%s'.", sPath.GetString() ); RageException::Throw( "Error opening file '%s'.", sPath.GetString() );
for( i=0; i < msd.m_iNumValues; i++ ) for( i=0; i < msd.m_iNumValues; i++ )
{ {
+2 -2
View File
@@ -57,7 +57,7 @@ bool SMLoader::LoadFromSMFile( CString sPath, Song &out )
MsdFile msd; MsdFile msd;
bool bResult = msd.ReadFile( sPath ); bool bResult = msd.ReadFile( sPath );
if( !bResult ) if( !bResult )
throw RageException( "Error opening file '%s'.", sPath.GetString() ); RageException::Throw( "Error opening file '%s'.", sPath.GetString() );
for( unsigned i=0; i<msd.m_iNumValues; i++ ) for( unsigned i=0; i<msd.m_iNumValues; i++ )
{ {
@@ -221,7 +221,7 @@ bool SMLoader::LoadFromDir( CString sPath, Song &out )
GetApplicableFiles( sPath, aFileNames ); GetApplicableFiles( sPath, aFileNames );
if( aFileNames.size() > 1 ) if( aFileNames.size() > 1 )
throw RageException( "There is more than one SM file in '%s'. There should be only one!", sPath.GetString() ); RageException::Throw( "There is more than one SM file in '%s'. There should be only one!", sPath.GetString() );
/* We should have exactly one; if we had none, we shouldn't have been /* We should have exactly one; if we had none, we shouldn't have been
* called to begin with. */ * called to begin with. */
+1 -1
View File
@@ -222,7 +222,7 @@ bool NotesWriterDWI::Write( CString sPath, const Song &out )
{ {
FILE* fp = fopen( sPath, "w" ); FILE* fp = fopen( sPath, "w" );
if( fp == NULL ) if( fp == NULL )
throw RageException( "Error opening song file '%s' for writing.", sPath.GetString() ); RageException::Throw( "Error opening song file '%s' for writing.", sPath.GetString() );
if(out.GetFullTitle().GetLength() != 0) if(out.GetFullTitle().GetLength() != 0)
fprintf( fp, "#TITLE:%s;\n", out.GetFullTitle().GetString() ); fprintf( fp, "#TITLE:%s;\n", out.GetFullTitle().GetString() );
+1 -1
View File
@@ -95,7 +95,7 @@ bool NotesWriterSM::Write(CString sPath, const Song &out, bool bSavingCache)
FILE* fp = fopen( sPath, "w" ); FILE* fp = fopen( sPath, "w" );
if( fp == NULL ) if( fp == NULL )
throw RageException( "Error opening song file '%s' for writing.", sPath.GetString() ); RageException::Throw( "Error opening song file '%s' for writing.", sPath.GetString() );
WriteGlobalTags(fp, out); WriteGlobalTags(fp, out);
if(bSavingCache) { if(bSavingCache) {