Open the 2 files required in the current save format
This commit is contained in:
parent
a986d0478d
commit
49a47330b3
21
main.lua
21
main.lua
@ -128,20 +128,21 @@ end
|
|||||||
datapath, mappath, no_trains, worldimage = parse_args(arg)
|
datapath, mappath, no_trains, worldimage = parse_args(arg)
|
||||||
|
|
||||||
-- Load saves
|
-- Load saves
|
||||||
local file, err = io.open(datapath.."advtrains", "r")
|
local file, err = io.open(datapath.."advtrains_trains", "r")
|
||||||
local tbl = minetest.deserialize(file:read("*a"))
|
local tbl = minetest.deserialize(file:read("*a"))
|
||||||
if type(tbl) ~= "table" then
|
if type(tbl) ~= "table" then
|
||||||
error("not a table")
|
error("Trains file: not a table")
|
||||||
end
|
end
|
||||||
if tbl.version then
|
advtrains.trains = tbl
|
||||||
advtrains.trains = tbl.trains
|
file:close()
|
||||||
if not mappath then
|
|
||||||
advtrains.ndb.load_data(tbl.ndb)
|
--ndb contains the defs, while ndb2 is the actual contents
|
||||||
end
|
file, err = io.open(datapath.."advtrains_ndb", "r")
|
||||||
|
tbl = minetest.deserialize(file:read("*a"))
|
||||||
else
|
if type(tbl) ~= "table" then
|
||||||
error("Incompatible save format!")
|
error("Node database file: not a table")
|
||||||
end
|
end
|
||||||
|
advtrains.ndb.load_data(tbl)
|
||||||
file:close()
|
file:close()
|
||||||
|
|
||||||
-- open svg file
|
-- open svg file
|
||||||
|
Loading…
Reference in New Issue
Block a user