hedgewars/uScript.pas
changeset 8370 0c79946e96f8
parent 8368 6feae8073965
child 8444 75db7bb8dce8
child 8460 75e771c3c039
equal deleted inserted replaced
8369:31033e521653 8370:0c79946e96f8
   228 function lc_enablegameflags(L : Plua_State) : LongInt; Cdecl;
   228 function lc_enablegameflags(L : Plua_State) : LongInt; Cdecl;
   229 var i : integer;
   229 var i : integer;
   230 begin
   230 begin
   231     for i:= 1 to lua_gettop(L) do
   231     for i:= 1 to lua_gettop(L) do
   232         if (GameFlags and lua_tointeger(L, i)) = 0 then
   232         if (GameFlags and lua_tointeger(L, i)) = 0 then
   233             GameFlags := GameFlags + lua_tointeger(L, i);
   233             GameFlags := GameFlags + LongWord(lua_tointeger(L, i));
   234     ScriptSetInteger('GameFlags', GameFlags);
   234     ScriptSetInteger('GameFlags', GameFlags);
       
   235     lc_enablegameflags:= 0;
   235 end;
   236 end;
   236 
   237 
   237 function lc_disablegameflags(L : Plua_State) : LongInt; Cdecl;
   238 function lc_disablegameflags(L : Plua_State) : LongInt; Cdecl;
   238 var i : integer;
   239 var i : integer;
   239 begin
   240 begin
   240     for i:= 1 to lua_gettop(L) do
   241     for i:= 1 to lua_gettop(L) do
   241         if (GameFlags and lua_tointeger(L, i)) <> 0 then
   242         if (GameFlags and lua_tointeger(L, i)) <> 0 then
   242             GameFlags := GameFlags - lua_tointeger(L, i);
   243             GameFlags := GameFlags - LongWord(lua_tointeger(L, i));
   243     ScriptSetInteger('GameFlags', GameFlags);
   244     ScriptSetInteger('GameFlags', GameFlags);
       
   245     lc_disablegameflags:= 0;
   244 end;
   246 end;
   245 
   247 
   246 function lc_cleargameflags(L : Plua_State) : LongInt; Cdecl;
   248 function lc_cleargameflags(L : Plua_State) : LongInt; Cdecl;
   247 begin
   249 begin
       
   250     // Silence hint
       
   251     L:= L;
   248     GameFlags:= 0;
   252     GameFlags:= 0;
   249     ScriptSetInteger('GameFlags', GameFlags);
   253     ScriptSetInteger('GameFlags', GameFlags);
       
   254     lc_cleargameflags:= 0;
   250 end;
   255 end;
   251 
   256 
   252 function lc_addcaption(L : Plua_State) : LongInt; Cdecl;
   257 function lc_addcaption(L : Plua_State) : LongInt; Cdecl;
   253 begin
   258 begin
   254     if lua_gettop(L) = 1 then
   259     if lua_gettop(L) = 1 then
  1758         end;
  1763         end;
  1759     lc_hidehog := 0;
  1764     lc_hidehog := 0;
  1760 end;
  1765 end;
  1761 
  1766 
  1762 function lc_restorehog(L: Plua_State): LongInt; Cdecl;
  1767 function lc_restorehog(L: Plua_State): LongInt; Cdecl;
  1763 var hog: PHedgehog;
  1768 var i, h: LongInt;
  1764     i, h: LongInt;
       
  1765     uid: LongWord;
  1769     uid: LongWord;
  1766 begin
  1770 begin
  1767     if lua_gettop(L) <> 1 then
  1771     if lua_gettop(L) <> 1 then
  1768         LuaError('Lua: Wrong number of parameters passed to RestoreHog!')
  1772         LuaError('Lua: Wrong number of parameters passed to RestoreHog!')
  1769     else
  1773     else