fix desync in snow
authornemo
Wed, 22 Dec 2010 01:17:46 -0500
changeset 4619 f9356de370bb
parent 4617 42aad2cd981e
child 4621 1d45bf63f25c
fix desync in snow
hedgewars/uLandObjects.pas
--- a/hedgewars/uLandObjects.pas	Wed Dec 22 01:11:48 2010 -0500
+++ b/hedgewars/uLandObjects.pas	Wed Dec 22 01:17:46 2010 -0500
@@ -364,7 +364,7 @@
 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects);
 var s: shortstring;
     f: textfile;
-    i, ii: LongInt;
+    i, ii, numFlakes: LongInt;
     c1, c2: TSDL_Color;
 
     procedure CheckRect(Width, Height, x, y, w, h: LongWord);
@@ -456,16 +456,17 @@
     Readln(f, vobFramesCount, vobFrameTicks, vobVelocity, vobFallSpeed);
 
 // adjust amount of flakes scaled by screen space
-vobCount:= longint(vobCount) * cScreenSpace div LAND_WIDTH;
+vobCount:= longint(vobCount);
+numFlakes:= vobCount * cScreenSpace div LAND_WIDTH;
 
 if (cReducedQuality and rqKillFlakes) <> 0 then
-    vobCount:= 0;
+    numFlakes:= 0;
 
 if Theme <> 'Snow' then
-    for i:= 0 to Pred(vobCount) do
+    for i:= 0 to Pred(numFlakes) do
         AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake)
 else
-    for i:= 0 to Pred(vobCount div 3) do
+    for i:= 0 to Pred(numFlakes div 3) do
         AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake);
 
 Close(f);