Skip to content
Snippets Groups Projects
Commit 9e90b9b4 authored by DarkGod's avatar DarkGod
Browse files

Added a way for the game to try and load (and fix) savefiles with errors...

Added a way for the game to try and load (and fix) savefiles with errors (usualy due to data that should not have been saved). It is likely to work in many instances, but not guaranted.
parent 854b64d7
No related branches found
No related tags found
No related merge requests found
......@@ -474,7 +474,14 @@ function _M:loadReal(load)
lines[#lines+1] = l
end
f:close()
local o = class.load(table.concat(lines), load)
local ok, o = xpcall(function() return class.load(table.concat(lines), load) end, debug.traceback)
if not ok then
print("[SAVEFILE ERROR] loading object", load, "resulting in: ", o)
self:addDelayLoad{loaded = function() game:onTickEnd(function()
require("engine.ui.Dialog"):simplePopup("Savefile loading WARNING", "The game has detected a problem in the savefile and attempted to fix it.\nIt is likely to work without any adverse effects but should a problem arise, please mention this event in the bug report.")
end) end}
return nil
end
-- Resolve self referencing tables now
resolveSelf(o, o, true)
......
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