From 49f05c9ab8fe3df90f92e764cc12457080c0fcd0 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 21 Dec 2002 19:34:02 +0000 Subject: [PATCH] s/throw RageException/RageException::Throw/ --- stepmania/src/GameManager.cpp | 5 ----- stepmania/src/GrayArrowRow.cpp | 2 +- stepmania/src/NoteData.cpp | 2 +- stepmania/src/NoteDisplay.cpp | 6 +++--- stepmania/src/RageBitmapTexture.cpp | 4 ++-- stepmania/src/RageDisplay.cpp | 2 +- stepmania/src/RageMovieTexture.cpp | 24 ++++++++++++------------ stepmania/src/RageMovieTextureHelper.cpp | 2 +- stepmania/src/RageNetworkClient.cpp | 5 +++-- stepmania/src/RageSoundManager.cpp | 2 +- stepmania/src/RageTextureManager.cpp | 2 +- stepmania/src/ScreenManager.cpp | 2 +- stepmania/src/SongManager.cpp | 2 +- stepmania/src/Sprite.cpp | 8 ++++---- stepmania/src/StepMania.cpp | 6 +++--- stepmania/src/ThemeManager.cpp | 6 +++--- 16 files changed, 38 insertions(+), 42 deletions(-) diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index 860d91b142..b80e3643aa 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -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(); diff --git a/stepmania/src/GrayArrowRow.cpp b/stepmania/src/GrayArrowRow.cpp index 6ff96c1e25..61341966aa 100644 --- a/stepmania/src/GrayArrowRow.cpp +++ b/stepmania/src/GrayArrowRow.cpp @@ -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 ); } } diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 02ea2674da..f9e64d48ed 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -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; cGetPathTo(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 diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index e300975449..54d60bfccf 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -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() ); diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index b0768fd407..82b5f2fc52 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -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"); } diff --git a/stepmania/src/RageMovieTexture.cpp b/stepmania/src/RageMovieTexture.cpp index 99c39720fa..d99a349b1c 100644 --- a/stepmania/src/RageMovieTexture.cpp +++ b/stepmania/src/RageMovieTexture.cpp @@ -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 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 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 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 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; } diff --git a/stepmania/src/RageMovieTextureHelper.cpp b/stepmania/src/RageMovieTextureHelper.cpp index 5cc1791d7a..c893f4d730 100644 --- a/stepmania/src/RageMovieTextureHelper.cpp +++ b/stepmania/src/RageMovieTextureHelper.cpp @@ -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; diff --git a/stepmania/src/RageNetworkClient.cpp b/stepmania/src/RageNetworkClient.cpp index 01f8f57ca4..b42ba17e74 100644 --- a/stepmania/src/RageNetworkClient.cpp +++ b/stepmania/src/RageNetworkClient.cpp @@ -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 ) diff --git a/stepmania/src/RageSoundManager.cpp b/stepmania/src/RageSoundManager.cpp index 360ff198d9..df738147b4 100644 --- a/stepmania/src/RageSoundManager.cpp +++ b/stepmania/src/RageSoundManager.cpp @@ -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() diff --git a/stepmania/src/RageTextureManager.cpp b/stepmania/src/RageTextureManager.cpp index 5eed177ce3..888a4eb35b 100644 --- a/stepmania/src/RageTextureManager.cpp +++ b/stepmania/src/RageTextureManager.cpp @@ -153,7 +153,7 @@ void RageTextureManager::UnloadTexture( CString sTexturePath ) std::map::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--; diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index c5e8f1a400..0c9e381f93 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -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 diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 889bec0d93..fffa93d34c 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -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" diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 735711cb64..c69950c1e4 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -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] ) ) diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index e8155eb7e0..24d995eac8 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -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" ); } diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 1b0cff136c..0ca3696384 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -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(),