Fix desyncs when forcing rope re-selection after missing a shot or hitting bounce world edge
authorWuzzy <Wuzzy2@mail.ru>
Fri, 03 Nov 2017 05:03:47 +0100
changeset 12821 f3e07e53460d
parent 12820 4c1c468725ff
child 12822 f062a31fc8f2
Fix desyncs when forcing rope re-selection after missing a shot or hitting bounce world edge Also re-introduce rope-reselection when touching ground
hedgewars/uGearsHandlersRope.pas
--- a/hedgewars/uGearsHandlersRope.pas	Fri Nov 03 04:14:33 2017 +0100
+++ b/hedgewars/uGearsHandlersRope.pas	Fri Nov 03 05:03:47 2017 +0100
@@ -66,6 +66,8 @@
     or (TestCollisionYwithGear(HHGear, 1) <> 0) then
         begin
         DeleteGear(Gear);
+        if (TestCollisionYwithGear(HHGear, 1) <> 0) and (GetAmmoEntry(HHGear^.Hedgehog^, amRope)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
+            HHGear^.Hedgehog^.CurAmmoType:= amRope;
         isCursorVisible := false;
         ApplyAmmoChanges(HHGear^.Hedgehog^);
         exit
@@ -450,7 +452,9 @@
         HHGear^.Message := HHGear^.Message and (not gmAttack);
         DeleteGear(Gear);
         if (GetAmmoEntry(HHGear^.Hedgehog^, amRope)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
-            SetWeapon(amRope);
+            HHGear^.Hedgehog^.CurAmmoType:= amRope;
+        isCursorVisible := false;
+        ApplyAmmoChanges(HHGear^.Hedgehog^);
         exit()
         end;
 
@@ -544,7 +548,9 @@
                 end;
         DeleteGear(Gear);
         if (GetAmmoEntry(HHGear^.Hedgehog^, amRope)^.Count >= 1) and ((Ammoz[HHGear^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
-            SetWeapon(amRope);
+            HHGear^.Hedgehog^.CurAmmoType:= amRope;
+        isCursorVisible := false;
+        ApplyAmmoChanges(HHGear^.Hedgehog^);
         exit;
         end;
     if CheckGearDrowning(HHGear) then DeleteGear(Gear)