Skip to content
Snippets Groups Projects
Commit 7e2c3c15 authored by DarkGod's avatar DarkGod
Browse files

Savefiles from previous minor patch versions will not require to check the...

Savefiles from previous minor patch versions will not require to check the "old savefiles" checkbox anymore
Savefiles from previous minor patch versions will not display the "download old data" popup anymore
parent 57997c1c
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,16 @@ function engine.version_string(v)
return ("%s-%d.%d.%d"):format(v[4] or "te4", v[1], v[2], v[3])
end
function engine.version_from_string(s)
local v = {1, 0, 0}
if not s then return v end
local _, _, M, m, p = s:find("^(%d+).(%d+).(%d+)$")
if tonumber(M) and tonumber(m) and tonumber(p) then return {tonumber(M), tonumber(m), tonumber(p)} end
local _, _, name, M, m, p = s:find("^(.+)%-(%d+).(%d+).(%d+)$")
if tonumber(M) and tonumber(m) and tonumber(p) then return {tonumber(M), tonumber(m), tonumber(p), name=name} end
return v
end
function engine.version_compare(v, ev)
if v[1] > ev[1] then return "newer" end
if v[1] == ev[1] and v[2] > ev[2] then return "newer" end
......@@ -53,3 +63,10 @@ function engine.version_nearly_same(v, ev)
end
return false
end
function engine.version_patch_same(v, ev)
if v[1] ~= ev[1] then return false end
if v[2] ~= ev[2] then return false end
if v[3] >= ev[3] then return true end
return false
end
......@@ -191,8 +191,10 @@ We apologize for the annoyance, most of the time we try to keep compatibility bu
return
end
if not ignore_mod_compat and self.save_sel.module_string ~= self.save_sel.mod.version_string then
Dialog:yesnocancelLongPopup("Original game version not found", "This savefile was created with game version %s. You can try loading it with the current version if you wish or download the data files of the old version to ensure compatibility (this is a big download but only required once).", 500, function(ret, cancel)
local save_v = engine.version_from_string(self.save_sel.module_string)
local save_m = engine.version_from_string(self.save_sel.mod.version_string)
if not ignore_mod_compat and not engine.version_patch_same(save_m, save_v) and save_m.name == save_v.name then
Dialog:yesnocancelLongPopup("Original game version not found", ("This savefile was created with game version %s. You can try loading it with the current version if you wish or download the data files of the old version to ensure compatibility (this is a big download but only required once).\nIf the data files are not available you can retry and use the newer version."):format(self.save_sel.module_string), 500, function(ret, cancel)
if cancel then return end
if ret then
self:installOldGame(self.save_sel.module_string)
......
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