Fix health crate health display not respecting Karma value properly
authorWuzzy <Wuzzy2@mail.ru>
Sun, 07 Apr 2019 23:39:30 +0200
changeset 14761 1b82538970ca
parent 14760 75bd27700837
child 14762 e2c041b00594
Fix health crate health display not respecting Karma value properly
hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGearsHandlersMess.pas	Sun Apr 07 23:32:59 2019 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Sun Apr 07 23:39:30 2019 +0200
@@ -2482,15 +2482,24 @@
             begin
             FreeAndNilTexture(Gear^.Tex);
             if ((Gear^.State and gstFrozen) = 0) then
+                begin
                 // Karma=2: Always hide health
                 if (Gear^.Karma = 2) then
-                    Gear^.Tex := RenderStringTex(ansistring(trmsg[sidUnknownGearValue]), $ff80ff80, fnt16)
+                    i:= 0
                 // Karma=1: Hide health in game, but show in demo
-                else if (Gear^.Karma = 1) and (GameType in [gmtDemo, gmtRecord]) then
-                    Gear^.Tex := RenderStringTex(ansistring(trmsg[sidUnknownGearValue]), $ff80ff80, fnt16)
+                else if (Gear^.Karma = 1) then
+                    if (GameType in [gmtDemo, gmtRecord]) then
+                        i:= 1
+                    else
+                        i:= 0
                 // Always show health (default)
                 else
-                    Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16);
+                    i:= 1;
+                if i = 1 then
+                    Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16)
+                else
+                    Gear^.Tex := RenderStringTex(ansistring(trmsg[sidUnknownGearValue]), $ff80ff80, fnt16)
+                end;
             end;
         if Gear^.Timer = 500 then
             begin