- a few minor bugfixes

This commit is contained in:
Mark Vejvoda 2011-11-17 21:36:29 +00:00
parent 0f195ca9e4
commit c751c1a2cf
2 changed files with 29 additions and 13 deletions

View File

@ -126,7 +126,9 @@ void SoundRenderer::update() {
if(runThreadSafe == true) { if(runThreadSafe == true) {
safeMutex.setMutex(&mutex); safeMutex.setMutex(&mutex);
} }
soundPlayer->updateStreams(); if(soundPlayer) {
soundPlayer->updateStreams();
}
} }
} }
@ -142,7 +144,9 @@ void SoundRenderer::playMusic(StrSound *strSound) {
safeMutex.setMutex(&mutex); safeMutex.setMutex(&mutex);
} }
soundPlayer->play(strSound); if(soundPlayer) {
soundPlayer->play(strSound);
}
} }
} }
} }
@ -160,12 +164,14 @@ void SoundRenderer::stopMusic(StrSound *strSound) {
safeMutex.setMutex(&mutex); safeMutex.setMutex(&mutex);
} }
soundPlayer->stop(strSound); if(soundPlayer) {
if(strSound != NULL) { soundPlayer->stop(strSound);
if(strSound->getNext() != NULL) { if(strSound != NULL) {
soundPlayer->stop(strSound->getNext()); if(strSound->getNext() != NULL) {
soundPlayer->stop(strSound->getNext());
}
} }
} }
} }
} }
@ -191,7 +197,9 @@ void SoundRenderer::playFx(StaticSound *staticSound, Vec3f soundPos, Vec3f camPo
safeMutex.setMutex(&mutex); safeMutex.setMutex(&mutex);
} }
soundPlayer->play(staticSound); if(soundPlayer) {
soundPlayer->play(staticSound);
}
} }
} }
} }
@ -206,7 +214,9 @@ void SoundRenderer::playFx(StaticSound *staticSound) {
safeMutex.setMutex(&mutex); safeMutex.setMutex(&mutex);
} }
soundPlayer->play(staticSound); if(soundPlayer) {
soundPlayer->play(staticSound);
}
} }
} }
} }
@ -222,7 +232,9 @@ void SoundRenderer::playAmbient(StrSound *strSound) {
safeMutex.setMutex(&mutex); 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); 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); safeMutex.setMutex(&mutex);
} }
soundPlayer->stopAllSounds(fadeOff); if(soundPlayer) {
soundPlayer->stopAllSounds(fadeOff);
}
} }
} }

View File

@ -640,7 +640,7 @@ void UnitParticleSystem::initParticle(Particle *p, int particleIndex){
// work out where we start for our shape (set speed and pos) // work out where we start for our shape (set speed and pos)
switch(shape){ switch(shape){
case sSpherical: case sSpherical:
angle = random.randRange(0,360); angle = (float)random.randRange(0,360);
// fall through // fall through
case sConical:{ case sConical:{
Vec2f horiz = Vec2f(1,0).rotate(ang); Vec2f horiz = Vec2f(1,0).rotate(ang);