aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/database.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains_interlocking/database.lua')
-rw-r--r--advtrains_interlocking/database.lua23
1 files changed, 14 insertions, 9 deletions
diff --git a/advtrains_interlocking/database.lua b/advtrains_interlocking/database.lua
index 844d350..bd90e36 100644
--- a/advtrains_interlocking/database.lua
+++ b/advtrains_interlocking/database.lua
@@ -55,6 +55,9 @@ Every time a repair operation takes place, and on every track edit operation, th
]]--
+-- Get current translator
+local S = advtrains.interlocking.translate
+
local TRAVERSER_LIMIT = 1000
@@ -214,10 +217,11 @@ TCB data structure
-- aspect will be set accordingly.
routeset = <index in routes> -- Route set from this signal. This is the entry that is cleared once
-- train has passed the signal. (which will set the aspect to "danger" again)
- route_committed = <boolean> -- When setting/requesting a route, routetar will be set accordingly,
+ -- routeset may be a table (e.g. {1,2}) while the route is not committed yet, indicating a wait for multiple routes at once (Multi-ARS)
+ route_committed = <boolean> -- When setting/requesting a route, routeset will be set accordingly,
-- while the signal still displays danger and nothing is written to the TCs
-- As soon as the route can actually be set, all relevant TCs and turnouts are set and this field
- -- is set true, clearing the signal
+ -- is set true, clearing the signal (when this is true, routeset is never a table)
aspect = <asp> -- The aspect the signal should show. If this is nil, should show the most restrictive aspect (red)
signal_name = <string> -- The human-readable name of the signal, only for documenting purposes
routes = { <route definition> } -- a collection of routes from this signal
@@ -379,7 +383,7 @@ function ildb.check_and_repair_ts_at_pos(pos, tcb_connid, notify_pname, force_cr
if ts_id ~= tcbs_ts_id then
-- inconsistency is found, repair it
--atdebug("check_and_repair_ts_at_pos: Inconsistency is found!")
- tsrepair_notify(notify_pname, "Track section inconsistent here, repairing...")
+ tsrepair_notify(notify_pname, S("Track section inconsistent here, repairing..."))
return ildb.repair_ts_merge_all(all_tcbs, force_create, notify_pname)
-- Step2 check is no longer necessary since we just created that new section
end
@@ -408,7 +412,7 @@ function ildb.check_and_repair_ts_at_pos(pos, tcb_connid, notify_pname, force_cr
-- That means it is sufficient to compare the LENGTHS of both lists, if one is longer then it is inconsistent
if #ts.tc_breaks ~= #all_tcbs then
--atdebug("check_and_repair_ts_at_pos: Partition is found!")
- tsrepair_notify(notify_pname, "Track section partition found, repairing...")
+ tsrepair_notify(notify_pname, S("Track section partition found, repairing..."))
return ildb.repair_ts_merge_all(all_tcbs, force_create, notify_pname)
end
--tsrepair_notify(notify_pname, "Found section", ts.name or ts_id, "here.")
@@ -536,7 +540,7 @@ function ildb.repair_ts_merge_all(all_tcbs, force_create, notify_pname)
end
-- Create a new fresh track section with all the TCBs we have in our collection
local new_ts_id, new_ts = ildb.create_ts_from_tcb_list(all_tcbs)
- tsrepair_notify(notify_pname, "Created track section",new_ts_id,"from",#all_tcbs,"TCBs")
+ tsrepair_notify(notify_pname, S("Created track section @1 from @2 TCBs", new_ts_id, #all_tcbs))
return new_ts_id
end
@@ -737,7 +741,8 @@ local function recursively_find_routes(s_pos, s_connid, locks_found, result_tabl
local end_pkey = advtrains.encode_pos(pos)
--atdebug("Found end TCB", pos, end_pkey,", returning")
if result_table[end_pkey] then
- atwarn("While caching track section routing, found multiple route paths within same track section. Only first one found will be used")
+ --atwarn("While caching track section routing, found multiple route paths within same track section. Only first one found will be used")
+ -- this warning appears too often and is typically harmless
else
result_table[end_pkey] = table.copy(locks_found)
end
@@ -783,9 +788,9 @@ function ildb.update_rs_cache(ts_id)
end
end
-- warn about superfluous entry
- for sup_end_pkey, sup_entry in pairs(result_table) do
- atwarn("In update_rs_cache for section",ts_id,"found superfluous endpoint",sup_end_pkey,"->",sup_entry)
- end
+ --for sup_end_pkey, sup_entry in pairs(result_table) do
+ -- atwarn("In update_rs_cache for section",ts_id,"found superfluous endpoint",sup_end_pkey,"->",sup_entry)
+ --end -- this warning appears too often and is typically harmless
end
ts.rs_cache = rscache
--atdebug("== Done update_rs_cache for ",ts_id, "result:",rscache)