hedgewars/uGearsHandlersMess.pas
changeset 13999 996ef4c5d064
parent 13990 1670fc3957df
child 14001 755f389a1e73
--- a/hedgewars/uGearsHandlersMess.pas	Fri Oct 26 23:04:46 2018 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Fri Oct 26 22:46:37 2018 +0200
@@ -3738,8 +3738,19 @@
 procedure doStepSeductionWork(Gear: PGear);
 var i: LongInt;
     hogs: PGearArrayS;
+    HHGear: PGear;
 begin
     AllInactive := false;
+
+    HHGear := Gear^.Hedgehog^.Gear;
+    if (HHGear <> nil) and ((HHGear^.State and gstHHDriven) = 0) then
+        begin
+        StopSound(sndYoohoo);
+        AfterAttack;
+        DeleteGear(Gear);
+        exit;
+        end;
+
     hogs := GearsNear(Gear^.X, Gear^.Y, gtHedgehog, Gear^.Radius);
     if hogs.size > 0 then
         begin
@@ -3759,8 +3770,9 @@
                 else if Hedgehog^.Effects[heFrozen] > 255 then
                     Hedgehog^.Effects[heFrozen]:= 255
         end ;
-        AfterAttack;
-        DeleteGear(Gear);
+    AfterAttack;
+    DeleteGear(Gear);
+
 (*
     Gear^.X := Gear^.X + Gear^.dX;
     Gear^.Y := Gear^.Y + Gear^.dY;
@@ -3788,8 +3800,19 @@
 
 procedure doStepSeductionWear(Gear: PGear);
 var heart: PVisualGear;
+    HHGear: PGear;
 begin
     AllInactive := false;
+
+    HHGear := Gear^.Hedgehog^.Gear;
+    if (HHGear <> nil) and ((HHGear^.State and gstHHDriven) = 0) then
+        begin
+        StopSound(sndYoohoo);
+        AfterAttack;
+        DeleteGear(Gear);
+        exit;
+        end;
+
     inc(Gear^.Timer);
     if Gear^.Timer > 250 then
         begin