hedgewars/uWorld.pas
changeset 2360 d4d545da9dbe
parent 2359 76d853f22afa
child 2361 f980f40e83f5
--- a/hedgewars/uWorld.pas	Tue Sep 08 21:58:09 2009 +0000
+++ b/hedgewars/uWorld.pas	Wed Sep 09 01:55:37 2009 +0000
@@ -80,7 +80,7 @@
 
 procedure ShowAmmoMenu;
 const MENUSPEED = 15;
-var x, y, i, t, l: LongInt;
+var x, y, i, t, l, g: LongInt;
     Slot, Pos: LongInt;
 begin
 if (TurnTimeLeft = 0) or (((CurAmmoGear = nil) or ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) = 0)) and KbdKeyPressed) then bShowAmmoMenu:= false;
@@ -131,25 +131,30 @@
 			DrawSprite(sprAMSlot, x, y, 0);
 			DrawSprite(sprAMSlotKeys, x + 2, y + 1, i);
 			t:= 0;
-			while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) do
+            g:= 0;
+			while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do
 				begin
-				l:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
+                if (Ammo^[i, t].AmmoType <> amNothing) then
+                   begin
+                   l:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
 
-				if l >= 0 then
-					begin
-					DrawSprite(sprAMAmmosBW, x + t * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
-					DrawSprite(sprTurnsLeft, x + t * 33 + 51, y + 17, l);
-					end else
-					DrawSprite(sprAMAmmos, x + t * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
+                   if l >= 0 then
+                       begin
+                       DrawSprite(sprAMAmmosBW, x + g * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
+                       DrawSprite(sprTurnsLeft, x + g * 33 + 51, y + 17, l);
+                       end else
+                       DrawSprite(sprAMAmmos, x + g * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
 
-				if (Slot = i)
-				and (CursorPoint.X >= x + t * 33 + 35)
-				and (CursorPoint.X < x + t * 33 + 68) then
-					begin
-					if (l < 0) then DrawSprite(sprAMSelection, x + t * 33 + 35, y + 1, 0);
-					Pos:= t;
-					end;
-				inc(t)
+                   if (Slot = i)
+                   and (CursorPoint.X >= x + g * 33 + 35)
+                   and (CursorPoint.X < x + g * 33 + 68) then
+                       begin
+                       if (l < 0) then DrawSprite(sprAMSelection, x + g * 33 + 35, y + 1, 0);
+                       Pos:= t;
+                       end;
+                   inc(g)
+                   end;
+                   inc(t)
 				end
 			end;
 	dec(y, 1);