hedgewars/uScript.pas
changeset 10903 c9a0cdee4267
parent 10901 fbf6fbe66092
child 10978 54a49174dbec
--- a/hedgewars/uScript.pas	Wed Apr 08 23:59:35 2015 -0400
+++ b/hedgewars/uScript.pas	Fri Apr 10 10:36:17 2015 -0400
@@ -2252,7 +2252,7 @@
 var spr   : TSprite;
     lf    : Word;
     i, n : LongInt;
-    eraseOnLFMatch, flipHoriz, flipVert : boolean;
+    eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert : boolean;
 const
     call = 'EraseSprite';
     params = 'x, y, sprite, frameIdx, eraseOnLFMatch, flipHoriz, flipVert, [, landFlag, ... ]';
@@ -2263,15 +2263,18 @@
 	        eraseOnLFMatch := lua_toboolean(L, 5)
         else eraseOnLFMatch := false;
         if not lua_isnoneornil(L, 6) then
-	        flipHoriz := lua_toboolean(L, 6)
+	        onlyEraseLF := lua_toboolean(L, 6)
+        else onlyEraseLF := false;
+        if not lua_isnoneornil(L, 7) then
+	        flipHoriz := lua_toboolean(L, 7)
         else flipHoriz := false;
-        if not lua_isnoneornil(L, 7) then
-	        flipVert := lua_toboolean(L, 7)
+        if not lua_isnoneornil(L, 8) then
+	        flipVert := lua_toboolean(L, 8)
         else flipVert := false;
         lf:= 0;
 
         // accept any amount of landflags, loop is never executed if n>6
-        for i:= 8 to n do
+        for i:= 9 to n do
             lf:= lf or lua_tointeger(L, i);
 
         n:= LuaToSpriteOrd(L, 3, call, params);
@@ -2284,7 +2287,7 @@
                 EraseLand(
                     lua_tointeger(L, 1) - SpritesData[spr].Width div 2,
                     lua_tointeger(L, 2) - SpritesData[spr].Height div 2,
-                    spr, lua_tointeger(L, 4), lf, eraseOnLFMatch, flipHoriz, flipVert);
+                    spr, lua_tointeger(L, 4), lf, eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert);
             end;
         end;
     lc_erasesprite:= 0