hedgewars/uAmmos.pas
changeset 6990 40e5af28d026
parent 6924 57b66ee3bff3
child 7037 7edce323558f
--- a/hedgewars/uAmmos.pas	Wed May 02 11:28:38 2012 +0200
+++ b/hedgewars/uAmmos.pas	Wed May 02 10:53:13 2012 +0100
@@ -145,13 +145,13 @@
 
 function GetAmmoByNum(num: Longword): PHHAmmo;
 begin
-TryDo(num < StoreCnt, 'Invalid store number', true);
-exit(StoresList[num])
+    TryDo(num < StoreCnt, 'Invalid store number', true);
+    GetAmmoByNum:= StoresList[num]
 end;
 
 function GetCurAmmoEntry(var Hedgehog: THedgehog): PAmmo;
 begin
-GetCurAmmoEntry:= GetAmmoEntry(Hedgehog, Hedgehog.CurAmmoType)
+    GetCurAmmoEntry:= GetAmmoEntry(Hedgehog, Hedgehog.CurAmmoType)
 end;
 
 function GetAmmoEntry(var Hedgehog: THedgehog; am: TAmmoType): PAmmo;
@@ -280,18 +280,21 @@
 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): LongWord;
 var slot, ami: LongInt;
 begin
-Slot:= Ammoz[Ammo].Slot;
-ami:= 0;
-while (ami <= cMaxSlotAmmoIndex) do
-        begin
+    HHHasAmmo:= 0;
+    Slot:= Ammoz[Ammo].Slot;
+    ami:= 0;
+    while (ami <= cMaxSlotAmmoIndex) do
+    begin
         with Hedgehog.Ammo^[Slot, ami] do
             if (AmmoType = Ammo) then
                 if Hedgehog.Team^.Clan^.TurnNumber > Ammoz[AmmoType].SkipTurns then
-                    exit(Count)
-                else exit(0);
-      inc(ami)
-      end;
-HHHasAmmo:= 0
+                begin
+                    HHHasAmmo:= Count;
+                    exit;
+                end
+                else exit;
+        inc(ami)
+    end;
 end;
 
 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);