diff options
author | orwell96 <orwell@bleipb.de> | 2020-06-10 20:56:35 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2020-06-10 20:56:35 +0200 |
commit | b13c7259763aa5c150e25c894a621a59b7bd37d4 (patch) | |
tree | fac9cd110c969ba5ca427dd42f19296402643355 /advtrains/path.lua | |
parent | d61c2145a0f28438b0f85345bc7808ce0b6161c6 (diff) | |
download | advtrains-b13c7259763aa5c150e25c894a621a59b7bd37d4.tar.gz advtrains-b13c7259763aa5c150e25c894a621a59b7bd37d4.tar.bz2 advtrains-b13c7259763aa5c150e25c894a621a59b7bd37d4.zip |
Workaround to handle split points (dt. aufgefahrene Weichen), fixing H#77
Diffstat (limited to 'advtrains/path.lua')
-rw-r--r-- | advtrains/path.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/advtrains/path.lua b/advtrains/path.lua index ff034c9..b132e92 100644 --- a/advtrains/path.lua +++ b/advtrains/path.lua @@ -178,9 +178,15 @@ function advtrains.path_get(train, index) if adj_pos then advtrains.occ.set_item(train.id, adj_pos, pef) + -- If we have split points, notify accordingly + local mconnid = advtrains.get_matching_conn(adj_connid, #next_conns) + if #next_conns==3 and adj_connid==1 and train.points_split and train.points_split[advtrains.encode_pos(adj_pos)] then + --atdebug(id,"has split points restored at",adj_pos) + mconnid = 3 + end + adj_pos.y = adj_pos.y + nextrail_y train.path_cp[pef] = adj_connid - local mconnid = advtrains.get_matching_conn(adj_connid, #next_conns) train.path_cn[pef] = mconnid train.path_dir[pef] = advtrains.conn_angle_median(next_conns[adj_connid].c, next_conns[mconnid].c) train.path_trk_f = pef @@ -211,9 +217,15 @@ function advtrains.path_get(train, index) if adj_pos then advtrains.occ.set_item(train.id, adj_pos, peb) + -- If we have split points, notify accordingly + local mconnid = advtrains.get_matching_conn(adj_connid, #next_conns) + if #next_conns==3 and adj_connid==1 and train.points_split and train.points_split[advtrains.encode_pos(adj_pos)] then + atdebug(id,"has split points restored at",adj_pos) + mconnid = 3 + end + adj_pos.y = adj_pos.y + nextrail_y train.path_cn[peb] = adj_connid - local mconnid = advtrains.get_matching_conn(adj_connid, #next_conns) train.path_cp[peb] = mconnid train.path_dir[peb] = advtrains.conn_angle_median(next_conns[mconnid].c, next_conns[adj_connid].c) train.path_trk_b = peb |