Properly prevent using airstrike or girder in mid-air
authorWuzzy <Wuzzy2@mail.ru>
Sun, 02 Jun 2019 17:02:24 +0200
changeset 15114 8cb1eebee4a0
parent 15113 ba9d54d1c25d
child 15115 42a8656afcac
Properly prevent using airstrike or girder in mid-air
hedgewars/uIO.pas
hedgewars/uVariables.pas
--- a/hedgewars/uIO.pas	Sat Jun 01 00:27:23 2019 +0200
+++ b/hedgewars/uIO.pas	Sun Jun 02 17:02:24 2019 +0200
@@ -39,7 +39,7 @@
 procedure doPut(putX, putY: LongInt; fromAI: boolean);
 
 implementation
-uses uConsole, uConsts, uVariables, uCommands, uUtils, uDebug, uLocale;
+uses uConsole, uConsts, uVariables, uCommands, uUtils, uDebug, uLocale, uSound;
 
 const
     cSendEmptyPacketTime = 1000;
@@ -512,6 +512,7 @@
 with CurrentHedgehog^.Gear^,
     CurrentHedgehog^ do
     if (State and gstChooseTarget) <> 0 then
+        if ((((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0) or ((State and gstMoving) = 0)) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackingPut) = 0)) then
         begin
         if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoTargetAfter) <> 0 then
             isCursorVisible:= false;
@@ -543,6 +544,8 @@
         if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackingPut) <> 0 then
             Message:= Message or (gmAttack and InputMask);
         end
+        else
+            PlaySound(sndDenied)
     else
         if CurrentTeam^.ExtDriven then
             OutError('Got /put while not being in choose target mode', false)
--- a/hedgewars/uVariables.pas	Sat Jun 01 00:27:23 2019 +0200
+++ b/hedgewars/uVariables.pas	Sun Jun 02 17:02:24 2019 +0200
@@ -1441,6 +1441,7 @@
                           ammoprop_NoCrosshair or
                           ammoprop_NeedTarget or
                           ammoprop_AttackingPut or
+                          ammoprop_AttackInMove or
                           ammoprop_Utility or
                           ammoprop_DontHold;
                 Count: 2;