aboutsummaryrefslogtreecommitdiff
path: root/advtrains/helpers.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2020-06-10 20:56:35 +0200
committerorwell96 <orwell@bleipb.de>2020-06-10 20:56:35 +0200
commitb13c7259763aa5c150e25c894a621a59b7bd37d4 (patch)
treefac9cd110c969ba5ca427dd42f19296402643355 /advtrains/helpers.lua
parentd61c2145a0f28438b0f85345bc7808ce0b6161c6 (diff)
downloadadvtrains-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/helpers.lua')
-rw-r--r--advtrains/helpers.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/advtrains/helpers.lua b/advtrains/helpers.lua
index e04991e..782a5c5 100644
--- a/advtrains/helpers.lua
+++ b/advtrains/helpers.lua
@@ -291,8 +291,9 @@ function advtrains.conn_matches_to(conn, other_conns)
return false
end
-
+-- Going from the rail at pos (does not need to be rounded) along connection with id conn_idx, if there is a matching rail, return it and the matching connid
-- returns: <adjacent pos>, <conn index of adjacent>, <my conn index>, <railheight of adjacent>
+-- parameter this_conns_p is connection table of this rail and is optional, is determined by get_rail_info_at if not provided.
function advtrains.get_adjacent_rail(this_posnr, this_conns_p, conn_idx, drives_on)
local this_pos = advtrains.round_vector_floor_y(this_posnr)
local this_conns = this_conns_p
@@ -332,6 +333,9 @@ function advtrains.get_adjacent_rail(this_posnr, this_conns_p, conn_idx, drives_
return nil
end
+-- when a train enters a rail on connid 'conn', which connid will it go out?
+-- nconns: number of connections in connection table
+-- returns: connid_out
local connlku={[2]={2,1}, [3]={2,1,1}, [4]={2,1,4,3}}
function advtrains.get_matching_conn(conn, nconns)
return connlku[nconns][conn]