aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/database.lua
diff options
context:
space:
mode:
author1F616EMO <root@1f616emo.xyz>2024-06-30 06:20:42 +0800
committerorwell <orwell@bleipb.de>2024-08-01 21:59:41 +0200
commitae394a43b8a715570ee3b94b19e70b8d66f597e4 (patch)
tree0af2372c4d7119339f47a6cdd1f68286ad434fb0 /advtrains_interlocking/database.lua
parent0a51d5713839cf346b1dcdf97725d525d7fa086b (diff)
downloadadvtrains-ae394a43b8a715570ee3b94b19e70b8d66f597e4.tar.gz
advtrains-ae394a43b8a715570ee3b94b19e70b8d66f597e4.tar.bz2
advtrains-ae394a43b8a715570ee3b94b19e70b8d66f597e4.zip
Remove TCB marker on TCB removal
This patch fixes the following problem: * TCB marker is not removed on TCB removal * TCB marker is recreated on removal
Diffstat (limited to 'advtrains_interlocking/database.lua')
-rw-r--r--advtrains_interlocking/database.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/advtrains_interlocking/database.lua b/advtrains_interlocking/database.lua
index 6787c50..5096d48 100644
--- a/advtrains_interlocking/database.lua
+++ b/advtrains_interlocking/database.lua
@@ -425,7 +425,7 @@ function ildb.link_track_sections(merge_id, root_id)
merge_ts(root_id, merge_id)
end
-function ildb.remove_from_interlocking(sigd)
+function ildb.remove_from_interlocking(sigd, no_tcb_marker)
local tcbs = ildb.get_tcbs(sigd)
if not ildb.may_modify_tcbs(tcbs) then return false end
@@ -455,7 +455,9 @@ function ildb.remove_from_interlocking(sigd)
track_sections[tsid] = nil
end
end
- advtrains.interlocking.show_tcb_marker(sigd.p)
+ if not no_tcb_marker then
+ advtrains.interlocking.show_tcb_marker(sigd.p)
+ end
if tcbs.signal then
return false
end
@@ -468,10 +470,11 @@ function ildb.remove_tcb(pos)
return true --FIX: not an error, because tcb is already removed
end
for connid=1,2 do
- if not ildb.remove_from_interlocking({p=pos, s=connid}) then
+ if not ildb.remove_from_interlocking({p=pos, s=connid}, true) then
return false
end
end
+ advtrains.interlocking.remove_tcb_marker_pts(pts)
track_circuit_breaks[pts] = nil
return true
end