aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-02-09 19:24:10 +0100
committerorwell96 <orwell@bleipb.de>2019-02-09 19:24:10 +0100
commitfcb3dec0c075e86e6a223e2e8df0eb89d06a6466 (patch)
treeeaf79c1a8fac4184dd6a773974cf05e86fe5f3a6 /advtrains_interlocking
parent2d2cd9605b91ec2f8ec2320714d7a263db50d009 (diff)
downloadadvtrains-fcb3dec0c075e86e6a223e2e8df0eb89d06a6466.tar.gz
advtrains-fcb3dec0c075e86e6a223e2e8df0eb89d06a6466.tar.bz2
advtrains-fcb3dec0c075e86e6a223e2e8df0eb89d06a6466.zip
Fixes regarding signal assignments/tcbs
- No longer crashes when assigned tcb is removed - don't forbid modification just because signal is assigned
Diffstat (limited to 'advtrains_interlocking')
-rw-r--r--advtrains_interlocking/database.lua17
1 files changed, 13 insertions, 4 deletions
diff --git a/advtrains_interlocking/database.lua b/advtrains_interlocking/database.lua
index ba2a318..bd354b2 100644
--- a/advtrains_interlocking/database.lua
+++ b/advtrains_interlocking/database.lua
@@ -422,6 +422,9 @@ function ildb.remove_from_interlocking(sigd)
end
end
advtrains.interlocking.show_tcb_marker(sigd.p)
+ if tcbs.signal then
+ return false
+ end
return true
end
@@ -461,9 +464,7 @@ end
function ildb.may_modify_tcbs(tcbs)
- if tcbs.signal then
- return false
- elseif tcbs.ts_id then
+ if tcbs.ts_id then
local ts = ildb.get_ts(tcbs.ts_id)
if ts and not ildb.may_modify_ts(ts) then
return false
@@ -509,7 +510,15 @@ end
-- returns the sigd the signal at pos belongs to, if this is known
function ildb.get_sigd_for_signal(pos)
local pts = advtrains.roundfloorpts(pos)
- return signal_assignments[pts]
+ local sigd = signal_assignments[pts]
+ if sigd then
+ if not ildb.get_tcbs(sigd) then
+ signal_assignments[pts] = nil
+ return nil
+ end
+ return sigd
+ end
+ return nil
end
function ildb.set_sigd_for_signal(pos, sigd)
local pts = advtrains.roundfloorpts(pos)