Keep rope/jetpack/parachute selected when destroyed and having secondary ammo selected
authorWuzzy <almikes@aol.com>
Wed, 11 Oct 2017 23:01:07 +0200
changeset 12692 cb6b70392459
parent 12691 286afe079117
child 12693 2592c6ea6008
Keep rope/jetpack/parachute selected when destroyed and having secondary ammo selected Assumption: You rope with secondary ammo selected. You miss a shot, destroying the rope gear. Previous behaviour: Rope gets deselected and the secondary ammo gets selected, you can no longer rope. Very annoying, reason of many Shoppa fails! New behaviour: Rope stays selected, but selection of secondary ammo is cleared (because rope gear got destroyed). Makes much more sense overall. Analog for jetpack and parachute.
ChangeLog.txt
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsHandlersRope.pas
--- a/ChangeLog.txt	Wed Oct 11 20:16:00 2017 +0200
+++ b/ChangeLog.txt	Wed Oct 11 23:01:07 2017 +0200
@@ -30,6 +30,7 @@
  + Small visual effects enhancements
  + Briefly show theme and music authors in chat at start of game
  + A few new funny ticker messages (English)
+ + Keep rope / parachute / flying saucer selected when destroyed and secondary ammo selected
  * Fixed cursor often jumping back to screen center when putting target location while moving cursor
  * Fixed air-strikes drops being off-center
  * Gameplay fix: Hammer damage is now rounded down. This means it will cause NO DAMAGE to a hedgehog with less than 3 hp.
--- a/hedgewars/uGearsHandlersMess.pas	Wed Oct 11 20:16:00 2017 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Wed Oct 11 23:01:07 2017 +0200
@@ -2616,6 +2616,8 @@
             State := State or gstMoving;
             end;
         DeleteGear(Gear);
+        if (GetAmmoEntry(HHGear^.Hedgehog^, TAmmoType(amParachute))^.Count >= 1) and (HHGear^.Hedgehog^.CurAmmoType <> amParachute) then
+            SetWeapon(amParachute);
         isCursorVisible := false;
         ApplyAmmoChanges(HHGear^.Hedgehog^);
         exit
@@ -4017,6 +4019,8 @@
                 State := State or gstMoving
                 end;
             DeleteGear(Gear);
+            if (GetAmmoEntry(HHGear^.Hedgehog^, TAmmoType(amJetpack))^.Count >= 1) and (HHGear^.Hedgehog^.CurAmmoType <> amJetpack) then
+                SetWeapon(amJetpack);
             isCursorVisible := false;
             ApplyAmmoChanges(HHGear^.Hedgehog^);
         //    if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
--- a/hedgewars/uGearsHandlersRope.pas	Wed Oct 11 20:16:00 2017 +0200
+++ b/hedgewars/uGearsHandlersRope.pas	Wed Oct 11 23:01:07 2017 +0200
@@ -449,6 +449,8 @@
         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
+            SetWeapon(amRope);
         exit()
         end;
 
@@ -541,6 +543,8 @@
                 Message := Message and (not gmAttack)
                 end;
         DeleteGear(Gear);
+        if GetAmmoEntry(HHGear^.Hedgehog^, TAmmoType(amRope))^.Count >= 1 then
+            SetWeapon(amRope);
         exit;
         end;
     if CheckGearDrowning(HHGear) then DeleteGear(Gear)