Fix birdy flight bug
authornemo
Wed, 19 Oct 2011 21:50:03 -0400
changeset 6154 72c6239a7cc6
parent 6153 3881126e06e8
child 6155 930c3be58e1e
Fix birdy flight bug
hedgewars/GSHandlers.inc
--- 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