--- a/hedgewars/uScript.pas Wed Nov 07 23:04:29 2012 -0500
+++ b/hedgewars/uScript.pas Thu Nov 08 15:54:11 2012 -0500
@@ -1727,36 +1727,29 @@
else
begin
gear:= GearByUID(lua_tointeger(L, 1));
- hiddenHedgehogs[hiddenHedgehogsNumber]:=gear^.hedgehog;
- inc(hiddenHedgehogsNumber);
- HideHog(gear^.hedgehog);
+ HideHog(gear^.hedgehog)
end;
lc_hidehog := 0;
end;
function lc_restorehog(L: Plua_State): LongInt; Cdecl;
var hog: PHedgehog;
- i, j: LongInt;
+ i, h: LongInt;
+ uid: LongWord;
begin
if lua_gettop(L) <> 1 then
LuaError('Lua: Wrong number of parameters passed to RestoreHog!')
else
begin
- i := 0;
- while (i < hiddenHedgehogsNumber) do
- begin
- if hiddenHedgehogs[i]^.gearHidden^.uid = LongWord(lua_tointeger(L, 1)) then
- begin
- hog := hiddenHedgehogs[i];
- RestoreHog(hog);
- dec(hiddenHedgehogsNumber);
- for j := i to hiddenHedgehogsNumber - 1 do
- hiddenHedgehogs[j] := hiddenHedgehogs[j + 1];
- lc_restorehog := 0;
- exit;
- end;
- inc(i);
- end;
+ uid:= LongWord(lua_tointeger(L, 1));
+ if TeamsCount > 0 then
+ for i:= 0 to Pred(TeamsCount) do
+ for h:= 0 to cMaxHHIndex do
+ if (TeamsArray[i]^.Hedgehogs[h].GearHidden <> nil) and (TeamsArray[i]^.Hedgehogs[h].GearHidden^.uid = uid) then
+ begin
+ RestoreHog(@TeamsArray[i]^.Hedgehogs[h]);
+ exit(0)
+ end
end;
lc_restorehog := 0;
end;
--- a/hedgewars/uVariables.pas Wed Nov 07 23:04:29 2012 -0500
+++ b/hedgewars/uVariables.pas Thu Nov 08 15:54:11 2012 -0500
@@ -196,8 +196,6 @@
hiTicks: Word;
LuaGoals : shortstring;
- hiddenHedgehogs : array [0..cMaxHHs] of PHedgehog;
- hiddenHedgehogsNumber : longint;
LuaTemplateNumber : LongWord;
@@ -2743,7 +2741,6 @@
cMapName:= '';
LuaTemplateNumber:= 0;
- hiddenHedgehogsNumber:=0;
end;
procedure freeModule;