hedgewars/GSHandlers.inc
changeset 6154 72c6239a7cc6
parent 6131 4e8816cf9459
child 6155 930c3be58e1e
--- a/hedgewars/GSHandlers.inc	Wed Oct 19 21:55:42 2011 +0200
+++ b/hedgewars/GSHandlers.inc	Wed Oct 19 21:50:03 2011 -0400
@@ -3696,7 +3696,12 @@
     fuel, i: LongInt;
     move: hwFloat;
 begin
-    HHGear := CurrentHedgehog^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
+    if HHGear = nil then 
+        begin
+        DeleteGear(Gear);
+        exit
+        end;
 
     move := _0_2;
     fuel := 50;
@@ -3788,13 +3793,13 @@
 begin
     if Gear^.Timer > 0 then
         dec(Gear^.Timer, 1)
-    else if CurrentHedgehog = nil then
+    else if Gear^.Hedgehog^.Gear = nil then
         begin
             DeleteGear(Gear);
             AfterAttack;
             exit
         end;
-    HHGear := CurrentHedgehog^.Gear;
+    HHGear := Gear^.Hedgehog^.Gear;
     HHGear^.Message := HHGear^.Message and not (gmUp or gmPrecise or gmLeft or gmRight);
     if abs(hwRound(HHGear^.Y - Gear^.Y)) > 32 then
     begin