From 29fa45415028675e5ca7fb7618cb53c09c19b44e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 30 Nov 2004 20:52:25 +0000 Subject: [PATCH] exceptions --- stepmania/src/arch/Dialog/Dialog.cpp | 19 +++++++++++-------- stepmania/src/arch/Dialog/DialogDriver.h | 1 + 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/stepmania/src/arch/Dialog/Dialog.cpp b/stepmania/src/arch/Dialog/Dialog.cpp index e1b55a3df3..e0d8c11025 100644 --- a/stepmania/src/arch/Dialog/Dialog.cpp +++ b/stepmania/src/arch/Dialog/Dialog.cpp @@ -35,21 +35,24 @@ void Dialog::Init() CString Driver; for( unsigned i = 0; g_pImpl == NULL && i < DriversToTry.size(); ++i ) { - try { - Driver = DriversToTry[i]; + Driver = DriversToTry[i]; #if defined(HAVE_DIALOG_WIN32) - if( !DriversToTry[i].CompareNoCase("Win32") ) g_pImpl = new DialogDriver_Win32; + if( !DriversToTry[i].CompareNoCase("Win32") ) g_pImpl = new DialogDriver_Win32; #endif #if defined(HAVE_DIALOG_COCOA) - if( !DriversToTry[i].CompareNoCase("Cocoa") ) g_pImpl = new DialogDriver_Cocoa; + if( !DriversToTry[i].CompareNoCase("Cocoa") ) g_pImpl = new DialogDriver_Cocoa; #endif - if( !DriversToTry[i].CompareNoCase("Null") ) g_pImpl = new DialogDriver_Null; - } - catch( const RageException &e ) + if( !DriversToTry[i].CompareNoCase("Null") ) g_pImpl = new DialogDriver_Null; + + if( g_pImpl == NULL ) + continue; + CString sError = g_pImpl->Init(); + if( sError != "" ) { if( LOG ) - LOG->Info("Couldn't load driver %s: %s", DriversToTry[i].c_str(), e.what()); + LOG->Info( "Couldn't load driver %s: %s", DriversToTry[i].c_str(), sError.c_str() ); + SAFE_DELETE( g_pImpl ); } } diff --git a/stepmania/src/arch/Dialog/DialogDriver.h b/stepmania/src/arch/Dialog/DialogDriver.h index 8d920f0087..5660573f7c 100644 --- a/stepmania/src/arch/Dialog/DialogDriver.h +++ b/stepmania/src/arch/Dialog/DialogDriver.h @@ -11,6 +11,7 @@ public: virtual Dialog::Result AbortRetryIgnore( CString sMessage, CString ID ) { return Dialog::ignore; } virtual Dialog::Result RetryCancel( CString sMessage, CString ID ) { return Dialog::cancel; } + virtual CString Init() { return ""; } virtual ~DialogDriver() { } };