(svn r10138) -Fix: when you got a sufficiently small resolution, there is a possibility for a division by zero when a sound is played.
authorrubidium
Wed, 13 Jun 2007 14:56:27 +0000
changeset 6891 824359de2f5e
parent 6890 bebf22f6c449
child 6892 c23b5f195668
(svn r10138) -Fix: when you got a sufficiently small resolution, there is a possibility for a division by zero when a sound is played.
src/sound.cpp
--- a/src/sound.cpp	Wed Jun 13 14:52:41 2007 +0000
+++ b/src/sound.cpp	Wed Jun 13 14:56:27 2007 +0000
@@ -211,7 +211,7 @@
 
 			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;