aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2023-05-14 15:22:59 +0200
committerorwell96 <orwell@bleipb.de>2023-05-27 12:26:15 +0200
commit8371d8496a0423d992c29f38c59265a5d6f8517a (patch)
tree5cd742ebf2febac87d89df5664fb5e8975c1e5db /advtrains_interlocking
parentbc8c04d146cea83e6b7c6e63c1778abff6cd0b68 (diff)
downloadadvtrains-8371d8496a0423d992c29f38c59265a5d6f8517a.tar.gz
advtrains-8371d8496a0423d992c29f38c59265a5d6f8517a.tar.bz2
advtrains-8371d8496a0423d992c29f38c59265a5d6f8517a.zip
Fix map, fix train placing
Diffstat (limited to 'advtrains_interlocking')
-rw-r--r--advtrains_interlocking/database.lua3
-rw-r--r--advtrains_interlocking/train_sections.lua4
2 files changed, 4 insertions, 3 deletions
diff --git a/advtrains_interlocking/database.lua b/advtrains_interlocking/database.lua
index 35afc8d..551d21a 100644
--- a/advtrains_interlocking/database.lua
+++ b/advtrains_interlocking/database.lua
@@ -267,7 +267,8 @@ function ildb.check_and_repair_ts_at_pos(pos, tcb_connid)
if ildb.get_tcb(pos) then
if not tcb_connid then error("check_and_repair_ts_at_pos: Startpoint is TCB, must provide tcb_connid!") end
else
- if tcb_connid then error("check_and_repair_ts_at_pos: Startpoint is not TCB, must not provide tcb_connid!") end
+ --if tcb_connid then error("check_and_repair_ts_at_pos: Startpoint is not TCB, must not provide tcb_connid!") end
+ -- do not give error here, for some applications do not require it
end
-- STEP 1: Ensure that only one section is at this place
-- get all TCBs adjacent to this
diff --git a/advtrains_interlocking/train_sections.lua b/advtrains_interlocking/train_sections.lua
index 757f36a..47072dc 100644
--- a/advtrains_interlocking/train_sections.lua
+++ b/advtrains_interlocking/train_sections.lua
@@ -167,13 +167,13 @@ advtrains.te_register_on_create(function(id, train)
-- let's see what track sections we find here
local index = atround(train.index)
local pos = advtrains.path_get(train, index)
- local ts_id, origin = ildb.get_ts_at_pos(pos)
+ local ts_id = ildb.check_and_repair_ts_at_pos(pos, 1) -- passing connid 1 - that always exists
if ts_id then
local ts = ildb.get_ts(ts_id)
if ts then
setsection(id, train, ts_id, ts, origin)
else
- atwarn("ILDB corruption: TCB",origin," has invalid TS reference")
+ atwarn("While placing train, TS didnt exist ",ts_id)
end
-- Make train a shunt move
train.is_shunt = true