hedgewars/uScript.pas
changeset 14666 9e7092e5990a
parent 14663 bc4296649bbf
child 14771 ab7bf5036314
--- a/hedgewars/uScript.pas	Mon Jan 21 06:48:12 2019 +0100
+++ b/hedgewars/uScript.pas	Mon Jan 21 07:10:59 2019 +0100
@@ -1358,8 +1358,7 @@
 function lc_setclancolor(L : Plua_State) : LongInt; Cdecl;
 var clan : PClan;
     team : PTeam;
-    hht  : THedgehog;
-    hhp  : PHedgehog;
+    hh  : THedgehog;
     i, j : LongInt;
     colorArg: Int64;
     color: LongWord;
@@ -1390,17 +1389,13 @@
             team:= clan^.Teams[i];
             for j:= 0 to cMaxHHIndex do
                 begin
-                hht:= team^.Hedgehogs[j];
-                hhp:= nil;
-                if (hht.Gear <> nil) then
-                    hhp:= team^.Hedgehogs[j].Gear^.Hedgehog
-                else if (hht.GearHidden <> nil) then
-                    hhp:= team^.Hedgehogs[j].GearHidden^.Hedgehog;
-                if (hhp <> nil) then
+                hh:= team^.Hedgehogs[j];
+                if (hh.Gear <> nil) or (hh.GearHidden <> nil) then
                     begin
-                    FreeAndNilTexture(hhp^.NameTagTex);
-                    hhp^.NameTagTex:= RenderStringTex(ansistring(hhp^.Name), clan^.Color, fnt16);
-                    RenderHealth(hhp^);
+                    FreeAndNilTexture(hh.NameTagTex);
+                    hh.NameTagTex:= RenderStringTex(ansistring(hh.Name), clan^.Color, fnt16);
+                    RenderHealth(hh);
+                    team^.Hedgehogs[j]:= hh;
                     end;
                 end;
             FreeAndNilTexture(team^.NameTagTex);