Author: grumbel
Date: 2007-11-01 04:15:42 +0100 (Thu, 01 Nov 2007)
New Revision: 3440
Modified:
trunk/pingus/src/sound/sound.cpp
trunk/pingus/src/sound/sound_real.cpp
Log:
- changed sound code to throw runtime_error, not std::string
Modified: trunk/pingus/src/sound/sound.cpp
===================================================================
--- trunk/pingus/src/sound/sound.cpp 2007-11-01 03:06:50 UTC (rev 3439)
+++ trunk/pingus/src/sound/sound.cpp 2007-11-01 03:15:42 UTC (rev 3440)
@@ -41,8 +41,8 @@
try {
PingusSound::init (new PingusSoundReal ());
- } catch (const std::string& err) {
- std::cout << "Sound Error: " << err << std::endl;
+ } catch (const std::exception& err) {
+ std::cout << "Sound Error: " << err.what() << std::endl;
std::cout << "Sound will be disabled" << std::endl;
PingusSound::init (new PingusSoundDummy ());
}
Modified: trunk/pingus/src/sound/sound_real.cpp
===================================================================
--- trunk/pingus/src/sound/sound_real.cpp 2007-11-01 03:06:50 UTC (rev
3439)
+++ trunk/pingus/src/sound/sound_real.cpp 2007-11-01 03:15:42 UTC (rev
3440)
@@ -17,6 +17,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <stdexcept>
#include "SDL.h"
#include "SDL_mixer.h"
#include "../globals.hpp"
@@ -34,7 +35,7 @@
if (SDL_Init(SDL_INIT_AUDIO) == -1)
{
std::cout << "Unable to initialize SDL: " << SDL_GetError() << std::endl;
- throw std::string(SDL_GetError());
+ throw std::runtime_error(SDL_GetError());
}
pout(PINGUS_DEBUG_SOUND) << "Initializing SDL_Mixer" << std::endl;
@@ -42,7 +43,7 @@
if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 4096) == -1)
{
std::cout << "Unable to initialize SDL_Mixer: " << Mix_GetError() <<
std::endl;
- throw std::string(Mix_GetError());
+ throw std::runtime_error(Mix_GetError());
}
}
_______________________________________________
pingus-cvs mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/pingus-cvs