diff --git a/stepmania/src/RageException.cpp b/stepmania/src/RageException.cpp index 5a934f27d7..c7817717e4 100644 --- a/stepmania/src/RageException.cpp +++ b/stepmania/src/RageException.cpp @@ -4,20 +4,12 @@ #include "RageLog.h" #include "StepMania.h" +#include + #if defined(_WINDOWS) && defined(DEBUG) #include #endif -RageException::RageException( const CString &str ): - m_sError(str) -{ -} - -const char* RageException::what() const throw () -{ - return m_sError; -} - /* This is no longer actually implemented by throwing an exception, but it acts * the same way to code in practice. */ void RageException::Throw(const char *fmt, ...) @@ -52,15 +44,6 @@ void RageException::Throw(const char *fmt, ...) HandleException( error ); } -void RageException::ThrowNonfatal(const char *fmt, ...) -{ - va_list va; - va_start(va, fmt); - CString error = vssprintf( fmt, va ); - va_end(va); - - throw RageException( error ); -} /* * Copyright (c) 2001-2004 Chris Danford * All rights reserved. diff --git a/stepmania/src/RageException.h b/stepmania/src/RageException.h index dd36aea802..df69718745 100644 --- a/stepmania/src/RageException.h +++ b/stepmania/src/RageException.h @@ -5,25 +5,9 @@ #ifndef RAGEEXCEPTION_H #define RAGEEXCEPTION_H -#include -#include - -class RageException : public exception +namespace RageException { -public: - RageException( const CString &str ); - - virtual const char *what() const throw(); - virtual ~RageException() throw() { } - - /* The only difference between these is that Throw triggers debug behavior - * and Nonfatal doesn't. Nonfatal is used when the exception happens - * normally and will be caught, such as when a driver fails to initialize. */ - static void NORETURN Throw(const char *fmt, ...); - static void NORETURN ThrowNonfatal(const char *fmt, ...); - -protected: - CString m_sError; + void NORETURN Throw(const char *fmt, ...); }; #endif diff --git a/stepmania/src/arch/arch.cpp b/stepmania/src/arch/arch.cpp index 0298218680..092586f054 100644 --- a/stepmania/src/arch/arch.cpp +++ b/stepmania/src/arch/arch.cpp @@ -111,47 +111,43 @@ RageSoundDriver *MakeRageSoundDriver(CString drivers) for(unsigned i = 0; ret == NULL && i < DriversToTry.size(); ++i) { - try { - Driver = DriversToTry[i]; - LOG->Trace("Initializing driver: %s", DriversToTry[i].c_str()); + Driver = DriversToTry[i]; + LOG->Trace("Initializing driver: %s", DriversToTry[i].c_str()); #ifdef _WINDOWS - if(!DriversToTry[i].CompareNoCase("DirectSound")) ret = new RageSound_DSound; - if(!DriversToTry[i].CompareNoCase("DirectSound-sw")) ret = new RageSound_DSound_Software; - if(!DriversToTry[i].CompareNoCase("WaveOut")) ret = new RageSound_WaveOut; + if(!DriversToTry[i].CompareNoCase("DirectSound")) ret = new RageSound_DSound; + if(!DriversToTry[i].CompareNoCase("DirectSound-sw")) ret = new RageSound_DSound_Software; + if(!DriversToTry[i].CompareNoCase("WaveOut")) ret = new RageSound_WaveOut; #endif #ifdef _XBOX - if(!DriversToTry[i].CompareNoCase("DirectSound")) ret = new RageSound_DSound; + if(!DriversToTry[i].CompareNoCase("DirectSound")) ret = new RageSound_DSound; #endif #ifdef HAVE_ALSA - if(!DriversToTry[i].CompareNoCase("ALSA")) ret = new RageSound_ALSA9; - if(!DriversToTry[i].CompareNoCase("ALSA-sw")) ret = new RageSound_ALSA9_Software; + if(!DriversToTry[i].CompareNoCase("ALSA")) ret = new RageSound_ALSA9; + if(!DriversToTry[i].CompareNoCase("ALSA-sw")) ret = new RageSound_ALSA9_Software; #endif #ifdef HAVE_OSS - if(!DriversToTry[i].CompareNoCase("OSS")) ret = new RageSound_OSS; + if(!DriversToTry[i].CompareNoCase("OSS")) ret = new RageSound_OSS; #endif #ifdef RAGE_SOUND_CA - if(!DriversToTry[i].CompareNoCase("CoreAudio")) ret = new RageSound_CA; + if(!DriversToTry[i].CompareNoCase("CoreAudio")) ret = new RageSound_CA; #endif #ifdef RAGE_SOUND_QT1 - if(!DriversToTry[i].CompareNoCase("QT1")) ret = new RageSound_QT1; + if(!DriversToTry[i].CompareNoCase("QT1")) ret = new RageSound_QT1; #endif - if(!DriversToTry[i].CompareNoCase("Null")) ret = new RageSound_Null; + if(!DriversToTry[i].CompareNoCase("Null")) ret = new RageSound_Null; - if( ret == NULL ) - { - LOG->Warn( "Unknown sound driver name: %s", DriversToTry[i].c_str() ); - continue; - } + if( ret == NULL ) + { + LOG->Warn( "Unknown sound driver name: %s", DriversToTry[i].c_str() ); + continue; + } - CString sError = ret->Init(); - if( sError != "" ) - { - LOG->Info( "Couldn't load driver %s: %s", DriversToTry[i].c_str(), sError.c_str() ); - SAFE_DELETE( ret ); - } - } catch(const RageException &e) { - LOG->Info("Couldn't load driver %s: %s", DriversToTry[i].c_str(), e.what()); + CString sError = ret->Init(); + if( sError != "" ) + { + LOG->Info( "Couldn't load driver %s: %s", DriversToTry[i].c_str(), sError.c_str() ); + SAFE_DELETE( ret ); } }