aboutsummaryrefslogtreecommitdiff
path: root/advtrains/advtrains/trackdb_legacy.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-01-16 20:07:04 +0100
committerorwell96 <mono96.mml@gmail.com>2017-01-16 20:09:37 +0100
commitb649ea5fe4c9a7bc9b2b318fec97e5abe470fa9b (patch)
treeab0716378e69ab48a0cb92429ca6a12d3ae31ada /advtrains/advtrains/trackdb_legacy.lua
parentdc8b47a066ff8b3251ad09d4b490647e3f057d10 (diff)
downloadadvtrains-b649ea5fe4c9a7bc9b2b318fec97e5abe470fa9b.tar.gz
advtrains-b649ea5fe4c9a7bc9b2b318fec97e5abe470fa9b.tar.bz2
advtrains-b649ea5fe4c9a7bc9b2b318fec97e5abe470fa9b.zip
replace trackdb by nodedb
- trackdb is kept for large rail networks to still work but not saved anymore - saving node name and param2 instead of track connections, so also signals can be saved. - small serialization format - fast access times, almost no redundancy
Diffstat (limited to 'advtrains/advtrains/trackdb_legacy.lua')
-rw-r--r--advtrains/advtrains/trackdb_legacy.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/advtrains/advtrains/trackdb_legacy.lua b/advtrains/advtrains/trackdb_legacy.lua
new file mode 100644
index 0000000..99349e8
--- /dev/null
+++ b/advtrains/advtrains/trackdb_legacy.lua
@@ -0,0 +1,27 @@
+--trackdb_legacy.lua
+--loads the (old) track database. the only use for this is to provide data for rails that haven't been written into the ndb database.
+--nothing will be saved.
+--if the user thinks that he has loaded every track in his world at least once, he can delete the track database.
+
+--trackdb[[y][x][z]={conn1, conn2, rely1, rely2, railheight}
+
+
+--trackdb keeps its own save file.
+advtrains.fpath_tdb=minetest.get_worldpath().."/advtrains_trackdb2"
+local file, err = io.open(advtrains.fpath_tdb, "r")
+if not file then
+ atprint("Not loading a trackdb file.")
+else
+ local tbl = minetest.deserialize(file:read("*a"))
+ if type(tbl) == "table" then
+ advtrains.trackdb=tbl
+ atprint("Loaded trackdb file.")
+ end
+ file:close()
+end
+
+
+
+
+
+