Don't switch back to rope/chute/jetpack if selected ammo is not ammoprop_AltUse
authorWuzzy <almikes@aol.com>
Fri, 13 Oct 2017 17:09:45 +0200
changeset 12700 16fcd59295e3
parent 12699 608db0fb90f0
child 12701 79e13080b9db
Don't switch back to rope/chute/jetpack if selected ammo is not ammoprop_AltUse This fixes a regression like that you can't shoryuken after rope.
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsHandlersRope.pas
--- a/hedgewars/uGearsHandlersMess.pas	Thu Oct 12 20:30:39 2017 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Fri Oct 13 17:09:45 2017 +0200
@@ -2616,7 +2616,7 @@
             State := State or gstMoving;
             end;
         DeleteGear(Gear);
-        if (GetAmmoEntry(HHGear^.Hedgehog^, TAmmoType(amParachute))^.Count >= 1) and (HHGear^.Hedgehog^.CurAmmoType <> amParachute) then
+        if (GetAmmoEntry(HHGear^.Hedgehog^, amParachute)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
             SetWeapon(amParachute);
         isCursorVisible := false;
         ApplyAmmoChanges(HHGear^.Hedgehog^);
@@ -4019,7 +4019,7 @@
                 State := State or gstMoving
                 end;
             DeleteGear(Gear);
-            if (GetAmmoEntry(HHGear^.Hedgehog^, TAmmoType(amJetpack))^.Count >= 1) and (HHGear^.Hedgehog^.CurAmmoType <> amJetpack) then
+            if (GetAmmoEntry(HHGear^.Hedgehog^, amJetpack)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
                 SetWeapon(amJetpack);
             isCursorVisible := false;
             ApplyAmmoChanges(HHGear^.Hedgehog^);
--- a/hedgewars/uGearsHandlersRope.pas	Thu Oct 12 20:30:39 2017 +0200
+++ b/hedgewars/uGearsHandlersRope.pas	Fri Oct 13 17:09:45 2017 +0200
@@ -66,7 +66,7 @@
     or (TestCollisionYwithGear(HHGear, 1) <> 0) then
         begin
         DeleteGear(Gear);
-        if (TestCollisionYwithGear(HHGear, 1) <> 0) and (GetAmmoEntry(HHGear^.Hedgehog^, amRope)^.Count >= 1) and (HHGear^.Hedgehog^.CurAmmoType <> amRope) then
+        if (TestCollisionYwithGear(HHGear, 1) <> 0) and (GetAmmoEntry(HHGear^.Hedgehog^, amRope)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
             SetWeapon(amRope);
         isCursorVisible := false;
         ApplyAmmoChanges(HHGear^.Hedgehog^);
@@ -451,7 +451,7 @@
         HHGear^.State := HHGear^.State and (not (gstAttacking or gstHHJumping or gstHHHJump));
         HHGear^.Message := HHGear^.Message and (not gmAttack);
         DeleteGear(Gear);
-        if (GetAmmoEntry(HHGear^.Hedgehog^, amRope)^.Count >= 1) and (HHGear^.Hedgehog^.CurAmmoType <> amRope) then
+        if (GetAmmoEntry(HHGear^.Hedgehog^, amRope)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
             SetWeapon(amRope);
         exit()
         end;
@@ -545,7 +545,7 @@
                 Message := Message and (not gmAttack)
                 end;
         DeleteGear(Gear);
-        if GetAmmoEntry(HHGear^.Hedgehog^, TAmmoType(amRope))^.Count >= 1 then
+        if (GetAmmoEntry(HHGear^.Hedgehog^, amRope)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
             SetWeapon(amRope);
         exit;
         end;