Fix failure to update all cloud layers properly when entering Sudden Death
authorWuzzy <almikes@aol.com>
Fri, 13 Oct 2017 23:39:36 +0200
changeset 12707 0dfb49261cab
parent 12706 79e13080b9db
child 12708 6726d5edfdfb
Fix failure to update all cloud layers properly when entering Sudden Death
hedgewars/uVisualGears.pas
--- a/hedgewars/uVisualGears.pas	Fri Oct 13 16:37:56 2017 -0400
+++ b/hedgewars/uVisualGears.pas	Fri Oct 13 23:39:36 2017 +0200
@@ -472,22 +472,25 @@
 end;
 
 procedure ChangeToSDClouds;
-var       i: LongInt;
+var       i, j: LongInt;
     vg, tmp: PVisualGear;
 begin
 if cCloudsNumber = cSDCloudsNumber then
     exit;
-vg:= VisualGearLayers[0];
-while vg <> nil do
-    if vg^.Kind = vgtCloud then
-        begin
-        tmp:= vg^.NextGear;
-        DeleteVisualGear(vg);
-        vg:= tmp
-        end
-    else vg:= vg^.NextGear;
-for i:= 0 to cSDCloudsNumber - 1 do
-    AddVisualGear(cLeftScreenBorder + i * LongInt(cScreenSpace div (cSDCloudsNumber + 1)), LAND_HEIGHT-1184, vgtCloud)
+for i:= 0 to 6 do
+    begin
+    vg:= VisualGearLayers[i];
+    while vg <> nil do
+        if vg^.Kind = vgtCloud then
+            begin
+            tmp:= vg^.NextGear;
+            DeleteVisualGear(vg);
+            vg:= tmp
+            end
+        else vg:= vg^.NextGear;
+    for j:= 0 to cSDCloudsNumber - 1 do
+        AddVisualGear(cLeftScreenBorder + j * LongInt(cScreenSpace div (cSDCloudsNumber + 1)), LAND_HEIGHT-1184, vgtCloud)
+    end;
 end;
 
 procedure AddFlakes;