hedgewars/uGears.pas
changeset 7395 d0d38cd0d27c
parent 7391 588eabb4b384
child 7400 09427dbec1d8
--- a/hedgewars/uGears.pas	Mon Jul 16 23:12:59 2012 +0400
+++ b/hedgewars/uGears.pas	Mon Jul 16 23:46:44 2012 +0400
@@ -182,7 +182,7 @@
 end;
 
 procedure ProcessGears;
-var Gear, t: PGear;
+var t: PGear;
     i, AliveCount: LongInt;
     s: shortstring;
 begin
@@ -203,21 +203,22 @@
 t:= GearsList;
 while t <> nil do
     begin
-    Gear:= t;
-    t:= Gear^.NextGear;
+    curHandledGear:= t;
+    t:= curHandledGear^.NextGear;
 
-    if Gear^.Active then
+    if curHandledGear^.Active then
         begin
-        if Gear^.RenderTimer and (Gear^.Timer > 500) and ((Gear^.Timer mod 1000) = 0) then
+        if curHandledGear^.RenderTimer and (curHandledGear^.Timer > 500) and ((curHandledGear^.Timer mod 1000) = 0) then
             begin
-            FreeTexture(Gear^.Tex);
-            Gear^.Tex:= RenderStringTex(inttostr(Gear^.Timer div 1000), cWhiteColor, fntSmall);
+            FreeTexture(curHandledGear^.Tex);
+            curHandledGear^.Tex:= RenderStringTex(inttostr(curHandledGear^.Timer div 1000), cWhiteColor, fntSmall);
             end;
-        Gear^.doStep(Gear);
+        curHandledGear^.doStep(curHandledGear);
         // might be useful later
         //ScriptCall('onGearStep', Gear^.uid);
         end
     end;
+curHandledGear:= nil;
 
 if AllInactive then
 case step of
@@ -1323,6 +1324,8 @@
 
     CurAmmoGear:= nil;
     GearsList:= nil;
+    curHandledGear:= nil;
+
     KilledHHs:= 0;
     SuddenDeath:= false;
     SuddenDeathDmg:= false;