Fix buggy kamikaze when hog took damage during short waiting phase at start
authorWuzzy <Wuzzy2@mail.ru>
Mon, 24 Jun 2019 11:25:15 +0200
changeset 15217 a0bb57d3d272
parent 15216 7d41e7889123
child 15218 30117eeea7b7
Fix buggy kamikaze when hog took damage during short waiting phase at start
ChangeLog.txt
hedgewars/uGearsHandlersMess.pas
--- a/ChangeLog.txt	Sun Jun 23 16:14:27 2019 +0200
+++ b/ChangeLog.txt	Mon Jun 24 11:25:15 2019 +0200
@@ -40,6 +40,7 @@
  * Fix hog floating when switching to moving hog
  * Fix jump key not being ignored after placing girder or target
  * Explode hog instantly when taking damage while dying
+ * Fix buggy hog when hog took damage during "idle" phase in kamikaze attack
 
 Styles and schemes:
  + The Specialists: Unlock game scheme
--- a/hedgewars/uGearsHandlersMess.pas	Sun Jun 23 16:14:27 2019 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Mon Jun 24 11:25:15 2019 +0200
@@ -3614,9 +3614,20 @@
 end;
 
 procedure doStepKamikazeIdle(Gear: PGear);
+var HHGear: PGear;
 begin
     AllInactive := false;
     dec(Gear^.Timer);
+    HHGear := Gear^.Hedgehog^.Gear;
+    if (HHGear = nil) or (HHGear^.Damage <> 0) then
+        begin
+        if (HHGear <> nil) then
+            AfterAttack;
+        ClearHitOrder();
+        ClearProximityCache();
+        DeleteGear(Gear);
+        exit;
+        end;
     if Gear^.Timer = 0 then
         begin
         Gear^.Pos := 1;