aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/database.lua
diff options
context:
space:
mode:
authororwell <orwell@bleipb.de>2024-12-03 00:56:17 +0100
committerorwell <orwell@bleipb.de>2024-12-03 00:56:17 +0100
commitb2889e33ba389c936b9d6b1ca5be27ef8f147280 (patch)
treed27093b8d071aa7371883b4f1632a554165e7522 /advtrains_interlocking/database.lua
parentfc13e732224f935bc558902e878e81a40afe4713 (diff)
downloadadvtrains-b2889e33ba389c936b9d6b1ca5be27ef8f147280.tar.gz
advtrains-b2889e33ba389c936b9d6b1ca5be27ef8f147280.tar.bz2
advtrains-b2889e33ba389c936b9d6b1ca5be27ef8f147280.zip
Feature to add passive components to a section as fixed locks (for level crossings)
Diffstat (limited to 'advtrains_interlocking/database.lua')
-rw-r--r--advtrains_interlocking/database.lua7
1 files changed, 6 insertions, 1 deletions
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