s/throw RageException/RageException::Throw/

This commit is contained in:
Glenn Maynard
2002-12-21 19:34:02 +00:00
parent a3c6b12981
commit 49f05c9ab8
16 changed files with 38 additions and 42 deletions
-5
View File
@@ -1296,11 +1296,6 @@ RageColor GameManager::GetMetricC( CString sClassName, CString sValueName )
return RageColor(r,g,b,a);
}
__declspec(noreturn) void blah()
{
}
CString GameManager::GetPathTo( const int col, CString sElementName ) // looks in GAMESTATE for the current Style
{
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
+1 -1
View File
@@ -38,7 +38,7 @@ void GrayArrowRow::Load( PlayerNumber pn )
CString sPath = GAMEMAN->GetPathTo(c, "receptor");
m_GrayArrow[c].Load( sPath );
if( m_GrayArrow[c].GetNumStates() != 2 )
throw RageException( "'%s' must have two frames", sPath.GetString() );
RageException::Throw( "'%s' must have two frames", sPath.GetString() );
m_GrayArrow[c].SetX( pStyleDef->m_ColumnInfo[pn][c].fXOffset );
}
}
+1 -1
View File
@@ -617,7 +617,7 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData
const int iIndex = BeatToNoteRow( fBeat );
// if( m_iNumTracks != sMeasureLine.GetLength() )
// throw RageException( "Actual number of note columns (%d) is different from the NotesType (%d).", m_iNumTracks, sMeasureLine.GetLength() );
// RageException::Throw( "Actual number of note columns (%d) is different from the NotesType (%d).", m_iNumTracks, sMeasureLine.GetLength() );
for( int c=0; c<min(sMeasureLine.GetLength(),out.m_iNumTracks); c++ )
{
+3 -3
View File
@@ -46,14 +46,14 @@ void NoteDisplay::Load( int iColNum, PlayerNumber pn )
CString sTapPartsPath = GAMEMAN->GetPathTo(iColNum, "tap parts");
m_sprTapParts.Load( sTapPartsPath );
if( m_sprTapParts.GetNumStates() % 2 != 0 )
throw RageException( "Tap Parts '%s' must have an even number of frames.", sTapPartsPath.GetString() );
RageException::Throw( "Tap Parts '%s' must have an even number of frames.", sTapPartsPath.GetString() );
m_sprTapParts.StopAnimating();
m_sprTapParts.TurnShadowOff();
CString sHoldPartsPath = GAMEMAN->GetPathTo(iColNum, "hold parts");
m_sprHoldParts.Load( sHoldPartsPath );
if( m_sprHoldParts.GetTexture()->GetFramesWide() != 4 || m_sprHoldParts.GetTexture()->GetFramesHigh() != 2 )
throw RageException( "Hold Parts '%s' must have 4x2 frames.", sHoldPartsPath.GetString() );
RageException::Throw( "Hold Parts '%s' must have 4x2 frames.", sHoldPartsPath.GetString() );
m_sprHoldParts.StopAnimating();
m_sprHoldParts.TurnShadowOff();
@@ -62,7 +62,7 @@ void NoteDisplay::Load( int iColNum, PlayerNumber pn )
const CString sColorsFilePath = GAMEMAN->GetPathTo( iColNum, "Tap.colors" );
FILE* fp = fopen( sColorsFilePath, "r" );
if( fp == NULL )
throw RageException( "Couldn't open .colors file '%s'", sColorsFilePath.GetString() );
RageException::Throw( "Couldn't open .colors file '%s'", sColorsFilePath.GetString() );
bool bSuccess;
do
+2 -2
View File
@@ -130,7 +130,7 @@ void RageBitmapTexture::Create()
/* XXX: Wait, we don't want to throw for all images; in particular, we
* want to tolerate corrupt/unknown background images. */
if(img == NULL)
throw RageException( "Couldn't load %s: %s", m_sFilePath, SDL_GetError() );
RageException::Throw( "Couldn't load %s: %s", m_sFilePath, SDL_GetError() );
/* Figure out which texture format to use. */
GLenum fmtTexture;
@@ -167,7 +167,7 @@ void RageBitmapTexture::Create()
else if( TEXTUREMAN->GetTextureColorDepth() == 32 )
fmtTexture = GL_RGBA8;
else
throw RageException( "Invalid color depth: %d bits", TEXTUREMAN->GetTextureColorDepth() );
RageException::Throw( "Invalid color depth: %d bits", TEXTUREMAN->GetTextureColorDepth() );
/* Cap the max texture size to the hardware max. */
m_prefs.iMaxSize = min( m_prefs.iMaxSize, DISPLAY->GetMaxTextureSize() );
+1 -1
View File
@@ -235,7 +235,7 @@ bool RageDisplay::SetVideoMode( bool windowed, int width, int height, int bpp, i
if(!g_screen || need_reload) {
g_screen = SDL_SetVideoMode(width, height, bpp, g_flags);
if(!g_screen)
throw RageException("SDL_SetVideoMode failed: %s", SDL_GetError());
RageException::Throw("SDL_SetVideoMode failed: %s", SDL_GetError());
SDL_WM_SetCaption("StepMania", "StepMania");
}
+12 -12
View File
@@ -125,7 +125,7 @@ void HandleDivXError()
/* Actually, we might need XviD; we might want to look
* at the file and try to figure out if it's something
* common: DIV3, DIV4, DIV5, XVID, or maybe even MPEG2. */
throw RageException(
RageException::Throw(
"Could not locate the DivX video codec.\n"
"DivX is required to movie textures and must\n"
"be installed before running the application.\n\n"
@@ -138,11 +138,11 @@ void RageMovieTexture::Create()
HRESULT hr;
if( FAILED( hr=CoInitialize(NULL) ) )
throw RageException( hr_ssprintf(hr, "Could not CoInitialize") );
RageException::Throw( hr_ssprintf(hr, "Could not CoInitialize") );
// Create the filter graph
if( FAILED( hr=m_pGB.CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC) ) )
throw RageException( hr_ssprintf(hr, "Could not create CLSID_FilterGraph!") );
RageException::Throw( hr_ssprintf(hr, "Could not create CLSID_FilterGraph!") );
// Create the Texture Renderer object
CTextureRenderer *pCTR = new CTextureRenderer;
@@ -151,7 +151,7 @@ void RageMovieTexture::Create()
* graph. When m_pGB is released, it will free pFTR. */
CComPtr<IBaseFilter> pFTR = pCTR;
if( FAILED( hr = m_pGB->AddFilter(pFTR, L"TEXTURERENDERER" ) ) )
throw RageException( hr_ssprintf(hr, "Could not add renderer filter to graph!") );
RageException::Throw( hr_ssprintf(hr, "Could not add renderer filter to graph!") );
// Add the source filter
CComPtr<IBaseFilter> pFSrc; // Source Filter
@@ -162,23 +162,23 @@ void RageMovieTexture::Create()
if( FAILED( hr = m_pGB->AddSourceFilter( wFileName, L"SOURCE", &pFSrc ) ) )
{
HandleDivXError();
throw RageException( hr_ssprintf(hr, "Could not create source filter to graph!") );
RageException::Throw( hr_ssprintf(hr, "Could not create source filter to graph!") );
}
// Find the source's output and the renderer's input
CComPtr<IPin> pFTRPinIn; // Texture Renderer Input Pin
if( FAILED( hr = pFTR->FindPin( L"In", &pFTRPinIn ) ) )
throw RageException( hr_ssprintf(hr, "Could not find input pin!") );
RageException::Throw( hr_ssprintf(hr, "Could not find input pin!") );
CComPtr<IPin> pFSrcPinOut; // Source Filter Output Pin
if( FAILED( hr = pFSrc->FindPin( L"Output", &pFSrcPinOut ) ) )
throw RageException( hr_ssprintf(hr, "Could not find output pin!") );
RageException::Throw( hr_ssprintf(hr, "Could not find output pin!") );
// Connect these two filters
if( FAILED( hr = m_pGB->Connect( pFSrcPinOut, pFTRPinIn ) ) )
{
HandleDivXError();
throw RageException( hr_ssprintf(hr, "Could not connect pins!") );
RageException::Throw( hr_ssprintf(hr, "Could not connect pins!") );
}
// Pass us to our TextureRenderer.
@@ -195,7 +195,7 @@ void RageMovieTexture::Create()
// Start the graph running
if( !PlayMovie() )
throw RageException( "Could not run the DirectShow graph." );
RageException::Throw( "Could not run the DirectShow graph." );
}
void RageMovieTexture::NewData(char *data)
@@ -238,7 +238,7 @@ bool RageMovieTexture::PlayMovie()
// Start the graph running;
HRESULT hr;
if( FAILED( hr = pMC->Run() ) )
throw RageException( hr_ssprintf(hr, "Could not run the DirectShow graph.") );
RageException::Throw( hr_ssprintf(hr, "Could not run the DirectShow graph.") );
m_bPlaying = true;
@@ -275,7 +275,7 @@ void RageMovieTexture::Pause()
HRESULT hr;
if( FAILED( hr = pMC->Pause() ) )
throw RageException( hr_ssprintf(hr, "Could not pause the DirectShow graph.") );
RageException::Throw( hr_ssprintf(hr, "Could not pause the DirectShow graph.") );
}
void RageMovieTexture::Stop()
@@ -285,7 +285,7 @@ void RageMovieTexture::Stop()
HRESULT hr;
if( FAILED( hr = pMC->Stop() ) )
throw RageException( hr_ssprintf(hr, "Could not stop the DirectShow graph.") );
RageException::Throw( hr_ssprintf(hr, "Could not stop the DirectShow graph.") );
m_bPlaying = false;
}
+1 -1
View File
@@ -15,7 +15,7 @@ CTextureRenderer::CTextureRenderer()
NAME("Texture Renderer"), NULL, &CBV_ret)
{
if( FAILED(CBV_ret) )
throw RageException( hr_ssprintf(CBV_ret, "Could not create texture renderer object!") );
RageException::Throw( hr_ssprintf(CBV_ret, "Could not create texture renderer object!") );
// Store and ARageef the texture for our use.
m_pTexture = NULL;
+3 -2
View File
@@ -50,12 +50,12 @@ RageNetworkClient::RageNetworkClient()
// SDL_Init(0); // this may have already been init'd somewhere else
if( SDLNet_Init() < 0 )
throw RageException("SDLNet_Init: %s\n", SDLNet_GetError());
RageException::Throw("SDLNet_Init: %s\n", SDLNet_GetError());
// allocate socket sets
m_priSockSet = SDLNet_AllocSocketSet(1);
if(!m_priSockSet)
throw RageException("SDLNet_AllocSocketSet: %s\n", SDLNet_GetError());
RageException::Throw("SDLNet_AllocSocketSet: %s\n", SDLNet_GetError());
}
RageNetworkClient::~RageNetworkClient()
@@ -108,6 +108,7 @@ void RageNetworkClient::Update( float fDeltaTime )
int numready = SDLNet_CheckSockets(m_priSockSet, 0);
if(numready==-1)
{
// XXX sorry, this was really noisy ... - glenn
// LOG->Warn("SDLNet_CheckSockets: %s\n", SDLNet_GetError());
}
else if( numready )
+1 -1
View File
@@ -17,7 +17,7 @@ RageSoundManager::RageSoundManager(CString drivers)
{
driver = MakeRageSoundDriver(drivers);
if(!driver)
throw RageException("Couldn't find a sound driver that works");
RageException::Throw("Couldn't find a sound driver that works");
}
RageSoundManager::~RageSoundManager()
+1 -1
View File
@@ -153,7 +153,7 @@ void RageTextureManager::UnloadTexture( CString sTexturePath )
std::map<CString, RageTexture*>::iterator p = m_mapPathToTexture.find(sTexturePath);
if(p == m_mapPathToTexture.end())
throw RageException( "Tried to Unload texture '%s' that wasn't loaded.", sTexturePath.GetString() );
RageException::Throw( "Tried to Unload texture '%s' that wasn't loaded.", sTexturePath.GetString() );
RageTexture* pTexture = p->second;
pTexture->m_iRefCount--;
+1 -1
View File
@@ -230,7 +230,7 @@ Screen* ScreenManager::MakeNewScreen( CString sClassName )
else if( 0==stricmp(sClassName, "ScreenTitleMenu") ) ret = new ScreenTitleMenu;
else if( 0==stricmp(sClassName, "ScreenEz2SelectMusic") ) ret = new ScreenEz2SelectMusic;
else
throw RageException( "Invalid Screen class name '%s'", sClassName.GetString() );
RageException::Throw( "Invalid Screen class name '%s'", sClassName.GetString() );
/* That probably took a little while. Let's reset stats. This prevents us
* from displaying an unnaturally low FPS value, and the next FPS value we
+1 -1
View File
@@ -78,7 +78,7 @@ void SongManager::SanityCheckGroupDir( CString sDir ) const
GetDirListing( sDir + "\\*.ogg", arrayFiles );
GetDirListing( sDir + "\\*.wav", arrayFiles );
if( !arrayFiles.empty() )
throw RageException(
RageException::Throw(
"The folder '%s' contains music files.\n\n"
"This means that you have a music outside of a song folder.\n"
"All song folders must reside in a group folder. For example, 'Songs\\DDR 4th Mix\\B4U'.\n"
+4 -4
View File
@@ -73,17 +73,17 @@ bool Sprite::LoadFromSpriteFile( CString sSpritePath, RageTexturePrefs prefs )
IniFile ini;
ini.SetPath( m_sSpritePath );
if( !ini.ReadFile() )
throw RageException( "Error opening Sprite file '%s'.", m_sSpritePath.GetString() );
RageException::Throw( "Error opening Sprite file '%s'.", m_sSpritePath.GetString() );
CString sTextureFile;
ini.GetValue( "Sprite", "Texture", sTextureFile );
if( sTextureFile == "" )
throw RageException( "Error reading value 'Texture' from %s.", m_sSpritePath.GetString() );
RageException::Throw( "Error reading value 'Texture' from %s.", m_sSpritePath.GetString() );
CString sTexturePath = sFontDir + sTextureFile; // save the path of the new texture
if( !DoesFileExist(sTexturePath) )
throw RageException( "The sprite file '%s' points to a texture '%s' which doesn't exist.", m_sSpritePath.GetString(), sTexturePath.GetString() );
RageException::Throw( "The sprite file '%s' points to a texture '%s' which doesn't exist.", m_sSpritePath.GetString(), sTexturePath.GetString() );
// Load the texture
@@ -100,7 +100,7 @@ bool Sprite::LoadFromSpriteFile( CString sSpritePath, RageTexturePrefs prefs )
if( !ini.GetValueI( "Sprite", sFrameKey, m_iStateToFrame[i] ) )
break;
if( m_iStateToFrame[i] >= m_pTexture->GetNumFrames() )
throw RageException( "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.",
m_sSpritePath.GetString(), sFrameKey.GetString(), m_iStateToFrame[i], sTexturePath.GetString(), m_pTexture->GetNumFrames() );
m_fDelay[i] = 0.2f;
if( !ini.GetValueF( "Sprite", sDelayKey, m_fDelay[i] ) )
+3 -3
View File
@@ -176,7 +176,7 @@ int main(int argc, char* argv[])
/* Initialize the SDL library. */
if( SDL_InitSubSystem(SDL_INIT_VIDEO) < 0 )
throw RageException( "Couldn't initialize SDL: %s\n", SDL_GetError() );
RageException::Throw( "Couldn't initialize SDL: %s\n", SDL_GetError() );
SetIcon();
@@ -227,7 +227,7 @@ int main(int argc, char* argv[])
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if ( SDL_GetWMInfo(&info) < 0 )
throw RageException( "SDL_GetWMInfo failed" );
RageException::Throw( "SDL_GetWMInfo failed" );
#ifdef WIN32
g_hWndMain = info.window;
@@ -247,7 +247,7 @@ int main(int argc, char* argv[])
// immediately try to connect to server
GAMESTATE->m_pCurSong = SONGMAN->GetSongFromDir( g_sSongPath );
if( GAMESTATE->m_pCurSong == NULL )
throw RageException( "The song '%s' is required to play this network game.", g_sSongPath.GetString() );
RageException::Throw( "The song '%s' is required to play this network game.", g_sSongPath.GetString() );
CLIENT->Connect( (const char*)g_sServerIP, SM_PORT );
SCREENMAN->SetNewScreen( "ScreenNetworkWaiting" );
}
+3 -3
View File
@@ -176,7 +176,7 @@ try_element_again:
break;
case IDABORT:
#endif
throw RageException( "Theme element '%s/%s' could not be found in '%s' or '%s'.",
RageException::Throw( "Theme element '%s/%s' could not be found in '%s' or '%s'.",
sAssetCategory.GetString(),
sFileName.GetString(),
GetThemeDirFromName(m_sCurThemeName).GetString(),
@@ -217,7 +217,7 @@ try_element_again:
if( IDRETRY == MessageBox(NULL,"ThemeManager",ssprintf("The redirect '%s' points to the file '%s', which does not exist. Verify that this redirect is correct.", sRedirFilePath.GetString(), sNewFilePath.GetString()), MB_RETRYCANCEL ) )
goto try_element_again;
#endif
throw RageException( "The redirect '%s' points to the file '%s', which does not exist. Verify that this redirect is correct.", sRedirFilePath.GetString(), sNewFilePath.GetString() );
RageException::Throw( "The redirect '%s' points to the file '%s', which does not exist. Verify that this redirect is correct.", sRedirFilePath.GetString(), sNewFilePath.GetString() );
}
else
return sNewFilePath;
@@ -264,7 +264,7 @@ try_metric_again:
goto try_metric_again;
#endif
throw RageException( "Theme metric '%s : %s' could not be found in '%s' or '%s'.",
RageException::Throw( "Theme metric '%s : %s' could not be found in '%s' or '%s'.",
sClassName.GetString(),
sValueName.GetString(),
sCurMetricPath.GetString(),