From 549c965e663e40e51d3ed000269dae78f9e7e427 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Fri, 17 Sep 2010 12:49:43 +0000
Subject: [PATCH] Maybe fix quake ..

git-svn-id: http://svn.net-core.org/repos/t-engine4@1241 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/Actor.lua | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua
index ab0b23b38a..81e743c1c1 100644
--- a/game/modules/tome/class/Actor.lua
+++ b/game/modules/tome/class/Actor.lua
@@ -331,25 +331,23 @@ end
 --- Quake a zone
 -- Moves randomly each grid to an other grid
 function _M:doQuake(tg, x, y)
+	local w = game.level.map.w
 	local locs = {}
 	local ms = {}
 	self:project(tg, x, y, function(tx, ty)
 		locs[#locs+1] = {x=tx,y=ty}
-		ms[#ms+1] = game.level.map.map[tx + ty * game.level.map.w]
+		ms[#ms+1] = {map=game.level.map.map[tx + ty * w], attrs=game.level.map.attrs[tx + ty * w]}
 	end)
 
 	while #locs > 0 do
 		local l = rng.tableRemove(locs)
 		local m = rng.tableRemove(ms)
-		for k, e in pairs(m) do
-			-- Update it manually
-			if not e.x and not e.y then
-				game.level.map(l.x, l.y, k, e)
-				if e.x and e.y then e.x, e.ly = l.x, l.y end
-			-- If it can move, move it
-			elseif e.x and e.y and e.move then
-				e.x = nil e.y = nil
-				e:move(l.x, l.y, true)
+
+		game.level.map.map[l.x + l.y * w] = m.map
+		game.level.map.attrs[l.x + l.y * w] = m.attrs
+		for z, e in pairs(m.map) do
+			if e.move then
+				e.x = nil e.y = nil e:move(l.x, l.y, true)
 			end
 		end
 	end
-- 
GitLab