diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2020-06-14 12:04:13 +0200 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2020-06-14 12:04:13 +0200 |
commit | 51c0920bc0f35b8406dc3f635d8ae9bed7dfe5d5 (patch) | |
tree | f9e5eccbc0005647067d0ca8c4a9813412427c69 /advtrains/path.lua | |
parent | ae79af604cf2209f0630a9613ce10cd198afa569 (diff) | |
parent | b13c7259763aa5c150e25c894a621a59b7bd37d4 (diff) | |
download | advtrains-51c0920bc0f35b8406dc3f635d8ae9bed7dfe5d5.tar.gz advtrains-51c0920bc0f35b8406dc3f635d8ae9bed7dfe5d5.tar.bz2 advtrains-51c0920bc0f35b8406dc3f635d8ae9bed7dfe5d5.zip |
Merge branch 'master' of bananach.space:advtrains
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 |