don't let (am)Nothing change allowed aiming angles. e.g. fixes aiming problems when on last rope. please test for possible side effects (flying saucer and whatnot)
authorsheepluva
Mon, 25 Nov 2013 10:12:18 +0100
changeset 9717 b8b7ef99a084
parent 9716 f1698baccaef
child 9718 563a34cd8398
don't let (am)Nothing change allowed aiming angles. e.g. fixes aiming problems when on last rope. please test for possible side effects (flying saucer and whatnot)
hedgewars/uAmmos.pas
--- a/hedgewars/uAmmos.pas	Sun Nov 24 22:12:23 2013 -0500
+++ b/hedgewars/uAmmos.pas	Mon Nov 25 10:12:18 2013 +0100
@@ -322,18 +322,21 @@
 if Hedgehog.Gear <> nil then
     with Hedgehog do
         begin
-        CurMinAngle:= Ammoz[AmmoType].minAngle;
-        if Ammoz[AmmoType].maxAngle <> 0 then
-            CurMaxAngle:= Ammoz[AmmoType].maxAngle
-        else
-            CurMaxAngle:= cMaxAngle;
+        if (AmmoType <> amNothing) then
+            begin
+            CurMinAngle:= Ammoz[AmmoType].minAngle;
+            if Ammoz[AmmoType].maxAngle <> 0 then
+                CurMaxAngle:= Ammoz[AmmoType].maxAngle
+            else
+                CurMaxAngle:= cMaxAngle;
 
-        with Hedgehog.Gear^ do
-            begin
-            if Angle < CurMinAngle then
-                Angle:= CurMinAngle;
-            if Angle > CurMaxAngle then
-                Angle:= CurMaxAngle;
+            with Hedgehog.Gear^ do
+                begin
+                if Angle < CurMinAngle then
+                    Angle:= CurMinAngle;
+                if Angle > CurMaxAngle then
+                    Angle:= CurMaxAngle;
+                end
             end
         end
 end;
@@ -509,6 +512,8 @@
     RegisterVariable('ammreinf', @SetAmmoReinforcement, false);
     RegisterVariable('ammstore', @chAddAmmoStore , false);
 
+    CurMinAngle:= 0;
+    CurMaxAngle:= cMaxAngle;
     StoreCnt:= 0;
     ammoLoadout:= '';
     ammoProbability:= '';