hedgewars/uScript.pas
changeset 9656 18422d205080
parent 9648 3a3defce1b28
child 9670 1954f692e8c6
--- a/hedgewars/uScript.pas	Tue Oct 29 23:47:57 2013 +0400
+++ b/hedgewars/uScript.pas	Wed Oct 30 00:18:10 2013 +0400
@@ -781,8 +781,6 @@
     team : PTeam;
     hh   : THedgehog;
     i, j : LongInt;
-    r, rr: TSDL_Rect;
-    texsurf: PSDL_Surface;
 begin
     if lua_gettop(L) <> 2 then
         LuaError('Lua: Wrong number of parameters passed to SetClanColor!')
@@ -790,6 +788,7 @@
         begin
         clan := ClansArray[lua_tointeger(L, 1)];
         clan^.Color:= lua_tointeger(L, 2) shr 8;
+
         for i:= 0 to Pred(clan^.TeamsNumber) do
             begin
             team:= clan^.Teams[i];
@@ -805,24 +804,11 @@
                 end;
             FreeTexture(team^.NameTagTex);
             team^.NameTagTex:= RenderStringTex(clan^.Teams[i]^.TeamName, clan^.Color, fnt16);
-            r.w:= cTeamHealthWidth + 5;
-            r.h:= team^.NameTagTex^.h;
-
-            texsurf:= SDL_CreateRGBSurface(SDL_SWSURFACE, r.w, r.h, 32, RMask, GMask, BMask, AMask);
-            TryDo(texsurf <> nil, errmsgCreateSurface, true);
-            TryDo(SDL_SetColorKey(texsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true);
+            end;
 
-            DrawRoundRect(@r, cWhiteColor, cNearBlackColor, texsurf, true);
-            rr:= r;
-            inc(rr.x, 2); dec(rr.w, 4); inc(rr.y, 2); dec(rr.h, 4);
-            DrawRoundRect(@rr, clan^.Color, clan^.Color, texsurf, false);
+        clan^.HealthTex:= makeHealthBarTexture(cTeamHealthWidth + 5, clan^.Teams[0]^.NameTagTex^.h, clan^.Color);
+        end;
 
-            FreeTexture(team^.HealthTex);
-            team^.HealthTex:= Surface2Tex(texsurf, false);
-            SDL_FreeSurface(texsurf);
-            MakeCrossHairs
-            end
-        end;
     lc_setclancolor:= 0
 end;
 
@@ -1898,7 +1884,6 @@
 
 
 function lc_declareachievement(L : Plua_State) : LongInt; Cdecl;
-var gear: PGear;
 begin
     if lua_gettop(L) <> 4 then
         LuaError('Lua: Wrong number of parameters passed to DeclareAchievement!')