global {
version = '0.10.0';
warehouse18_found = false;
warehouse32_found = false;
warehouse32_visited = false;
@@ -215,7 +216,35 @@ function prepare_ending(nstate)
end;
end
function fix_save(filename)
local f=stead.io.open(filename,"rb");
if f~=nil then
local content = f:read("*all");
stead.io.close(f);
print(string.find(content, '0.10.0'));
if string.find(content, '0.10.0') == nil then
print("Fixing save file");
content = stead.string.gsub(content, '([^A-Za-z])rm([^A-Za-z])', '%1warehouse_32%2') .. '\nversion="0.10.0"\n';
print(content)
local f=stead.io.open(filename,"wb")
if f ~= nil then
f:write(content);
else
print("Fixing save file failed");
function init()
---save fix
fix_save(instead_savepath() .. '/autosave');
fix_save(instead_savepath() .. '/save1');
fix_save(instead_savepath() .. '/save2');
fix_save(instead_savepath() .. '/save3');
fix_save(instead_savepath() .. '/save4');
fix_save(instead_savepath() .. '/save5');
---modules init
pl = player_drake;
--putf("debug_tool", stead.me())