hedgewars/GSHandlers.inc
changeset 5738 a81fc23356e7
parent 5728 aca2acfba4ca
child 5748 70d7f8e40f53
--- a/hedgewars/GSHandlers.inc	Fri Sep 02 08:16:34 2011 -0400
+++ b/hedgewars/GSHandlers.inc	Fri Sep 02 09:25:43 2011 -0400
@@ -4940,10 +4940,13 @@
             HH^.GearHidden:= HH^.Gear;
             HH^.Gear:= nil
             end
-        else if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible <> 0) then
+        //else if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible <> 0) then
+        else if (HH^.GearHidden <> nil) then// and (HH^.Gear^.State and gstInvisible <> 0) then
             begin
+            HH^.Gear:=HH^.GearHidden;
+            HH^.GearHidden:= nil;
             InsertGearToList(HH^.Gear);
-            HH^.Gear^.State:= HH^.Gear^.State and not (gstHHDriven or gstInvisible);
+            HH^.Gear^.State:= (HH^.Gear^.State and not (gstHHDriven or gstInvisible or gstAttacking)) or gstAttacked;
             AddGearCI(HH^.Gear);
             HH^.Gear^.Active:= true
             end;
@@ -4991,11 +4994,11 @@
         if HH^.GearHidden <> nil then FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH,true);
         if HH^.GearHidden <> nil then 
             begin
-            HH^.Gear:=HH^.GearHidden;
-            HH^.GearHidden:= nil;
-            HH^.Gear^.State:= HH^.Gear^.State or gstInvisible;
-            Gear^.X:= HH^.Gear^.X;
-            Gear^.Y:= HH^.Gear^.Y;
+            Gear^.X:= HH^.GearHidden^.X;
+            Gear^.Y:= HH^.GearHidden^.Y;
+            //HH^.Gear:=HH^.GearHidden;
+            //HH^.GearHidden:= nil;
+            //HH^.Gear^.State:= HH^.Gear^.State or gstInvisible;
             end
         end
     else dec(Gear^.Timer);