Cleanup RageException::Throw(). Do not use ssprintf() inside of Throw() and do not pass it bare error messages. Use RageException::Throw( "%s", sError.c_str() ); instead. Be consistent with quoting file names "%s" and theme metrics as "%s : %s". Try to make them complete English sentences when possible.

This commit is contained in:
Steve Checkoway
2006-09-17 01:19:19 +00:00
parent c9fa49b7ba
commit 6ea2a41b00
38 changed files with 113 additions and 123 deletions
+2 -2
View File
@@ -202,7 +202,7 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode )
/* If parameters are specified here, save their values to the actor. */ /* If parameters are specified here, save their values to the actor. */
RString sName; RString sName;
if( !pChild->GetAttrValue( "Name", sName ) ) if( !pChild->GetAttrValue( "Name", sName ) )
RageException::Throw( ssprintf("Input node in '%s' is missing the attribute 'Name'", sDir.c_str()) ); RageException::Throw( "Input node in \"%s\" is missing the attribute \"Name\".", sDir.c_str() );
bool bOptional = false; bool bOptional = false;
pChild->GetAttrValue( "Optional", bOptional ); pChild->GetAttrValue( "Optional", bOptional );
@@ -213,7 +213,7 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode )
ActorUtil::GetParam( L, sName ); ActorUtil::GetParam( L, sName );
if( lua_isnil(L, -1) && !bOptional ) if( lua_isnil(L, -1) && !bOptional )
RageException::Throw( "Actor in \"%s\" requires parameter \"%s\" that is not set", sDir.c_str(), sName.c_str() ); RageException::Throw( "Actor in \"%s\" requires parameter \"%s\" that is not set.", sDir.c_str(), sName.c_str() );
lua_settable( L, -3 ); lua_settable( L, -3 );
lua_pop( L, 1 ); lua_pop( L, 1 );
+3 -3
View File
@@ -65,7 +65,7 @@ retry:
switch( Dialog::AbortRetryIgnore( sError, "BROKEN_FILE_REFERENCE" ) ) switch( Dialog::AbortRetryIgnore( sError, "BROKEN_FILE_REFERENCE" ) )
{ {
case Dialog::abort: case Dialog::abort:
RageException::Throw( sError ); RageException::Throw( "%s", sError.c_str() );
break; break;
case Dialog::retry: case Dialog::retry:
// XXX: Do we need to flush everything? // XXX: Do we need to flush everything?
@@ -90,7 +90,7 @@ retry:
switch( Dialog::AbortRetryIgnore( sError, "BROKEN_FILE_REFERENCE" ) ) switch( Dialog::AbortRetryIgnore( sError, "BROKEN_FILE_REFERENCE" ) )
{ {
case Dialog::abort: case Dialog::abort:
RageException::Throw( sError ); RageException::Throw( "%s", sError.c_str() );
break; break;
case Dialog::retry: case Dialog::retry:
// XXX: Do we need to flush everything? // XXX: Do we need to flush everything?
@@ -389,7 +389,7 @@ Actor* ActorUtil::MakeActor( const RString &sPath_, const XNode *pParent, Actor
return ActorUtil::Create( "Model", sDir, &xml, pParentActor ); return ActorUtil::Create( "Model", sDir, &xml, pParentActor );
} }
default: default:
RageException::Throw("File \"%s\" has unknown type, \"%s\"", RageException::Throw("File \"%s\" has unknown type, \"%s\".",
sPath.c_str(), FileTypeToString(ft).c_str() ); sPath.c_str(), FileTypeToString(ft).c_str() );
} }
} }
+2 -2
View File
@@ -108,11 +108,11 @@ void BitmapText::LoadFromNode( const RString& sDir, const XNode* pNode )
RString sFont; RString sFont;
pNode->GetAttrValue( "Font", sFont ); pNode->GetAttrValue( "Font", sFont );
if( sFont.empty() ) if( sFont.empty() )
pNode->GetAttrValue("File", sFont ); // accept "File" for backward compatibility pNode->GetAttrValue( "File", sFont ); // accept "File" for backward compatibility
LuaHelpers::RunAtExpressionS( sFont ); LuaHelpers::RunAtExpressionS( sFont );
if( sFont == "" ) if( sFont == "" )
RageException::Throw( "An object '%s' in '%s' is missing the Font attribute", RageException::Throw( "An object \"%s\" in \"%s\" is missing the Font attribute.",
pNode->m_sName.c_str(), sDir.c_str() ); pNode->m_sName.c_str(), sDir.c_str() );
LoadFromFont( THEME->GetPathF( "", sFont ) ); LoadFromFont( THEME->GetPathF( "", sFont ) );
+4 -4
View File
@@ -25,17 +25,17 @@ void ComboGraph::LoadFromNode( const RString& sDir, const XNode* pNode )
m_pMaxComboText = (BitmapText *) this->GetChild( "MaxComboText" ); m_pMaxComboText = (BitmapText *) this->GetChild( "MaxComboText" );
if( m_pMaxComboText == NULL ) if( m_pMaxComboText == NULL )
RageException::Throw( ssprintf("ComboGraph in \"%s\" must have a child named \"MaxComboText\"", sDir.c_str()) ); RageException::Throw( "ComboGraph in \"%s\" must have a child named \"MaxComboText\".", sDir.c_str() );
if( !m_pMaxComboText->IsType("BitmapText") ) if( !m_pMaxComboText->IsType("BitmapText") )
RageException::Throw( ssprintf("ComboGraph in \"%s\" has a child named \"MaxComboText\" that is not a BitmapText", sDir.c_str()) ); RageException::Throw( "ComboGraph in \"%s\" has a child named \"MaxComboText\" that is not a BitmapText.", sDir.c_str() );
m_pNormalCombo = this->GetChild( "NormalCombo" ); m_pNormalCombo = this->GetChild( "NormalCombo" );
if( m_pNormalCombo == NULL ) if( m_pNormalCombo == NULL )
RageException::Throw( ssprintf("ComboGraph in \"%s\" must have a child named \"NormalCombo\"", sDir.c_str()) ); RageException::Throw( "ComboGraph in \"%s\" must have a child named \"NormalCombo\".", sDir.c_str() );
m_pMaxCombo = this->GetChild( "MaxCombo" ); m_pMaxCombo = this->GetChild( "MaxCombo" );
if( m_pMaxCombo == NULL ) if( m_pMaxCombo == NULL )
RageException::Throw( ssprintf("ComboGraph in \"%s\" must have a child named \"MaxCombo\"", sDir.c_str()) ); RageException::Throw( "ComboGraph in \"%s\" must have a child named \"MaxCombo\".", sDir.c_str() );
} }
void ComboGraph::Load( const StageStats &s, const PlayerStageStats &pss ) void ComboGraph::Load( const StageStats &s, const PlayerStageStats &pss )
+2 -2
View File
@@ -47,7 +47,7 @@ void ThemeMetricDifficultiesToShow::Read()
{ {
Difficulty d = StringToDifficulty( *i ); Difficulty d = StringToDifficulty( *i );
if( d == DIFFICULTY_INVALID ) if( d == DIFFICULTY_INVALID )
RageException::Throw( "Unknown difficulty \"%s\" in CourseDifficultiesToShow", i->c_str() ); RageException::Throw( "Unknown difficulty \"%s\" in CourseDifficultiesToShow.", i->c_str() );
m_v.push_back( d ); m_v.push_back( d );
} }
} }
@@ -77,7 +77,7 @@ void ThemeMetricCourseDifficultiesToShow::Read()
{ {
CourseDifficulty d = StringToCourseDifficulty( *i ); CourseDifficulty d = StringToCourseDifficulty( *i );
if( d == DIFFICULTY_INVALID ) if( d == DIFFICULTY_INVALID )
RageException::Throw( "Unknown CourseDifficulty \"%s\" in CourseDifficultiesToShow", i->c_str() ); RageException::Throw( "Unknown CourseDifficulty \"%s\" in CourseDifficultiesToShow.", i->c_str() );
m_v.push_back( d ); m_v.push_back( d );
} }
} }
+1 -1
View File
@@ -45,7 +45,7 @@ void DifficultyIcon::LoadFromNode( const RString& sDir, const XNode* pNode )
{ {
RString sFile; RString sFile;
if( !pNode->GetAttrValue( "File", sFile ) ) if( !pNode->GetAttrValue( "File", sFile ) )
RageException::Throw( "MeterDisplay in " + sDir + " missing File attribute" ); RageException::Throw( "MeterDisplay in \"%s\" missing \"File\" attribute.", sDir.c_str() );
LuaHelpers::RunAtExpressionS( sFile ); LuaHelpers::RunAtExpressionS( sFile );
if( !sFile.empty() && sFile[0] != '/' ) if( !sFile.empty() && sFile[0] != '/' )
+2 -2
View File
@@ -44,7 +44,7 @@ void DifficultyList::LoadFromNode( const RString& sDir, const XNode* pNode )
{ {
const XNode *pChild = pNode->GetChild( ssprintf("CursorP%i",pn+1) ); const XNode *pChild = pNode->GetChild( ssprintf("CursorP%i",pn+1) );
if( pChild == NULL ) if( pChild == NULL )
RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"%s\"", sDir.c_str(), ssprintf("CursorP%i",pn+1).c_str()) ); RageException::Throw( "ComboGraph in \"%s\" is missing the node \"CursorP%d\".", sDir.c_str(), pn+1 );
m_Cursors[pn].LoadFromNode( sDir, pChild ); m_Cursors[pn].LoadFromNode( sDir, pChild );
/* Hack: we need to tween cursors both up to down (cursor motion) and visible to /* Hack: we need to tween cursors both up to down (cursor motion) and visible to
@@ -55,7 +55,7 @@ void DifficultyList::LoadFromNode( const RString& sDir, const XNode* pNode )
* colors; I think we do need a diffuse color stack ... */ * colors; I think we do need a diffuse color stack ... */
pChild = pNode->GetChild( ssprintf("CursorP%iFrame",pn+1) ); pChild = pNode->GetChild( ssprintf("CursorP%iFrame",pn+1) );
if( pChild == NULL ) if( pChild == NULL )
RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"%s\"", sDir.c_str(), ssprintf("CursorP%iFrame",pn+1).c_str()) ); RageException::Throw( "ComboGraph in \"%s\" is missing the node \"CursorP%dFrame\".", sDir.c_str(), pn+1 );
m_CursorFrames[pn].LoadFromNode( sDir, pChild ); m_CursorFrames[pn].LoadFromNode( sDir, pChild );
m_CursorFrames[pn].AddChild( m_Cursors[pn] ); m_CursorFrames[pn].AddChild( m_Cursors[pn] );
this->AddChild( &m_CursorFrames[pn] ); this->AddChild( &m_CursorFrames[pn] );
+1 -1
View File
@@ -19,7 +19,7 @@ void DynamicActorScroller::LoadFromNode( const RString &sDir, const XNode *pNode
* Make one extra copy if masking is enabled. * Make one extra copy if masking is enabled.
*/ */
if( m_SubActors.size() != 1 ) if( m_SubActors.size() != 1 )
RageException::Throw( "DynamicActorScroller in \"%s\" loaded %i nodes; require exactly one", sDir.c_str(), m_SubActors.size() ); RageException::Throw( "DynamicActorScroller in \"%s\" loaded %i nodes; require exactly one.", sDir.c_str(), (int)m_SubActors.size() );
int iNumCopies = (int) m_fNumItemsToDraw; int iNumCopies = (int) m_fNumItemsToDraw;
if( !m_quadMask.GetHidden() ) if( !m_quadMask.GetHidden() )
+2 -2
View File
@@ -14,7 +14,7 @@ void ExportStrings::Nsis()
{ {
RageFile out; RageFile out;
if( !out.Open( "nsis_strings_temp.inc", RageFile::WRITE ) ) if( !out.Open( "nsis_strings_temp.inc", RageFile::WRITE ) )
RageException::Throw("Error opening file for write."); RageException::Throw( "Error opening file for write." );
vector<RString> vs; vector<RString> vs;
GetDirListing( INSTALLER_LANGUAGES_DIR + "*.ini", vs, false, false ); GetDirListing( INSTALLER_LANGUAGES_DIR + "*.ini", vs, false, false );
@@ -29,7 +29,7 @@ void ExportStrings::Nsis()
IniFile ini; IniFile ini;
if( !ini.ReadFile( INSTALLER_LANGUAGES_DIR + *s ) ) if( !ini.ReadFile( INSTALLER_LANGUAGES_DIR + *s ) )
RageException::Throw("Error opening file for read."); RageException::Throw( "Error opening file for read." );
FOREACH_CONST_Child( &ini, child ) FOREACH_CONST_Child( &ini, child )
{ {
FOREACH_CONST_Attr( child, attr ) FOREACH_CONST_Attr( child, attr )
+11 -12
View File
@@ -286,7 +286,7 @@ const glyph &Font::GetGlyph( wchar_t c ) const
it = m_iCharToGlyph.find(FONT_DEFAULT_GLYPH); it = m_iCharToGlyph.find(FONT_DEFAULT_GLYPH);
if(it == m_iCharToGlyph.end()) if(it == m_iCharToGlyph.end())
RageException::Throw( "The default glyph is missing from the font '%s'", path.c_str() ); RageException::Throw( "The default glyph is missing from the font \"%s\".", path.c_str() );
return *it->second; return *it->second;
} }
@@ -295,7 +295,7 @@ bool Font::FontCompleteForString( const wstring &str ) const
{ {
map<wchar_t,glyph*>::const_iterator m_pDefault = m_iCharToGlyph.find( FONT_DEFAULT_GLYPH ); map<wchar_t,glyph*>::const_iterator m_pDefault = m_iCharToGlyph.find( FONT_DEFAULT_GLYPH );
if( m_pDefault == m_iCharToGlyph.end() ) if( m_pDefault == m_iCharToGlyph.end() )
RageException::Throw( "The default glyph is missing from the font '%s'", path.c_str() ); RageException::Throw( "The default glyph is missing from the font \"%s\".", path.c_str() );
for( unsigned i = 0; i < str.size(); ++i ) for( unsigned i = 0; i < str.size(); ++i )
{ {
@@ -491,7 +491,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
ASSERT( asMatches.size() == 4 ); /* 4 parens */ ASSERT( asMatches.size() == 4 ); /* 4 parens */
if( !bMatch || asMatches[0].empty() ) if( !bMatch || asMatches[0].empty() )
RageException::Throw("Font definition '%s' has an invalid range '%s': parse error", RageException::Throw( "Font definition \"%s\" has an invalid range \"%s\": parse error.",
ini.GetPath().c_str(), sName.c_str() ); ini.GetPath().c_str(), sName.c_str() );
/* We must have either 1 match (just the codeset) or 4 (the whole thing). */ /* We must have either 1 match (just the codeset) or 4 (the whole thing). */
@@ -504,15 +504,15 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
int iLast; int iLast;
sscanf( asMatches[3].c_str(), "%x", &iLast ); sscanf( asMatches[3].c_str(), "%x", &iLast );
if( iLast < iFirst ) if( iLast < iFirst )
RageException::Throw("Font definition '%s' has an invalid range '%s': %i < %i.", RageException::Throw( "Font definition \"%s\" has an invalid range \"%s\": %i < %i.",
ini.GetPath().c_str(), sName.c_str(), iLast < iFirst ); ini.GetPath().c_str(), sName.c_str(), iLast, iFirst );
iCount = iLast - iFirst + 1; iCount = iLast - iFirst + 1;
} }
RString sRet = cfg.MapRange( asMatches[0], iFirst, atoi(sValue), iCount ); RString sRet = cfg.MapRange( asMatches[0], iFirst, atoi(sValue), iCount );
if( !sRet.empty() ) if( !sRet.empty() )
RageException::Throw( "Font definition '%s' has an invalid range '%s': %s.", RageException::Throw( "Font definition \"%s\" has an invalid range \"%s\": %s.",
ini.GetPath().c_str(), sName.c_str(), sRet.c_str() ); ini.GetPath().c_str(), sName.c_str(), sRet.c_str() );
continue; continue;
@@ -532,15 +532,15 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
const int iFirstFrame = iRow * iNumFramesWide; const int iFirstFrame = iRow * iNumFramesWide;
if( iRow > iNumFramesHigh ) if( iRow > iNumFramesHigh )
RageException::Throw( "The font definition \"%s\" tries to assign line %i, but the font is only %i characters high", RageException::Throw( "The font definition \"%s\" tries to assign line %i, but the font is only %i characters high.",
ini.GetPath().c_str(), iFirstFrame, iNumFramesHigh ); ini.GetPath().c_str(), iFirstFrame, iNumFramesHigh );
/* Decode the string. */ /* Decode the string. */
const wstring wdata( RStringToWstring(sValue) ); const wstring wdata( RStringToWstring(sValue) );
if( int(wdata.size()) > iNumFramesWide ) if( int(wdata.size()) > iNumFramesWide )
RageException::Throw( "The font definition \"%s\" assigns %i characters to row %i (\"%ls\"), but the font only has %i characters wide", RageException::Throw( "The font definition \"%s\" assigns %i characters to row %i (\"%ls\"), but the font is only %i characters wide.",
ini.GetPath().c_str(), wdata.size(), iRow, wdata.c_str(), iNumFramesWide ); ini.GetPath().c_str(), (int)wdata.size(), iRow, wdata.c_str(), iNumFramesWide );
for( unsigned i = 0; i < wdata.size(); ++i ) for( unsigned i = 0; i < wdata.size(); ++i )
cfg.CharToGlyphNo[wdata[i]] = iFirstFrame+i; cfg.CharToGlyphNo[wdata[i]] = iFirstFrame+i;
@@ -657,7 +657,7 @@ void Font::Load( const RString &sIniPath, RString sChars )
{ {
RString str = join("\n", LoadStack); RString str = join("\n", LoadStack);
str += "\n" + sIniPath; str += "\n" + sIniPath;
RageException::Throw("Font import recursion detected\n%s", str.c_str()); RageException::Throw( "Font import recursion detected\n%s", str.c_str() );
} }
} }
LoadStack.push_back( sIniPath ); LoadStack.push_back( sIniPath );
@@ -737,9 +737,8 @@ void Font::Load( const RString &sIniPath, RString sChars )
{ {
if( it->second < pPage->m_pTexture->GetNumFrames() ) if( it->second < pPage->m_pTexture->GetNumFrames() )
continue; /* OK */ continue; /* OK */
RString sError = ssprintf( "The font '%s' maps %s to frame %i, but the font only has %i frames.", RageException::Throw( "The font \"%s\" maps \"%s\" to frame %i, but the font only has %i frames.",
sTexturePath.c_str(), WcharDisplayText(wchar_t(it->first)).c_str(), it->second, pPage->m_pTexture->GetNumFrames() ); sTexturePath.c_str(), WcharDisplayText(wchar_t(it->first)).c_str(), it->second, pPage->m_pTexture->GetNumFrames() );
RageException::Throw( sError );
} }
// LOG->Trace( "Adding page %s (%s) to %s; %i glyphs", // LOG->Trace( "Adding page %s (%s) to %s; %i glyphs",
+2 -2
View File
@@ -269,7 +269,7 @@ void GameCommand::LoadOne( const Command& cmd )
Song *pSong = (m_pSong != NULL)? m_pSong:GAMESTATE->m_pCurSong; Song *pSong = (m_pSong != NULL)? m_pSong:GAMESTATE->m_pCurSong;
const Style *pStyle = m_pStyle ? m_pStyle : GAMESTATE->m_pCurStyle; const Style *pStyle = m_pStyle ? m_pStyle : GAMESTATE->m_pCurStyle;
if( pSong == NULL || pStyle == NULL ) if( pSong == NULL || pStyle == NULL )
RageException::Throw( "Must set Song and Style to set Steps" ); RageException::Throw( "Must set Song and Style to set Steps." );
Difficulty dc = StringToDifficulty( sSteps ); Difficulty dc = StringToDifficulty( sSteps );
if( dc != DIFFICULTY_EDIT ) if( dc != DIFFICULTY_EDIT )
@@ -304,7 +304,7 @@ void GameCommand::LoadOne( const Command& cmd )
Course *pCourse = (m_pCourse != NULL)? m_pCourse:GAMESTATE->m_pCurCourse; Course *pCourse = (m_pCourse != NULL)? m_pCourse:GAMESTATE->m_pCurCourse;
const Style *pStyle = m_pStyle ? m_pStyle : GAMESTATE->m_pCurStyle; const Style *pStyle = m_pStyle ? m_pStyle : GAMESTATE->m_pCurStyle;
if( pCourse == NULL || pStyle == NULL ) if( pCourse == NULL || pStyle == NULL )
RageException::Throw( "Must set Course and Style to set Steps" ); RageException::Throw( "Must set Course and Style to set Steps." );
const CourseDifficulty cd = StringToCourseDifficulty( sTrail ); const CourseDifficulty cd = StringToCourseDifficulty( sTrail );
ASSERT_M( cd != DIFFICULTY_INVALID, ssprintf("Invalid difficulty '%s'", sTrail.c_str()) ); ASSERT_M( cd != DIFFICULTY_INVALID, ssprintf("Invalid difficulty '%s'", sTrail.c_str()) );
+1 -1
View File
@@ -153,7 +153,7 @@ void GameState::ApplyCmdline()
{ {
int pn = atoi( sPlayer )-1; int pn = atoi( sPlayer )-1;
if( !IsAnInt( sPlayer ) || pn < 0 || pn >= NUM_PLAYERS ) if( !IsAnInt( sPlayer ) || pn < 0 || pn >= NUM_PLAYERS )
RageException::Throw( "Invalid argument \"--player=%s\"", sPlayer.c_str() ); RageException::Throw( "Invalid argument \"--player=%s\".", sPlayer.c_str() );
JoinPlayer( (PlayerNumber) pn ); JoinPlayer( (PlayerNumber) pn );
} }
+5 -5
View File
@@ -157,13 +157,13 @@ void GraphDisplay::LoadFromNode( const RString& sDir, const XNode* pNode )
const XNode *pChild = pNode->GetChild( "Body" ); const XNode *pChild = pNode->GetChild( "Body" );
if( pChild == NULL ) if( pChild == NULL )
RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"Body\"", sDir.c_str()) ); RageException::Throw( "ComboGraph in \"%s\" is missing the node \"Body\".", sDir.c_str() );
m_pGraphBody->LoadFromNode( sDir, pChild ); m_pGraphBody->LoadFromNode( sDir, pChild );
this->AddChild( m_pGraphBody ); this->AddChild( m_pGraphBody );
pChild = pNode->GetChild( "Texture" ); pChild = pNode->GetChild( "Texture" );
if( pChild == NULL ) if( pChild == NULL )
RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"Texture\"", sDir.c_str()) ); RageException::Throw( "ComboGraph in \"%s\" is missing the node \"Texture\".", sDir.c_str() );
m_sprTexture.LoadFromNode( sDir, pChild ); m_sprTexture.LoadFromNode( sDir, pChild );
m_size.x = m_sprTexture->GetUnzoomedWidth(); m_size.x = m_sprTexture->GetUnzoomedWidth();
m_size.y = m_sprTexture->GetUnzoomedHeight(); m_size.y = m_sprTexture->GetUnzoomedHeight();
@@ -171,18 +171,18 @@ void GraphDisplay::LoadFromNode( const RString& sDir, const XNode* pNode )
pChild = pNode->GetChild( "Line" ); pChild = pNode->GetChild( "Line" );
if( pChild == NULL ) if( pChild == NULL )
RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"Line\"", sDir.c_str()) ); RageException::Throw( "ComboGraph in \"%s\" is missing the node \"Line\".", sDir.c_str() );
m_pGraphLine->LoadFromNode( sDir, pChild ); m_pGraphLine->LoadFromNode( sDir, pChild );
this->AddChild( m_pGraphLine ); this->AddChild( m_pGraphLine );
pChild = pNode->GetChild( "SongBoundary" ); pChild = pNode->GetChild( "SongBoundary" );
if( pChild == NULL ) if( pChild == NULL )
RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"SongBoundary\"", sDir.c_str()) ); RageException::Throw( "ComboGraph in \"%s\" is missing the node \"SongBoundary\".", sDir.c_str() );
m_sprSongBoundary.LoadFromNode( sDir, pChild ); m_sprSongBoundary.LoadFromNode( sDir, pChild );
pChild = pNode->GetChild( "Barely" ); pChild = pNode->GetChild( "Barely" );
if( pChild == NULL ) if( pChild == NULL )
RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"Barely\"", sDir.c_str()) ); RageException::Throw( "ComboGraph in \"%s\" is missing the node \"Barely\".", sDir.c_str() );
m_sprJustBarely.LoadFromNode( sDir, pChild ); m_sprJustBarely.LoadFromNode( sDir, pChild );
} }
+1 -1
View File
@@ -29,7 +29,7 @@ void HoldJudgment::LoadFromNode( const RString& sDir, const XNode* pNode )
{ {
RString sFile; RString sFile;
if( !pNode->GetAttrValue("File", sFile) ) if( !pNode->GetAttrValue("File", sFile) )
RageException::Throw( ssprintf("HoldJudgment node in '%s' is missing the attribute \"File\"", sDir.c_str()) ); RageException::Throw( "HoldJudgment node in \"%s\" is missing the attribute \"File\"", sDir.c_str() );
LuaHelpers::RunAtExpressionS( sFile ); LuaHelpers::RunAtExpressionS( sFile );
if( sFile.Left(1) != "/" ) if( sFile.Left(1) != "/" )
+3 -3
View File
@@ -578,7 +578,7 @@ bool LuaHelpers::RunExpressionB( const RString &str )
/* Don't accept a function as a return value. */ /* Don't accept a function as a return value. */
if( lua_isfunction( L, -1 ) ) if( lua_isfunction( L, -1 ) )
RageException::Throw( "result is a function; did you forget \"()\"?" ); RageException::Throw( "Result is a function; did you forget \"()\"?" );
bool result = !!lua_toboolean( L, -1 ); bool result = !!lua_toboolean( L, -1 );
lua_pop( L, 1 ); lua_pop( L, 1 );
@@ -598,7 +598,7 @@ float LuaHelpers::RunExpressionF( const RString &str )
/* Don't accept a function as a return value. */ /* Don't accept a function as a return value. */
if( lua_isfunction( L, -1 ) ) if( lua_isfunction( L, -1 ) )
RageException::Throw( "result is a function; did you forget \"()\"?" ); RageException::Throw( "Result is a function; did you forget \"()\"?" );
float result = (float) lua_tonumber( L, -1 ); float result = (float) lua_tonumber( L, -1 );
lua_pop( L, 1 ); lua_pop( L, 1 );
@@ -623,7 +623,7 @@ bool LuaHelpers::RunExpressionS( const RString &str, RString &sOut )
/* Don't accept a function as a return value. */ /* Don't accept a function as a return value. */
if( lua_isfunction( L, -1 ) ) if( lua_isfunction( L, -1 ) )
RageException::Throw( "result is a function; did you forget \"()\"?" ); RageException::Throw( "Result is a function; did you forget \"()\"?" );
sOut = lua_tostring( L, -1 ); sOut = lua_tostring( L, -1 );
lua_pop( L, 1 ); lua_pop( L, 1 );
+2 -2
View File
@@ -35,13 +35,13 @@ void MeterDisplay::LoadFromNode( const RString& sDir, const XNode* pNode )
RString sExpr; RString sExpr;
if( !pNode->GetAttrValue( "StreamWidth", sExpr ) ) if( !pNode->GetAttrValue( "StreamWidth", sExpr ) )
RageException::Throw( "MeterDisplay in " + sDir + " missing StreamWidth attribute" ); RageException::Throw( "MeterDisplay in \"%s\" is missing the \"StreamWidth\" attribute.", sDir.c_str() );
m_fStreamWidth = LuaHelpers::RunExpressionF( sExpr ); m_fStreamWidth = LuaHelpers::RunExpressionF( sExpr );
{ {
RString sStreamPath; RString sStreamPath;
if( !pNode->GetAttrValue( "StreamPath", sStreamPath ) ) if( !pNode->GetAttrValue( "StreamPath", sStreamPath ) )
RageException::Throw( "MeterDisplay in " + sDir + " missing StreamPath attribute" ); RageException::Throw( "MeterDisplay in \"%s\" is missing the \"StreamPath\" attribute.", sDir.c_str() );
LuaHelpers::RunAtExpressionS( sStreamPath ); LuaHelpers::RunAtExpressionS( sStreamPath );
if( !sStreamPath.empty() && sStreamPath[0] != '/' ) if( !sStreamPath.empty() && sStreamPath[0] != '/' )
+5 -11
View File
@@ -63,7 +63,7 @@ void Model::Load( const RString &sFile )
LoadMilkshapeAscii( sFile ); LoadMilkshapeAscii( sFile );
} }
#define THROW RageException::Throw( "Parse error in \"%s\" at line %d: '%s'", sPath.c_str(), iLineNum, sLine.c_str() ) #define THROW RageException::Throw( "Parse error in \"%s\" at line %d: \"%s\".", sPath.c_str(), iLineNum, sLine.c_str() )
void Model::LoadMilkshapeAscii( const RString &sPath ) void Model::LoadMilkshapeAscii( const RString &sPath )
{ {
@@ -87,8 +87,8 @@ void Model::LoadPieces( const RString &sMeshesPath, const RString &sMaterialsPat
const msMesh *pMesh = &m_pGeometry->m_Meshes[i]; const msMesh *pMesh = &m_pGeometry->m_Meshes[i];
if( pMesh->nMaterialIndex >= (int) m_Materials.size() ) if( pMesh->nMaterialIndex >= (int) m_Materials.size() )
RageException::Throw( "Model \"%s\" mesh \"%s\" references material index %i, but there are only %i materials", RageException::Throw( "Model \"%s\" mesh \"%s\" references material index %i, but there are only %i materials.",
sMeshesPath.c_str(), pMesh->sName.c_str(), pMesh->nMaterialIndex, m_Materials.size() ); sMeshesPath.c_str(), pMesh->sName.c_str(), pMesh->nMaterialIndex, (int)m_Materials.size() );
} }
if( LoadMilkshapeAsciiBones( DEFAULT_ANIMATION_NAME, sBonesPath ) ) if( LoadMilkshapeAsciiBones( DEFAULT_ANIMATION_NAME, sBonesPath ) )
@@ -254,10 +254,7 @@ void Model::LoadMaterialsFromMilkshapeAscii( const RString &_sPath )
FixSlashesInPlace( sTexturePath ); FixSlashesInPlace( sTexturePath );
CollapsePath( sTexturePath ); CollapsePath( sTexturePath );
if( !IsAFile(sTexturePath) ) if( !IsAFile(sTexturePath) )
{ RageException::Throw( "\"%s\" references a texture \"%s\" that does not exist.", sPath.c_str(), sTexturePath.c_str() );
RString sError = ssprintf( "'%s' references a texture '%s' that does not exist", sPath.c_str(), sTexturePath.c_str() );
RageException::Throw( sError );
}
Material.diffuse.Load( sTexturePath ); Material.diffuse.Load( sTexturePath );
} }
@@ -279,10 +276,7 @@ void Model::LoadMaterialsFromMilkshapeAscii( const RString &_sPath )
FixSlashesInPlace( sTexturePath ); FixSlashesInPlace( sTexturePath );
CollapsePath( sTexturePath ); CollapsePath( sTexturePath );
if( !IsAFile(sTexturePath) ) if( !IsAFile(sTexturePath) )
{ RageException::Throw( "\"%s\" references a texture \"%s\" that does not exist.", sPath.c_str(), sTexturePath.c_str() );
RString sError = ssprintf( "'%s' references a texture '%s' that does not exist", sPath.c_str(), sTexturePath.c_str() );
RageException::Throw( sError );
}
Material.alpha.Load( sTexturePath ); Material.alpha.Load( sTexturePath );
} }
+3 -3
View File
@@ -51,11 +51,11 @@ void AnimatedTexture::Load( const RString &sTexOrIniPath )
{ {
IniFile ini; IniFile ini;
if( !ini.ReadFile( sTexOrIniPath ) ) if( !ini.ReadFile( sTexOrIniPath ) )
RageException::Throw( "Error reading %s: %s", sTexOrIniPath.c_str(), ini.GetError().c_str() ); RageException::Throw( "Error reading \"%s\": %s", sTexOrIniPath.c_str(), ini.GetError().c_str() );
const XNode* pAnimatedTexture = ini.GetChild("AnimatedTexture"); const XNode* pAnimatedTexture = ini.GetChild("AnimatedTexture");
if( pAnimatedTexture == NULL ) if( pAnimatedTexture == NULL )
RageException::Throw( "The animated texture file '%s' doesn't contain a section called 'AnimatedTexture'.", sTexOrIniPath.c_str() ); RageException::Throw( "The animated texture file \"%s\" doesn't contain a section called \"AnimatedTexture\".", sTexOrIniPath.c_str() );
pAnimatedTexture->GetAttrValue( "TexVelocityX", m_vTexVelocity.x ); pAnimatedTexture->GetAttrValue( "TexVelocityX", m_vTexVelocity.x );
pAnimatedTexture->GetAttrValue( "TexVelocityY", m_vTexVelocity.y ); pAnimatedTexture->GetAttrValue( "TexVelocityY", m_vTexVelocity.y );
@@ -214,7 +214,7 @@ RageVector2 AnimatedTexture::GetTextureTranslate()
return v; return v;
} }
#define THROW RageException::Throw( "Parse error in \"%s\" at line %d: '%s'", sPath.c_str(), iLineNum, sLine.c_str() ) #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( RString sAniName, RString sPath )
{ {
+5 -9
View File
@@ -172,12 +172,8 @@ RString NoteSkinManager::GetMetric( const RString &sButtonName, const RString &s
if( data.metrics.GetValue( sButtonName, sValue, sReturn ) ) if( data.metrics.GetValue( sButtonName, sValue, sReturn ) )
return sReturn; return sReturn;
if( !data.metrics.GetValue( "NoteDisplay", sValue, sReturn ) ) if( !data.metrics.GetValue( "NoteDisplay", sValue, sReturn ) )
{ RageException::Throw( "Could not read metric \"%s : %s\" or \"NoteDisplay : %s\" in \"%s\".",
RString sError = ssprintf(
"Could not read metric '[%s] %s' or '[NoteDisplay] %s' in '%s'",
sButtonName.c_str(), sValue.c_str(), sValue.c_str(), sNoteSkinName.c_str() ); sButtonName.c_str(), sValue.c_str(), sValue.c_str(), sNoteSkinName.c_str() );
RageException::Throw( sError );
}
return sReturn; return sReturn;
} }
@@ -229,7 +225,7 @@ try_again:
if( sPath.empty() ) if( sPath.empty() )
{ {
RString message = ssprintf( RString message = ssprintf(
"The NoteSkin element '%s %s' could not be found in '%s', '%s', or '%s'.", "The NoteSkin element \"%s %s\" could not be found in \"%s\", \"%s\", or \"%s\".",
sButtonName.c_str(), sElement.c_str(), sButtonName.c_str(), sElement.c_str(),
GetNoteSkinDir(m_sCurrentNoteSkin).c_str(), GetNoteSkinDir(m_sCurrentNoteSkin).c_str(),
GetNoteSkinDir(GAME_BASE_NOTESKIN_NAME).c_str(), GetNoteSkinDir(GAME_BASE_NOTESKIN_NAME).c_str(),
@@ -243,7 +239,7 @@ try_again:
goto try_again; goto try_again;
} }
RageException::Throw( message ); RageException::Throw( "%s", message.c_str() );
} }
int iLevel = 0; int iLevel = 0;
@@ -266,7 +262,7 @@ try_again:
if( sRealPath == "" ) if( sRealPath == "" )
{ {
RString message = ssprintf( RString message = ssprintf(
"NoteSkinManager: The redirect '%s' points to the file '%s', which does not exist. " "NoteSkinManager: The redirect \"%s\" points to the file \"%s\", which does not exist. "
"Verify that this redirect is correct.", "Verify that this redirect is correct.",
sPath.c_str(), sNewFileName.c_str()); sPath.c_str(), sNewFileName.c_str());
@@ -278,7 +274,7 @@ try_again:
goto try_again; goto try_again;
} }
RageException::Throw( message ); RageException::Throw( "%s", message.c_str() );
} }
sPath = sRealPath; sPath = sRealPath;
+17 -17
View File
@@ -147,7 +147,7 @@ public:
/* Parse the basic configuration metric. */ /* Parse the basic configuration metric. */
Commands cmds = ParseCommands( ENTRY(sParam) ); Commands cmds = ParseCommands( ENTRY(sParam) );
if( cmds.v.size() < 1 ) if( cmds.v.size() < 1 )
RageException::Throw( "Parse error in ScreenOptionsMaster::%s", sParam.c_str() ); RageException::Throw( "Parse error in ScreenOptionsMaster::%s.", sParam.c_str() );
m_Def.m_bOneChoiceForAllPlayers = false; m_Def.m_bOneChoiceForAllPlayers = false;
const int NumCols = atoi( cmds.v[0].m_vsArgs[0] ); const int NumCols = atoi( cmds.v[0].m_vsArgs[0] );
@@ -183,7 +183,7 @@ public:
for( unsigned i=1; i<cmd.m_vsArgs.size(); i++ ) for( unsigned i=1; i<cmd.m_vsArgs.size(); i++ )
m_vsBroadcastOnExport.push_back( cmd.m_vsArgs[i] ); m_vsBroadcastOnExport.push_back( cmd.m_vsArgs[i] );
} }
else RageException::Throw( "Unkown row flag \"%s\"", sName.c_str() ); else RageException::Throw( "Unkown row flag \"%s\".", sName.c_str() );
} }
for( int col = 0; col < NumCols; ++col ) for( int col = 0; col < NumCols; ++col )
@@ -196,7 +196,7 @@ public:
if( mc.m_sName == "" && NumCols == 1 ) if( mc.m_sName == "" && NumCols == 1 )
mc.m_sName = sParam; mc.m_sName = sParam;
if( mc.m_sName == "" ) if( mc.m_sName == "" )
RageException::Throw( "List \"%s\", col %i has no name", sParam.c_str(), col ); RageException::Throw( "List \"%s\", col %i has no name.", sParam.c_str(), col );
if( !mc.IsPlayable() ) if( !mc.IsPlayable() )
{ {
@@ -465,7 +465,7 @@ public:
} }
else else
{ {
RageException::Throw( "invalid StepsType param \"%s\"", sParam.c_str() ); RageException::Throw( "Invalid StepsType param \"%s\".", sParam.c_str() );
} }
m_Def.m_sName = sParam; m_Def.m_sName = sParam;
@@ -754,7 +754,7 @@ public:
lua_call( L, 1, 1 ); // call function with 1 argument and 1 result lua_call( L, 1, 1 ); // call function with 1 argument and 1 result
if( !lua_istable(L, -1) ) if( !lua_istable(L, -1) )
RageException::Throw( "\"EnabledForPlayers\" did not return a table" ); RageException::Throw( "\"EnabledForPlayers\" did not return a table." );
m_Def.m_vEnabledForPlayers.clear(); // and fill in with supplied PlayerNumbers below m_Def.m_vEnabledForPlayers.clear(); // and fill in with supplied PlayerNumbers below
@@ -789,7 +789,7 @@ public:
m_pLuaTable->SetFromExpression( sLuaFunction ); m_pLuaTable->SetFromExpression( sLuaFunction );
if( m_pLuaTable->GetLuaType() != LUA_TTABLE ) if( m_pLuaTable->GetLuaType() != LUA_TTABLE )
RageException::Throw( "Result of \"%s\" is not a table", sLuaFunction.c_str() ); RageException::Throw( "Result of \"%s\" is not a table.", sLuaFunction.c_str() );
m_pLuaTable->PushSelf( L ); m_pLuaTable->PushSelf( L );
@@ -797,7 +797,7 @@ public:
lua_gettable( L, -2 ); lua_gettable( L, -2 );
const char *pStr = lua_tostring( L, -1 ); const char *pStr = lua_tostring( L, -1 );
if( pStr == NULL ) if( pStr == NULL )
RageException::Throw( "\"%s\" \"Name\" entry is not a string", sLuaFunction.c_str() ); RageException::Throw( "\"%s\" \"Name\" entry is not a string.", sLuaFunction.c_str() );
m_Def.m_sName = pStr; m_Def.m_sName = pStr;
lua_pop( L, 1 ); lua_pop( L, 1 );
@@ -818,7 +818,7 @@ public:
lua_gettable( L, -2 ); lua_gettable( L, -2 );
pStr = lua_tostring( L, -1 ); pStr = lua_tostring( L, -1 );
if( pStr == NULL ) if( pStr == NULL )
RageException::Throw( "\"%s\" \"LayoutType\" entry is not a string", sLuaFunction.c_str() ); RageException::Throw( "\"%s\" \"LayoutType\" entry is not a string.", sLuaFunction.c_str() );
m_Def.m_layoutType = StringToLayoutType( pStr ); m_Def.m_layoutType = StringToLayoutType( pStr );
ASSERT( m_Def.m_layoutType != LAYOUT_INVALID ); ASSERT( m_Def.m_layoutType != LAYOUT_INVALID );
lua_pop( L, 1 ); lua_pop( L, 1 );
@@ -828,7 +828,7 @@ public:
lua_gettable( L, -2 ); lua_gettable( L, -2 );
pStr = lua_tostring( L, -1 ); pStr = lua_tostring( L, -1 );
if( pStr == NULL ) if( pStr == NULL )
RageException::Throw( "\"%s\" \"SelectType\" entry is not a string", sLuaFunction.c_str() ); RageException::Throw( "\"%s\" \"SelectType\" entry is not a string.", sLuaFunction.c_str() );
m_Def.m_selectType = StringToSelectType( pStr ); m_Def.m_selectType = StringToSelectType( pStr );
ASSERT( m_Def.m_selectType != SELECT_INVALID ); ASSERT( m_Def.m_selectType != SELECT_INVALID );
lua_pop( L, 1 ); lua_pop( L, 1 );
@@ -838,7 +838,7 @@ public:
lua_pushstring( L, "Choices" ); lua_pushstring( L, "Choices" );
lua_gettable( L, -2 ); lua_gettable( L, -2 );
if( !lua_istable( L, -1 ) ) if( !lua_istable( L, -1 ) )
RageException::Throw( "\"%s\" \"Choices\" is not a table", sLuaFunction.c_str() ); RageException::Throw( "\"%s\" \"Choices\" is not a table.", sLuaFunction.c_str() );
lua_pushnil( L ); lua_pushnil( L );
while( lua_next(L, -2) != 0 ) while( lua_next(L, -2) != 0 )
@@ -846,7 +846,7 @@ public:
/* `key' is at index -2 and `value' at index -1 */ /* `key' is at index -2 and `value' at index -1 */
const char *pValue = lua_tostring( L, -1 ); const char *pValue = lua_tostring( L, -1 );
if( pValue == NULL ) if( pValue == NULL )
RageException::Throw( "\"%s\" Column entry is not a string", sLuaFunction.c_str() ); RageException::Throw( "\"%s\" Column entry is not a string.", sLuaFunction.c_str() );
// LOG->Trace( "'%s'", pValue); // LOG->Trace( "'%s'", pValue);
m_Def.m_vsChoices.push_back( pValue ); m_Def.m_vsChoices.push_back( pValue );
@@ -861,7 +861,7 @@ public:
lua_pushstring( L, "EnabledForPlayers" ); lua_pushstring( L, "EnabledForPlayers" );
lua_gettable( L, -2 ); lua_gettable( L, -2 );
if( !lua_isfunction( L, -1 ) && !lua_isnil( L, -1 ) ) if( !lua_isfunction( L, -1 ) && !lua_isnil( L, -1 ) )
RageException::Throw( "\"%s\" \"EnabledForPlayers\" is not a table", sLuaFunction.c_str() ); RageException::Throw( "\"%s\" \"EnabledForPlayers\" is not a table.", sLuaFunction.c_str() );
m_EnabledForPlayersFunc.SetFromStack( L ); m_EnabledForPlayersFunc.SetFromStack( L );
SetEnabledForPlayers(); SetEnabledForPlayers();
@@ -871,7 +871,7 @@ public:
if( !lua_isnil( L, -1 ) ) if( !lua_isnil( L, -1 ) )
{ {
if( !lua_istable( L, -1 ) ) if( !lua_istable( L, -1 ) )
RageException::Throw( "\"%s\" \"ReloadRowMessages\" is not a table", sLuaFunction.c_str() ); RageException::Throw( "\"%s\" \"ReloadRowMessages\" is not a table.", sLuaFunction.c_str() );
lua_pushnil( L ); lua_pushnil( L );
while( lua_next(L, -2) != 0 ) while( lua_next(L, -2) != 0 )
@@ -879,7 +879,7 @@ public:
/* `key' is at index -2 and `value' at index -1 */ /* `key' is at index -2 and `value' at index -1 */
const char *pValue = lua_tostring( L, -1 ); const char *pValue = lua_tostring( L, -1 );
if( pValue == NULL ) if( pValue == NULL )
RageException::Throw( "\"%s\" Column entry is not a string", sLuaFunction.c_str() ); RageException::Throw( "\"%s\" Column entry is not a string.", sLuaFunction.c_str() );
LOG->Trace( "Found ReloadRowMessage '%s'", pValue); LOG->Trace( "Found ReloadRowMessage '%s'", pValue);
m_vsReloadRowMessages.push_back( pValue ); m_vsReloadRowMessages.push_back( pValue );
@@ -941,7 +941,7 @@ public:
lua_pushstring( L, "LoadSelections" ); lua_pushstring( L, "LoadSelections" );
lua_gettable( L, -2 ); lua_gettable( L, -2 );
if( !lua_isfunction( L, -1 ) ) if( !lua_isfunction( L, -1 ) )
RageException::Throw( "\"%s\" \"LoadSelections\" entry is not a function", m_Def.m_sName.c_str() ); RageException::Throw( "\"%s\" \"LoadSelections\" entry is not a function.", m_Def.m_sName.c_str() );
/* Argument 1 (self): */ /* Argument 1 (self): */
m_pLuaTable->PushSelf( L ); m_pLuaTable->PushSelf( L );
@@ -995,7 +995,7 @@ public:
lua_pushstring( L, "SaveSelections" ); lua_pushstring( L, "SaveSelections" );
lua_gettable( L, -2 ); lua_gettable( L, -2 );
if( !lua_isfunction( L, -1 ) ) if( !lua_isfunction( L, -1 ) )
RageException::Throw( "\"%s\" \"SaveSelections\" entry is not a function", m_Def.m_sName.c_str() ); RageException::Throw( "\"%s\" \"SaveSelections\" entry is not a function.", m_Def.m_sName.c_str() );
/* Argument 1 (self): */ /* Argument 1 (self): */
m_pLuaTable->PushSelf( L ); m_pLuaTable->PushSelf( L );
@@ -1141,7 +1141,7 @@ public:
} }
else else
{ {
RageException::Throw( "invalid StepsType param \"%s\"", sParam.c_str() ); RageException::Throw( "Invalid StepsType param \"%s\".", sParam.c_str() );
} }
m_Def.m_sName = sParam; m_Def.m_sName = sParam;
+2 -2
View File
@@ -38,7 +38,7 @@ void PercentageDisplay::LoadFromNode( const RString& sDir, const XNode* pNode )
const XNode *pChild = pNode->GetChild( "Percent" ); const XNode *pChild = pNode->GetChild( "Percent" );
if( pChild == NULL ) if( pChild == NULL )
RageException::Throw( ssprintf("PercentageDisplay in \"%s\" is missing the node \"Percent\"", sDir.c_str()) ); RageException::Throw( "PercentageDisplay in \"%s\" is missing the node \"Percent\".", sDir.c_str() );
m_textPercent.LoadFromNode( sDir, pChild ); m_textPercent.LoadFromNode( sDir, pChild );
this->AddChild( &m_textPercent ); this->AddChild( &m_textPercent );
@@ -46,7 +46,7 @@ void PercentageDisplay::LoadFromNode( const RString& sDir, const XNode* pNode )
{ {
const XNode *pChild = pNode->GetChild( "PercentRemainder" ); const XNode *pChild = pNode->GetChild( "PercentRemainder" );
if( pChild == NULL ) if( pChild == NULL )
RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"PercentRemainder\"", sDir.c_str()) ); RageException::Throw( "ComboGraph in \"%s\" is missing the node \"PercentRemainder\".", sDir.c_str() );
m_textPercentRemainder.LoadFromNode( sDir, pChild ); m_textPercentRemainder.LoadFromNode( sDir, pChild );
this->AddChild( &m_textPercentRemainder ); this->AddChild( &m_textPercentRemainder );
} }
+1 -1
View File
@@ -44,7 +44,7 @@ void PlayerAI::InitFromDisk()
RString sKey = ssprintf("Skill%d", i); RString sKey = ssprintf("Skill%d", i);
XNode* pNode = ini.GetChild(sKey); XNode* pNode = ini.GetChild(sKey);
if( pNode == NULL ) if( pNode == NULL )
RageException::Throw( "AI.ini: '%s' doesn't exist.", sKey.c_str() ); RageException::Throw( "AI.ini: \"%s\" doesn't exist.", sKey.c_str() );
TapScoreDistribution& dist = g_Distributions[i]; TapScoreDistribution& dist = g_Distributions[i];
dist.fPercent[TNS_None] = 0; dist.fPercent[TNS_None] = 0;
+3 -3
View File
@@ -35,7 +35,7 @@ RageFileObjInflate::RageFileObjInflate( RageFileBasic *pFile, int iUncompressedS
int err = inflateInit2( m_pInflate, -MAX_WBITS ); int err = inflateInit2( m_pInflate, -MAX_WBITS );
if( err == Z_MEM_ERROR ) if( err == Z_MEM_ERROR )
RageException::Throw( "inflateInit2( %i ): out of memory", -MAX_WBITS ); RageException::Throw( "inflateInit2( %i ): out of memory.", -MAX_WBITS );
if( err != Z_OK ) if( err != Z_OK )
LOG->Trace( "Huh? inflateInit2() err = %i", err ); LOG->Trace( "Huh? inflateInit2() err = %i", err );
@@ -65,7 +65,7 @@ RageFileObjInflate::RageFileObjInflate( const RageFileObjInflate &cpy ):
RageFileBasic *RageFileObjInflate::Copy() const RageFileBasic *RageFileObjInflate::Copy() const
{ {
RageException::Throw( "Loading ZIPs from deflated ZIPs is currently disabled; see RageFileObjInflate" ); RageException::Throw( "Loading ZIPs from deflated ZIPs is currently disabled; see RageFileObjInflate." );
// return new RageFileObjInflate( *this, p ); // return new RageFileObjInflate( *this, p );
} }
@@ -208,7 +208,7 @@ RageFileObjDeflate::RageFileObjDeflate( RageFileBasic *pFile )
Z_DEFAULT_STRATEGY ); Z_DEFAULT_STRATEGY );
if( err == Z_MEM_ERROR ) if( err == Z_MEM_ERROR )
RageException::Throw( "inflateInit2( %i ): out of memory", -MAX_WBITS ); RageException::Throw( "inflateInit2( %i ): out of memory.", -MAX_WBITS );
if( err != Z_OK ) if( err != Z_OK )
LOG->Trace( "Huh? inflateInit2() err = %i", err ); LOG->Trace( "Huh? inflateInit2() err = %i", err );
+1 -1
View File
@@ -88,7 +88,7 @@ bool RageModelGeometry::HasAnyPerVertexBones() const
return false; return false;
} }
#define THROW RageException::Throw( "Parse error in \"%s\" at line %d: '%s'", sPath.c_str(), iLineNum, sLine.c_str() ) #define THROW RageException::Throw( "Parse error in \"%s\" at line %d: \"%s\".", sPath.c_str(), iLineNum, sLine.c_str() )
void RageModelGeometry::LoadMilkshapeAscii( const RString& _sPath, bool bNeedsNormals ) void RageModelGeometry::LoadMilkshapeAscii( const RString& _sPath, bool bNeedsNormals )
{ {
+1 -1
View File
@@ -55,7 +55,7 @@ void RageSoundManager::Init()
m_pDriver = MakeRageSoundDriver( sDrivers ); m_pDriver = MakeRageSoundDriver( sDrivers );
if( m_pDriver == NULL ) if( m_pDriver == NULL )
RageException::Throw( COULDNT_FIND_SOUND_DRIVER.GetValue() ); RageException::Throw( "%s", COULDNT_FIND_SOUND_DRIVER.GetValue().c_str() );
} }
RageSoundManager::~RageSoundManager() RageSoundManager::~RageSoundManager()
+3 -2
View File
@@ -133,7 +133,7 @@ int RageSoundReader_Vorbisfile::GetLength() const
int len = int(ov_time_total(vf, -1) * 1000); int len = int(ov_time_total(vf, -1) * 1000);
#endif #endif
if( len == OV_EINVAL ) if( len == OV_EINVAL )
RageException::Throw("RageSoundReader_Vorbisfile::GetLength: ov_time_total returned OV_EINVAL"); RageException::Throw( "RageSoundReader_Vorbisfile::GetLength: ov_time_total returned OV_EINVAL." );
return len; return len;
} }
@@ -215,7 +215,8 @@ int RageSoundReader_Vorbisfile::Read(char *buf, unsigned len)
ASSERT( vi != NULL ); ASSERT( vi != NULL );
if( (unsigned) vi->channels != channels ) if( (unsigned) vi->channels != channels )
RageException::Throw( "File \"%s\" changes channel count from %i to %i; not supported", channels, vi->channels ); RageException::Throw( "File \"%s\" changes channel count from %i to %i; not supported.",
filename.c_str(), channels, (int)vi->channels );
} }
+6 -6
View File
@@ -1040,14 +1040,14 @@ RString DerefRedir( const RString &_path )
GetDirListing( sPath2, matches, false, true ); GetDirListing( sPath2, matches, false, true );
if( matches.empty() ) if( matches.empty() )
RageException::Throw( "The redirect '%s' references a file '%s' which doesn't exist.", sPath.c_str(), sPath2.c_str() ); RageException::Throw( "The redirect \"%s\" references a file \"%s\" which doesn't exist.", sPath.c_str(), sPath2.c_str() );
else if( matches.size() > 1 ) else if( matches.size() > 1 )
RageException::Throw( "The redirect '%s' references a file '%s' with multiple matches.", sPath.c_str(), sPath2.c_str() ); RageException::Throw( "The redirect \"%s\" references a file \"%s\" with multiple matches.", sPath.c_str(), sPath2.c_str() );
sPath = matches[0]; sPath = matches[0];
} }
RageException::Throw( "Circular redirect '%s'", sPath.c_str() ); RageException::Throw( "Circular redirect \"%s\".", sPath.c_str() );
} }
bool GetFileContents( const RString &sPath, RString &sOut, bool bOneLine ) bool GetFileContents( const RString &sPath, RString &sOut, bool bOneLine )
@@ -1091,7 +1091,7 @@ void Regex::Compile()
m_pReg = pcre_compile( m_sPattern.c_str(), PCRE_CASELESS, &error, &offset, NULL ); m_pReg = pcre_compile( m_sPattern.c_str(), PCRE_CASELESS, &error, &offset, NULL );
if( m_pReg == NULL ) if( m_pReg == NULL )
RageException::Throw( "Invalid regex: \"%s\" (%s)", m_sPattern.c_str(), error ); RageException::Throw( "Invalid regex: \"%s\" (%s).", m_sPattern.c_str(), error );
int iRet = pcre_fullinfo( (pcre *) m_pReg, NULL, PCRE_INFO_CAPTURECOUNT, &m_iBackrefs ); int iRet = pcre_fullinfo( (pcre *) m_pReg, NULL, PCRE_INFO_CAPTURECOUNT, &m_iBackrefs );
ASSERT( iRet >= 0 ); ASSERT( iRet >= 0 );
@@ -1144,7 +1144,7 @@ bool Regex::Compare( const RString &sStr )
int iRet = pcre_exec( (pcre *) m_pReg, NULL, sStr.data(), sStr.size(), 0, 0, iMat, 128*3 ); int iRet = pcre_exec( (pcre *) m_pReg, NULL, sStr.data(), sStr.size(), 0, 0, iMat, 128*3 );
if( iRet < -1 ) if( iRet < -1 )
RageException::Throw( "Unexpected return from pcre_exec('%s'): %i", m_sPattern.c_str(), iRet ); RageException::Throw( "Unexpected return from pcre_exec('%s'): %i.", m_sPattern.c_str(), iRet );
return iRet >= 0; return iRet >= 0;
} }
@@ -1157,7 +1157,7 @@ bool Regex::Compare( const RString &sStr, vector<RString> &asMatches )
int iRet = pcre_exec( (pcre *) m_pReg, NULL, sStr.data(), sStr.size(), 0, 0, iMat, 128*3 ); int iRet = pcre_exec( (pcre *) m_pReg, NULL, sStr.data(), sStr.size(), 0, 0, iMat, 128*3 );
if( iRet < -1 ) if( iRet < -1 )
RageException::Throw( "Unexpected return from pcre_exec('%s'): %i", m_sPattern.c_str(), iRet ); RageException::Throw( "Unexpected return from pcre_exec('%s'): %i.", m_sPattern.c_str(), iRet );
if( iRet == -1 ) if( iRet == -1 )
return false; return false;
+1 -1
View File
@@ -165,7 +165,7 @@ bool ConvertString(RString &str, const RString &encodings)
continue; continue;
} }
RageException::Throw( "Unexpected conversion string \"%s\" (string \"%s\")", RageException::Throw( "Unexpected conversion string \"%s\" (string \"%s\").",
lst[i].c_str(), str.c_str() ); lst[i].c_str(), str.c_str() );
} }
+1 -1
View File
@@ -516,7 +516,7 @@ Screen* ScreenManager::MakeNewScreen( const RString &sScreenName )
map<RString,CreateScreenFn>::iterator iter = g_pmapRegistrees->find( sClassName ); map<RString,CreateScreenFn>::iterator iter = g_pmapRegistrees->find( sClassName );
if( iter == g_pmapRegistrees->end() ) if( iter == g_pmapRegistrees->end() )
RageException::Throw( "Screen '%s' has an invalid class '%s'", sScreenName.c_str(), sClassName.c_str() ); RageException::Throw( "Screen \"%s\" has an invalid class \"%s\".", sScreenName.c_str(), sClassName.c_str() );
this->ZeroNextUpdate(); this->ZeroNextUpdate();
+1 -1
View File
@@ -195,7 +195,7 @@ void ScreenOptionsManageCourses::BeginScreen()
switch( EDIT_MODE.GetValue() ) switch( EDIT_MODE.GetValue() )
{ {
default: default:
RageException::Throw( "ScreenOptionsManageCourses: Invalid edit mode:", RageException::Throw( "ScreenOptionsManageCourses: Invalid edit mode: %s.",
EditModeToString(EDIT_MODE.GetValue()).c_str() ); EditModeToString(EDIT_MODE.GetValue()).c_str() );
case EditMode_Practice: case EditMode_Practice:
case EditMode_Home: case EditMode_Home:
+2 -2
View File
@@ -30,7 +30,7 @@ void ScreenOptionsMaster::Init()
vector<RString> asLineNames; vector<RString> asLineNames;
split( LINE_NAMES, ",", asLineNames ); split( LINE_NAMES, ",", asLineNames );
if( asLineNames.empty() ) if( asLineNames.empty() )
RageException::Throw( "%s::LineNames is empty.", m_sName.c_str() ); RageException::Throw( "\"%s : LineNames\" is empty.", m_sName.c_str() );
if( FORCE_ALL_PLAYERS ) if( FORCE_ALL_PLAYERS )
{ {
@@ -59,7 +59,7 @@ void ScreenOptionsMaster::Init()
OptionRowHandler *pHand = OptionRowHandlerUtil::Make( cmds ); OptionRowHandler *pHand = OptionRowHandlerUtil::Make( cmds );
if( pHand == NULL ) if( pHand == NULL )
RageException::Throw( "Invalid OptionRowHandler '%s' in %s::Line%i", cmds.GetOriginalCommandString().c_str(), m_sName.c_str(), i ); RageException::Throw( "Invalid OptionRowHandler \"%s\" in \"%s : Line%i\".", cmds.GetOriginalCommandString().c_str(), m_sName.c_str(), i );
OptionRowHandlers.push_back( pHand ); OptionRowHandlers.push_back( pHand );
} }
+1 -1
View File
@@ -81,7 +81,7 @@ void ScreenSelect::Init()
} }
if( !m_aGameCommands.size() ) if( !m_aGameCommands.size() )
RageException::Throw( "Screen \"%s\" does not set any choices", m_sName.c_str() ); RageException::Throw( "Screen \"%s\" does not set any choices.", m_sName.c_str() );
} }
void ScreenSelect::BeginScreen() void ScreenSelect::BeginScreen()
+1 -1
View File
@@ -331,7 +331,7 @@ void ScreenSelectDifficulty::ChangePage( Page newPage )
} }
} }
if( iSwitchToIndex == -1 ) if( iSwitchToIndex == -1 )
RageException::Throw( "%s has no selectable choices on page %i", m_sName.c_str(), newPage); RageException::Throw( "\"%s\" has no selectable choices on page %i.", m_sName.c_str(), newPage);
// change both players // change both players
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
+1 -1
View File
@@ -133,7 +133,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'." ); 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( RString sDir ) const
{ {
// Check to see if they put a song directly inside the group folder. // Check to see if they put a song directly inside the group folder.
+1 -1
View File
@@ -139,7 +139,7 @@ void Sprite::LoadFromNode( const RString& sDir, const XNode* pNode )
if( !pNode->GetAttrValue(sFrameKey, newState.iFrameIndex) ) if( !pNode->GetAttrValue(sFrameKey, newState.iFrameIndex) )
break; break;
if( newState.iFrameIndex >= m_pTexture->GetNumFrames() ) if( newState.iFrameIndex >= m_pTexture->GetNumFrames() )
RageException::Throw( "In '%s', %s is %d, but the texture %s only has %d frames.", RageException::Throw( "In \"%s\", %s is %d, but the texture \"%s\" only has %d frames.",
sDir.c_str(), sFrameKey.c_str(), newState.iFrameIndex, sPath.c_str(), m_pTexture->GetNumFrames() ); sDir.c_str(), sFrameKey.c_str(), newState.iFrameIndex, sPath.c_str(), m_pTexture->GetNumFrames() );
if( !pNode->GetAttrValue(sDelayKey, newState.fDelay) ) if( !pNode->GetAttrValue(sDelayKey, newState.fDelay) )
+4 -4
View File
@@ -188,7 +188,7 @@ void StepMania::ApplyGraphicOptions()
GetPreferredVideoModeParams( params ); GetPreferredVideoModeParams( params );
RString sError = DISPLAY->SetVideoMode( params, bNeedReload ); RString sError = DISPLAY->SetVideoMode( params, bNeedReload );
if( sError != "" ) if( sError != "" )
RageException::Throw( sError ); RageException::Throw( "%s", sError.c_str() );
DISPLAY->ChangeCentering( DISPLAY->ChangeCentering(
PREFSMAN->m_iCenterImageTranslateX, PREFSMAN->m_iCenterImageTranslateX,
@@ -704,7 +704,7 @@ RageDisplay *CreateDisplay()
split( PREFSMAN->m_sVideoRenderers, ",", asRenderers, true ); split( PREFSMAN->m_sVideoRenderers, ",", asRenderers, true );
if( asRenderers.empty() ) if( asRenderers.empty() )
RageException::Throw( ERROR_NO_VIDEO_RENDERERS.GetValue() ); RageException::Throw( "%s", ERROR_NO_VIDEO_RENDERERS.GetValue().c_str() );
RageDisplay *pRet = NULL; RageDisplay *pRet = NULL;
for( unsigned i=0; i<asRenderers.size(); i++ ) for( unsigned i=0; i<asRenderers.size(); i++ )
@@ -748,7 +748,7 @@ RageDisplay *CreateDisplay()
} }
if( pRet == NULL) if( pRet == NULL)
RageException::Throw( error ); RageException::Throw( "%s", error.c_str() );
return pRet; return pRet;
} }
@@ -1003,7 +1003,7 @@ int main(int argc, char* argv[])
/* This requires PREFSMAN, for PREFSMAN->m_bShowLoadingWindow. */ /* This requires PREFSMAN, for PREFSMAN->m_bShowLoadingWindow. */
LoadingWindow *loading_window = MakeLoadingWindow(); LoadingWindow *loading_window = MakeLoadingWindow();
if( loading_window == NULL ) if( loading_window == NULL )
RageException::Throw( COULDNT_OPEN_LOADING_WINDOW.GetValue() ); RageException::Throw( "%s", COULDNT_OPEN_LOADING_WINDOW.GetValue().c_str() );
srand( time(NULL) ); // seed number generator srand( time(NULL) ); // seed number generator
@@ -189,7 +189,7 @@ bool MovieTexture_Generic::DecodeFrame()
m_pDecoder->Close(); m_pDecoder->Close();
RString sError = m_pDecoder->Open( GetID().filename ); RString sError = m_pDecoder->Open( GetID().filename );
if( sError != "" ) if( sError != "" )
RageException::Throw( "Error rewinding stream %s: %s", GetID().filename.c_str(), sError.c_str() ); RageException::Throw( "Error rewinding stream \"%s\": %s", GetID().filename.c_str(), sError.c_str() );
m_fClock = -fDelay; m_fClock = -fDelay;
} }
+4 -4
View File
@@ -20,7 +20,7 @@ void MakeInputHandlers( const RString &drivers, vector<InputHandler *> &Add )
split( drivers, ",", DriversToTry, true ); split( drivers, ",", DriversToTry, true );
if( DriversToTry.empty() ) if( DriversToTry.empty() )
RageException::Throw( INPUT_HANDLERS_EMPTY.GetValue() ); RageException::Throw( "%s", INPUT_HANDLERS_EMPTY.GetValue().c_str() );
RString Driver; RString Driver;
@@ -190,7 +190,7 @@ RageMovieTexture *MakeRageMovieTexture( RageTextureID ID )
split( sDrivers, ",", DriversToTry, true ); split( sDrivers, ",", DriversToTry, true );
if( DriversToTry.empty() ) if( DriversToTry.empty() )
RageException::Throw( MOVIE_DRIVERS_EMPTY.GetValue() ); RageException::Throw( "%s", MOVIE_DRIVERS_EMPTY.GetValue().c_str() );
RString Driver; RString Driver;
RageMovieTexture *ret = NULL; RageMovieTexture *ret = NULL;
@@ -225,7 +225,7 @@ RageMovieTexture *MakeRageMovieTexture( RageTextureID ID )
} }
} }
if ( !ret ) if ( !ret )
RageException::Throw( COULDNT_CREATE_MOVIE_DRIVER.GetValue() ); RageException::Throw( "%s", COULDNT_CREATE_MOVIE_DRIVER.GetValue().c_str() );
LOG->Trace( "Created movie texture \"%s\" with driver \"%s\"", LOG->Trace( "Created movie texture \"%s\" with driver \"%s\"",
ID.filename.c_str(), Driver.c_str() ); ID.filename.c_str(), Driver.c_str() );
@@ -240,7 +240,7 @@ RageSoundDriver *MakeRageSoundDriver( const RString &drivers )
split( drivers, ",", DriversToTry, true ); split( drivers, ",", DriversToTry, true );
if( DriversToTry.empty() ) if( DriversToTry.empty() )
RageException::Throw( SOUND_DRIVERS_CANNOT_EMPTY.GetValue() ); RageException::Throw( "%s", SOUND_DRIVERS_CANNOT_EMPTY.GetValue().c_str() );
RString Driver; RString Driver;
RageSoundDriver *ret = NULL; RageSoundDriver *ret = NULL;