From b2889e33ba389c936b9d6b1ca5be27ef8f147280 Mon Sep 17 00:00:00 2001 From: orwell Date: Tue, 3 Dec 2024 00:56:17 +0100 Subject: Feature to add passive components to a section as fixed locks (for level crossings) --- advtrains_interlocking/database.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'advtrains_interlocking/database.lua') diff --git a/advtrains_interlocking/database.lua b/advtrains_interlocking/database.lua index c05e69a..09b1c72 100644 --- a/advtrains_interlocking/database.lua +++ b/advtrains_interlocking/database.lua @@ -758,6 +758,7 @@ function ildb.update_rs_cache(ts_id) --atdebug("Starting for ",start_tcbi, start_tcbs) local locks_found = {} local result_table = {} + recursively_find_routes(start_tcbs.p, start_tcbs.s, locks_found, result_table, TS_MAX_SCAN) -- now result_table contains found route locks. Match them with the other TCBs we have in this section for end_tcbi, end_tcbs in ipairs(ts.tc_breaks) do @@ -765,7 +766,11 @@ function ildb.update_rs_cache(ts_id) end_pkey = advtrains.encode_pos(end_tcbs.p) if result_table[end_pkey] then --atdebug("Set RSCache entry",end_pkey.."-"..end_pkey,"=",result_table[end_pkey]) - rscache[start_pkey][end_pkey] = result_table[end_pkey] + local lockstab = result_table[end_pkey] + if ts.fixed_locks then -- include the sections fixedlocks if present + for pts, st in pairs(ts.fixed_locks) do lockstab[pts] = st end + end + rscache[start_pkey][end_pkey] = lockstab result_table[end_pkey] = nil end end -- cgit v1.2.3