summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-06-13 14:56:27 +0000
committerrubidium <rubidium@openttd.org>2007-06-13 14:56:27 +0000
commit504d93c4993d853d49bca7743467b9b41770a7a0 (patch)
tree5e894021818e23320ea83319ac94ded3a2689299
parent112f05e7053079a3bedbbbe114c5a6a6152a3866 (diff)
downloadopenttd-504d93c4993d853d49bca7743467b9b41770a7a0.tar.xz
(svn r10138) -Fix: when you got a sufficiently small resolution, there is a possibility for a division by zero when a sound is played.
-rw-r--r--src/sound.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index ac8f3c2fa..249ff73e3 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -211,7 +211,7 @@ static void SndPlayScreenCoordFx(SoundFx sound, int x, int y)
StartSound(
sound,
- left / (vp->virtual_width / ((PANNING_LEVELS << 1) + 1)) - PANNING_LEVELS,
+ left / max(1, vp->virtual_width / ((PANNING_LEVELS << 1) + 1)) - PANNING_LEVELS,
(GetSound(sound)->volume * msf.effect_vol * _vol_factor_by_zoom[vp->zoom]) >> 15
);
return;