From c751c1a2cffae76b0526dd236bf104f0c819688b Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 17 Nov 2011 21:36:29 +0000 Subject: [PATCH] - a few minor bugfixes --- source/glest_game/sound/sound_renderer.cpp | 40 +++++++++++++------ .../shared_lib/sources/graphics/particle.cpp | 2 +- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/source/glest_game/sound/sound_renderer.cpp b/source/glest_game/sound/sound_renderer.cpp index a4f0fa91..e4869d9a 100644 --- a/source/glest_game/sound/sound_renderer.cpp +++ b/source/glest_game/sound/sound_renderer.cpp @@ -126,7 +126,9 @@ void SoundRenderer::update() { if(runThreadSafe == true) { safeMutex.setMutex(&mutex); } - soundPlayer->updateStreams(); + if(soundPlayer) { + soundPlayer->updateStreams(); + } } } @@ -142,7 +144,9 @@ void SoundRenderer::playMusic(StrSound *strSound) { safeMutex.setMutex(&mutex); } - soundPlayer->play(strSound); + if(soundPlayer) { + soundPlayer->play(strSound); + } } } } @@ -160,12 +164,14 @@ void SoundRenderer::stopMusic(StrSound *strSound) { safeMutex.setMutex(&mutex); } - soundPlayer->stop(strSound); - if(strSound != NULL) { - if(strSound->getNext() != NULL) { - soundPlayer->stop(strSound->getNext()); + if(soundPlayer) { + soundPlayer->stop(strSound); + if(strSound != NULL) { + if(strSound->getNext() != NULL) { + soundPlayer->stop(strSound->getNext()); + } } - } + } } } @@ -191,7 +197,9 @@ void SoundRenderer::playFx(StaticSound *staticSound, Vec3f soundPos, Vec3f camPo safeMutex.setMutex(&mutex); } - soundPlayer->play(staticSound); + if(soundPlayer) { + soundPlayer->play(staticSound); + } } } } @@ -206,7 +214,9 @@ void SoundRenderer::playFx(StaticSound *staticSound) { safeMutex.setMutex(&mutex); } - soundPlayer->play(staticSound); + if(soundPlayer) { + soundPlayer->play(staticSound); + } } } } @@ -222,7 +232,9 @@ void SoundRenderer::playAmbient(StrSound *strSound) { safeMutex.setMutex(&mutex); } - soundPlayer->play(strSound, ambientFade); + if(soundPlayer) { + soundPlayer->play(strSound, ambientFade); + } } } } @@ -234,7 +246,9 @@ void SoundRenderer::stopAmbient(StrSound *strSound) { safeMutex.setMutex(&mutex); } - soundPlayer->stop(strSound, ambientFade); + if(soundPlayer) { + soundPlayer->stop(strSound, ambientFade); + } } } @@ -247,7 +261,9 @@ void SoundRenderer::stopAllSounds(int64 fadeOff) { safeMutex.setMutex(&mutex); } - soundPlayer->stopAllSounds(fadeOff); + if(soundPlayer) { + soundPlayer->stopAllSounds(fadeOff); + } } } diff --git a/source/shared_lib/sources/graphics/particle.cpp b/source/shared_lib/sources/graphics/particle.cpp index 8a1e2fa5..80def5d8 100644 --- a/source/shared_lib/sources/graphics/particle.cpp +++ b/source/shared_lib/sources/graphics/particle.cpp @@ -640,7 +640,7 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){ // work out where we start for our shape (set speed and pos) switch(shape){ case sSpherical: - angle = random.randRange(0,360); + angle = (float)random.randRange(0,360); // fall through case sConical:{ Vec2f horiz = Vec2f(1,0).rotate(ang);