Show “Empty!” when collecting ammo crate with amNothing or 0 ammo
authorWuzzy <almikes@aol.com>
Thu, 21 Sep 2017 03:07:29 +0200
changeset 12469 39d780f9bf35
parent 12468 3223ae85fba3
child 12470 c8ee50955fae
Show “Empty!” when collecting ammo crate with amNothing or 0 ammo
hedgewars/uGearsHedgehog.pas
hedgewars/uTypes.pas
share/hedgewars/Data/Locale/de.txt
share/hedgewars/Data/Locale/en.txt
--- 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;
 
--- a/hedgewars/uTypes.pas	Thu Sep 21 01:59:49 2017 +0200
+++ b/hedgewars/uTypes.pas	Thu Sep 21 03:07:29 2017 +0200
@@ -465,7 +465,7 @@
             sidNoEndTurn, sidNotYetAvailable, sidRoundSD, sidRoundsSD, sidReady,
             sidBounce1, sidBounce2, sidBounce3, sidBounce4, sidBounce5, sidBounce,
             sidMute, sidAFK, sidAutoCameraOff, sidAutoCameraOn, sidPressTarget,
-            sidNotAvailableInSD, sidHealthGain);
+            sidNotAvailableInSD, sidHealthGain, sidEmptyCrate);
 
     // Events that are important for the course of the game or at least interesting for other reasons
     TEventId = (eidDied, eidDrowned, eidRoundStart, eidRoundWin, eidRoundDraw,
--- a/share/hedgewars/Data/Locale/de.txt	Thu Sep 21 01:59:49 2017 +0200
+++ b/share/hedgewars/Data/Locale/de.txt	Thu Sep 21 03:07:29 2017 +0200
@@ -92,6 +92,7 @@
 01:25=Zieltaste drücken, um das Ziel zu markieren
 01:26=Werkzeug nicht verfügbar im Sudden Death
 01:27=+%1
+01:28=Leer!
 
 ; Event messages
 ; Hog (%1) died
--- a/share/hedgewars/Data/Locale/en.txt	Thu Sep 21 01:59:49 2017 +0200
+++ b/share/hedgewars/Data/Locale/en.txt	Thu Sep 21 03:07:29 2017 +0200
@@ -91,6 +91,7 @@
 01:26=The utility is unavailable in Sudden Death
 ; E.g. “+25” when gaining health from crate or vampirism
 01:27=+%1
+01:28=Empty!
 
 ; Event messages
 ; Normal hog (%1) died (0 health)