hedgewars/uGearsHedgehog.pas
changeset 12469 39d780f9bf35
parent 12468 3223ae85fba3
child 12497 47be9f3e61e9
--- a/hedgewars/uGearsHedgehog.pas	Thu Sep 21 01:59:49 2017 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Thu Sep 21 03:07:29 2017 +0200
@@ -688,18 +688,27 @@
             name:= trluaammo[Ammoz[ammo].NameId]
         else
             name:= trammo[Ammoz[ammo].NameId];
-        if cnt >= AMMO_INFINITE then
+
+        if cnt = 0 then
+            cnt:= Ammoz[ammo].NumberInCase;
+
+        if (ammo = amNothing) or (cnt = 0) then
+            s:= ansistring(trmsg[sidEmptyCrate])
+        else if cnt >= AMMO_INFINITE then
             s:= name + ansistring(' (+∞)')
-        else if cnt <> 0 then
-            s:= name + ansistring(' (+' + IntToStr(cnt) + ')')
         else
-            s:= name + ansistring(' (+' + IntToStr(Ammoz[ammo].NumberInCase) + ')');
+            s:= name + ansistring(' (+' + IntToStr(cnt) + ')');
+
         AddCaption(s, HH.Team^.Clan^.Color, capgrpAmmoinfo);
 
-        // show ammo icon
-        vga:= AddVisualGear(X, Y, vgtAmmo);
-        if vga <> nil then
-            vga^.Frame:= Longword(ammo);
+        // show ammo icon (if not empty)
+        if (ammo <> amNothing) and (cnt <> 0) then
+            begin
+            vga:= AddVisualGear(X, Y, vgtAmmo);
+            if vga <> nil then
+                vga^.Frame:= Longword(ammo);
+            end
+
         end;
 end;