expose set clan color for Cairo. might also be useful for betrayals in campaign mode or somesuch
authornemo
Sat, 29 Jan 2011 14:54:08 -0500
changeset 4882 b4c84db92d8f
parent 4881 35e6269227b6
child 4883 7cddc9201a1d
expose set clan color for Cairo. might also be useful for betrayals in campaign mode or somesuch
hedgewars/uScript.pas
--- a/hedgewars/uScript.pas	Sat Jan 29 18:18:44 2011 +0100
+++ b/hedgewars/uScript.pas	Sat Jan 29 14:54:08 2011 -0500
@@ -548,6 +548,15 @@
     lc_getclancolor:= 1
 end;
 
+function lc_setclancolor(L : Plua_State) : LongInt; Cdecl;
+var gear : PGear;
+begin
+    if lua_gettop(L) <> 2 then
+        LuaError('Lua: Wrong number of parameters passed to SetClanColor!')
+    else ClansArray[lua_tointeger(L, 1)]^.Color:= lua_tointeger(L, 2) shr 8;
+    lc_setclancolor:= 0
+end;
+
 function lc_gethogteamname(L : Plua_State) : LongInt; Cdecl;
 var gear : PGear;
 begin
@@ -1604,6 +1613,7 @@
 lua_register(luaState, 'SetEffect', @lc_seteffect);
 lua_register(luaState, 'GetHogClan', @lc_gethogclan);
 lua_register(luaState, 'GetClanColor', @lc_getclancolor);
+lua_register(luaState, 'SetClanColor', @lc_setclancolor);
 lua_register(luaState, 'GetHogTeamName', @lc_gethogteamname);
 lua_register(luaState, 'GetHogName', @lc_gethogname);
 lua_register(luaState, 'GetHogLevel', @lc_gethoglevel);