safe lifeoff from life

This commit is contained in:
p.kosyh 2009-11-01 18:41:14 +00:00
parent 1152009b34
commit 7848771961

View file

@ -1149,6 +1149,9 @@ function game_life(self)
local i,o
local av,v
stead.in_life_call = true;
stead.lifes_off = list {}; -- lifes to off
for i,o in opairs(self.lifes) do
local vv
local pre
@ -1162,6 +1165,11 @@ function game_life(self)
end
end
end
stead.in_life_call = false;
for i,o in ipairs(stead.lifes_off) do
lifeoff(o);
end
stead.lifes_off = nil;
return v, av;
end
@ -1727,6 +1735,10 @@ function lifeon(what)
end
function lifeoff(what)
if stead.in_life_call then
stead.lifes_off:add(what);
return
end
game.lifes:del(what);
end