Skip to content
Snippets Groups Projects
Commit cc0ad516 authored by dg's avatar dg
Browse files

Fixed the "black map" bug

git-svn-id: http://svn.net-core.org/repos/t-engine4@3449 51575b47-30f0-44d4-a5cc-537603b46e54
parent 4a3fd54d
No related merge requests found
...@@ -326,13 +326,23 @@ function _M:close() ...@@ -326,13 +326,23 @@ function _M:close()
se._mo = nil se._mo = nil
end end
end end end end
self.map[i][pos] = nil
end end
end end
self.closed = true self.closed = true
self.changed = true self.changed = true
end end
--- Closes things in the object to allow it to be garbage collected
-- Map objects are NOT automatically garbage collected because they contain FOV C structure, which themselves have a reference
-- to the map. Cyclic references! BAD BAD BAD !<br/>
-- The closing should be handled automatically by the Zone class so no bother for authors
function _M:reopen()
if not self.closed then return end
self:redisplay()
self.closed = nil
self.changed = true
end
--- Cleans the FOV infos (seens table) --- Cleans the FOV infos (seens table)
function _M:cleanFOV() function _M:cleanFOV()
if not self.clean_fov then return end if not self.clean_fov then return end
......
...@@ -651,6 +651,9 @@ function _M:getLevel(game, lev, old_lev, no_close) ...@@ -651,6 +651,9 @@ function _M:getLevel(game, lev, old_lev, no_close)
-- Clean up things -- Clean up things
collectgarbage("collect") collectgarbage("collect")
-- Re-open the level if needed (the method does the check itself)
level.map:reopen()
return level return level
end end
......
...@@ -47,7 +47,7 @@ enter_level3 = function(self) ...@@ -47,7 +47,7 @@ enter_level3 = function(self)
g.desc = "Beware!" g.desc = "Beware!"
g.change_level_check = function() g.change_level_check = function()
require("engine.ui.Dialog"):yesnoPopup("Danger...", "This way lead to the lair of a mighty troll, traces of blood are everywhere. Are you sure?", function(ret) require("engine.ui.Dialog"):yesnoPopup("Danger...", "This way lead to the lair of a mighty troll, traces of blood are everywhere. Are you sure?", function(ret)
if ret then game:changeLevel(4, "trollmire") end if ret then game:changeLevel(4) end
end) end)
return true return true
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment