Avoid /0 in SetScale - not sure this is right way to do it though. But just to try and stop crashing prg's machine
authornemo
Tue, 28 Jul 2009 22:04:04 +0000
changeset 2285 6746bda385e8
parent 2284 bd091b6b128d
child 2286 8a24e0858947
Avoid /0 in SetScale - not sure this is right way to do it though. But just to try and stop crashing prg's machine
hedgewars/uStore.pas
hedgewars/uWorld.pas
--- a/hedgewars/uStore.pas	Tue Jul 28 16:29:39 2009 +0000
+++ b/hedgewars/uStore.pas	Tue Jul 28 22:04:04 2009 +0000
@@ -973,7 +973,8 @@
 procedure SetScale(f: GLfloat);
 begin
 cScaleFactor:= f;
-cWaterSprCount:= 1 + round(cScreenWidth * 2 / cScaleFactor / SpritesData[sprWater].Width);
+if SpritesData[sprWater].Width <> 0 then
+    cWaterSprCount:= 1 + round(cScreenWidth * 2 / cScaleFactor / SpritesData[sprWater].Width);
 
 glLoadIdentity;
 glViewport(0, 0, cScreenWidth, cScreenHeight);
--- a/hedgewars/uWorld.pas	Tue Jul 28 16:29:39 2009 +0000
+++ b/hedgewars/uWorld.pas	Tue Jul 28 22:04:04 2009 +0000
@@ -69,6 +69,7 @@
 cWaveWidth:= SpritesData[sprWater].Width;
 //cWaveHeight:= SpritesData[sprWater].Height;
 cWaveHeight:= 32;
+cWaterSprCount:= 1 + round(cScreenWidth * 2 / cScaleFactor / SpritesData[sprWater].Width);
 cGearScrEdgesDist:= Min(cScreenWidth div 2 - 100, cScreenHeight div 2 - 50);
 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
 prevPoint.X:= 0;