Fix wrong team health bar height after calling SetClanColor
authorWuzzy <Wuzzy2@mail.ru>
Tue, 26 May 2020 23:02:49 +0200
changeset 15604 6a38a30e772a
parent 15603 ab095fc0256c
child 15605 e1078c72ad60
Fix wrong team health bar height after calling SetClanColor If you called SetClanColor on a team with a name that had a letter with a descender in it, then called SetClanColor on it, the height of the team bar is 1 pixel less than it should be because it was copied from the name texture.
hedgewars/uConsts.pas
hedgewars/uScript.pas
hedgewars/uStore.pas
--- a/hedgewars/uConsts.pas	Sun May 24 06:10:25 2020 +0300
+++ b/hedgewars/uConsts.pas	Tue May 26 23:02:49 2020 +0200
@@ -171,6 +171,7 @@
 
     cVisibleWater       : LongInt = 128;
     cTeamHealthWidth    : LongInt = 128;
+    cTeamHealthHeight   : LongInt = 19 * HDPIScaleFactor;
     cGearContourThreshold : LongInt = 179; // if water opacity is higher than this, draw contour for some gears when in water
 
     cifRandomize = $00000001;
--- a/hedgewars/uScript.pas	Sun May 24 06:10:25 2020 +0300
+++ b/hedgewars/uScript.pas	Tue May 26 23:02:49 2020 +0200
@@ -1403,7 +1403,7 @@
             end;
 
         FreeAndNilTexture(clan^.HealthTex);
-        clan^.HealthTex:= makeHealthBarTexture(cTeamHealthWidth + 5, clan^.Teams[0]^.NameTagTex^.h, clan^.Color);
+        clan^.HealthTex:= makeHealthBarTexture(cTeamHealthWidth + 5, cTeamHealthHeight, clan^.Color);
         end;
 
     lc_setclancolor:= 0
--- a/hedgewars/uStore.pas	Sun May 24 06:10:25 2020 +0300
+++ b/hedgewars/uStore.pas	Tue May 26 23:02:49 2020 +0200
@@ -327,9 +327,9 @@
 
 for t:= 0 to Pred(ClansCount) do
     with ClansArray[t]^ do
-        HealthTex:= makeHealthBarTexture(cTeamHealthWidth + 5, 19 * HDPIScaleFactor, Color);
+        HealthTex:= makeHealthBarTexture(cTeamHealthWidth + 5, cTeamHealthHeight, Color);
 
-GenericHealthTexture:= makeHealthBarTexture(cTeamHealthWidth + 5, 19 * HDPIScaleFactor, cWhiteColor)
+GenericHealthTexture:= makeHealthBarTexture(cTeamHealthWidth + 5, cTeamHealthHeight, cWhiteColor)
 end;