aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2021-01-02 20:57:45 +0100
committerorwell96 <orwell@bleipb.de>2021-01-12 13:31:03 +0100
commit0ba5874b4f5f1a7565df8bfd20c91c309647429a (patch)
tree1193759e5e4c24fc238cdf18a0f0b55613acb325 /advtrains
parent9d12c72499fae08639f6628047a57cbb2cd837a7 (diff)
downloadadvtrains-0ba5874b4f5f1a7565df8bfd20c91c309647429a.tar.gz
advtrains-0ba5874b4f5f1a7565df8bfd20c91c309647429a.tar.bz2
advtrains-0ba5874b4f5f1a7565df8bfd20c91c309647429a.zip
Some more serializer fixes (backported from new_lzb):
- Move DUMP_DEBUG_SAVE block before the actual saving so it can be used to trace serializer errors - Don't crash on functions in data, ignore them silently - Increase the save interval
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/init.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/advtrains/init.lua b/advtrains/init.lua
index 3c3e47b..6e622e5 100644
--- a/advtrains/init.lua
+++ b/advtrains/init.lua
@@ -537,6 +537,15 @@ advtrains.avt_save = function(remove_players_from_wagons)
["ndb4.ls"] = advtrains.ndb.save_callback
}
+ if DUMP_DEBUG_SAVE then
+ local file, err = io.open(advtrains.fpath.."_DUMP", "w")
+ if err then
+ return
+ end
+ file:write(dump(parts_table))
+ file:close()
+ end
+
--THE MAGIC HAPPENS HERE
local succ, err = serialize_lib.save_atomic_multiple(parts_table, advtrains.fpath.."_", callbacks_table)
@@ -546,21 +555,12 @@ advtrains.avt_save = function(remove_players_from_wagons)
-- store version
advtrains.save_component(4, "version")
end
-
- if DUMP_DEBUG_SAVE then
- local file, err = io.open(advtrains.fpath.."_DUMP", "w")
- if err then
- return
- end
- file:write(dump(parts_table))
- file:close()
- end
end
--## MAIN LOOP ##--
--Calls all subsequent main tasks of both advtrains and atlatc
local init_load=false
-local save_interval=20
+local save_interval=60
local save_timer=save_interval
advtrains.mainloop_runcnt=0