hedgewars/uScript.pas
changeset 14666 9e7092e5990a
parent 14663 bc4296649bbf
child 14771 ab7bf5036314
equal deleted inserted replaced
14665:5fc5e4b79a5a 14666:9e7092e5990a
  1356 end;
  1356 end;
  1357 
  1357 
  1358 function lc_setclancolor(L : Plua_State) : LongInt; Cdecl;
  1358 function lc_setclancolor(L : Plua_State) : LongInt; Cdecl;
  1359 var clan : PClan;
  1359 var clan : PClan;
  1360     team : PTeam;
  1360     team : PTeam;
  1361     hht  : THedgehog;
  1361     hh  : THedgehog;
  1362     hhp  : PHedgehog;
       
  1363     i, j : LongInt;
  1362     i, j : LongInt;
  1364     colorArg: Int64;
  1363     colorArg: Int64;
  1365     color: LongWord;
  1364     color: LongWord;
  1366 begin
  1365 begin
  1367     if CheckLuaParamCount(L, 2, 'SetClanColor', 'clan, color') then
  1366     if CheckLuaParamCount(L, 2, 'SetClanColor', 'clan, color') then
  1388         for i:= 0 to Pred(clan^.TeamsNumber) do
  1387         for i:= 0 to Pred(clan^.TeamsNumber) do
  1389             begin
  1388             begin
  1390             team:= clan^.Teams[i];
  1389             team:= clan^.Teams[i];
  1391             for j:= 0 to cMaxHHIndex do
  1390             for j:= 0 to cMaxHHIndex do
  1392                 begin
  1391                 begin
  1393                 hht:= team^.Hedgehogs[j];
  1392                 hh:= team^.Hedgehogs[j];
  1394                 hhp:= nil;
  1393                 if (hh.Gear <> nil) or (hh.GearHidden <> nil) then
  1395                 if (hht.Gear <> nil) then
       
  1396                     hhp:= team^.Hedgehogs[j].Gear^.Hedgehog
       
  1397                 else if (hht.GearHidden <> nil) then
       
  1398                     hhp:= team^.Hedgehogs[j].GearHidden^.Hedgehog;
       
  1399                 if (hhp <> nil) then
       
  1400                     begin
  1394                     begin
  1401                     FreeAndNilTexture(hhp^.NameTagTex);
  1395                     FreeAndNilTexture(hh.NameTagTex);
  1402                     hhp^.NameTagTex:= RenderStringTex(ansistring(hhp^.Name), clan^.Color, fnt16);
  1396                     hh.NameTagTex:= RenderStringTex(ansistring(hh.Name), clan^.Color, fnt16);
  1403                     RenderHealth(hhp^);
  1397                     RenderHealth(hh);
       
  1398                     team^.Hedgehogs[j]:= hh;
  1404                     end;
  1399                     end;
  1405                 end;
  1400                 end;
  1406             FreeAndNilTexture(team^.NameTagTex);
  1401             FreeAndNilTexture(team^.NameTagTex);
  1407             team^.NameTagTex:= RenderStringTex(ansistring(clan^.Teams[i]^.TeamName), clan^.Color, fnt16);
  1402             team^.NameTagTex:= RenderStringTex(ansistring(clan^.Teams[i]^.TeamName), clan^.Color, fnt16);
  1408             end;
  1403             end;