hedgewars/uAmmos.pas
branchwebgl
changeset 9950 2759212a27de
parent 9521 8054d9d775fd
parent 9717 b8b7ef99a084
child 10015 4feced261c68
--- a/hedgewars/uAmmos.pas	Fri Oct 11 17:43:13 2013 +0200
+++ b/hedgewars/uAmmos.pas	Sat Jan 04 23:55:54 2014 +0400
@@ -224,6 +224,7 @@
     CurWeapon: PAmmo;
     a: TAmmoType;
 begin
+if ammo = amNothing then exit;
 {$HINTS OFF}
 FillChar(ammos, sizeof(ammos), 0);
 {$HINTS ON}
@@ -321,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;
@@ -508,6 +512,8 @@
     RegisterVariable('ammreinf', @SetAmmoReinforcement, false);
     RegisterVariable('ammstore', @chAddAmmoStore , false);
 
+    CurMinAngle:= 0;
+    CurMaxAngle:= cMaxAngle;
     StoreCnt:= 0;
     ammoLoadout:= '';
     ammoProbability:= '';