Mercurial > sumwars
changeset 2672:c8d354c97487 gussoundtest
fixes #30: Sumwars should not crash anymore because of OpenAL on startup
author | Stefan Stammberger <fusion44> |
---|---|
date | Thu, 13 Mar 2014 18:36:24 +0100 |
parents | f28e1d1c6861 |
children | 990f8a441e83 |
files | src/gussound/gopenal.cpp src/gussound/gussoundutil/timer.cpp |
diffstat | 2 files changed, 6 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gussound/gopenal.cpp Sat Mar 08 22:06:19 2014 +0100 +++ b/src/gussound/gopenal.cpp Thu Mar 13 18:36:24 2014 +0100 @@ -93,31 +93,28 @@ { ALenum myErr; - alutInitWithoutContext (NULL,NULL); - myErr = alGetError (); - if (myErr) + bool b = alutInitWithoutContext (NULL,NULL); + if (!b) { throw SoundException ("Unable to initialize alut!"); } alcDevice_ = alcOpenDevice (NULL); - myErr = alGetError (); - if (myErr) + if (!alcDevice_) { throw SoundException ("Unable to open OpenAL device!"); } alcContext_ = alcCreateContext (alcDevice_, NULL); - myErr = alGetError (); - if (myErr) + if (!alcContext_) { alcCloseDevice (alcDevice_); throw SoundException ("Unable to create OpenAL context!"); } - alcMakeContextCurrent (alcContext_); + b = alcMakeContextCurrent (alcContext_); myErr = alGetError (); - if (myErr) + if (!b) { throw SoundException ("Unable to make the current context current!"); }
--- a/src/gussound/gussoundutil/timer.cpp Sat Mar 08 22:06:19 2014 +0100 +++ b/src/gussound/gussoundutil/timer.cpp Thu Mar 13 18:36:24 2014 +0100 @@ -125,7 +125,6 @@ returnValue = returnValue * 60 + newtime->tm_min; returnValue = returnValue * 60 + newtime->tm_sec; returnValue = returnValue * 1000 + 0; // no millis - delete newtime; #endif return returnValue; } @@ -179,7 +178,6 @@ returnValue = returnValue * 60 + newtime->tm_min; returnValue = returnValue * 60 + newtime->tm_sec; returnValue = returnValue * 1000 + 0; // no millis - delete newtime; #endif return returnValue; }