summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontandalar <jbis1337@hotmail.com>2020-03-04 20:55:25 +1100
committerMontandalar <jbis1337@hotmail.com>2020-03-04 20:55:25 +1100
commit49a47330b383ae9bceeac6b74b5b0ce36dc3b034 (patch)
tree545ef0a9d5cdc25e75840dbfe039ceae3602fadd
parenta986d0478d2bed19b1949910af7f92f35f55c044 (diff)
downloadadvtrains_netmapper-49a47330b383ae9bceeac6b74b5b0ce36dc3b034.tar.gz
advtrains_netmapper-49a47330b383ae9bceeac6b74b5b0ce36dc3b034.tar.bz2
advtrains_netmapper-49a47330b383ae9bceeac6b74b5b0ce36dc3b034.zip
Open the 2 files required in the current save format
-rw-r--r--main.lua21
1 files changed, 11 insertions, 10 deletions
diff --git a/main.lua b/main.lua
index d16eedf..8ff86cd 100644
--- a/main.lua
+++ b/main.lua
@@ -128,20 +128,21 @@ end
datapath, mappath, no_trains, worldimage = parse_args(arg)
-- 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"))
if type(tbl) ~= "table" then
- error("not a table")
+ error("Trains file: not a table")
end
-if tbl.version then
- advtrains.trains = tbl.trains
- if not mappath then
- advtrains.ndb.load_data(tbl.ndb)
- end
-
-else
- error("Incompatible save format!")
+advtrains.trains = tbl
+file:close()
+
+--ndb contains the defs, while ndb2 is the actual contents
+file, err = io.open(datapath.."advtrains_ndb", "r")
+tbl = minetest.deserialize(file:read("*a"))
+if type(tbl) ~= "table" then
+ error("Node database file: not a table")
end
+advtrains.ndb.load_data(tbl)
file:close()
-- open svg file