summaryrefslogtreecommitdiff
path: root/src
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
commit0a4a4875fbcb4d3769fac83a987fc55e40bfba66 (patch)
tree5e894021818e23320ea83319ac94ded3a2689299 /src
parent779fd2fa42ef00e586f9a1dc5f0b1e7b37f65938 (diff)
downloadopenttd-0a4a4875fbcb4d3769fac83a987fc55e40bfba66.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.
Diffstat (limited to 'src')
-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;