RoutingManager's logic for car lanes (non-highway rules) will be revised as follows:
Outgoing lanes will be grouped first by lane group then by arrow direction. These are routing groups. For each outgoing routing group, the valid outgoing lane groups on all segments on the node will be identified.
Incoming lane connections will be explicitly honored, then ignored by the remaining logic, as is done in the current code. However, this ought to be improved in the future.
The lanes of the incoming routing group will be assigned to an outgoing lane group, proportionally according to the outgoing groups' lane counts. However, outgoing Standard and Express lane groups on the same segment will be treated as one for this operation.
If the incoming routing group has at least as many lanes as the number of outgoing lane groups, an incoming lane will never be assigned to more than one outgoing lane group.
Lane transitions will be defined from the incoming lanes into their assigned outgoing groups in a manner to avoid conflicts, or at least minimize them if there are more incoming than outgoing lanes.
The code will be structured to allow for node-based routing in the future. This will allow the routing of incoming segments to adapt to each other. Such an enhancement will also improve highway rules.
Valid Outgoing Lane Groups
A DisplacedInner lane group is exclusive if m_allowConnect is false and m_laneType is Vehicle. This excludes both Airports DLC cargo roads and TransportVehicle lanes from special CFI rules for displaced lanes.
Far Turn
An outgoing lane group is valid for far turns if its relative arrow direction is Left (RHT) or Right (LHT) and any one of the following conditions are met:
It is a DisplacedOuter lane group on the nearest segment with incoming lanes in the clockwise (RHT) or counter-clockwise (LHT) direction.
It is a DisplacedInner lane group.
It is an Express or Standard lane group and there is no exclusive DisplacedInner lane group on the same segment. (The presence of an exclusive DisplacedInner lane group triggers the CFI rule.)
Near Turn
An outgoing lane group is valid for near turns if its relative arrow direction is Right (RHT) or Left (LHT) and any of the following conditions are met:
It is a Standard or Express lane group.
It is a DisplacedInner lane group that is not exclusive.
Forward, Standard Rule
If the incoming routing group is DisplacedOuter and there is no DisplacedOuter outgoing lane group, it is handled as if it were DisplacedInner.
If a segment contains the same type of outgoing lane group as the incoming routing group, then that is the valid outgoing lane group for the segment.
Otherwise, if the incoming routing group is Express, then outgoing DisplacedInner and Standard lane groups are both valid.
Otherwise, if the incoming routing group is DisplacedInner and an Express outgoing lane group is available, then that the valid outgoing lane group.
Otherwise, the outgoing Standard lane group is selected as valid.
Forward, CFI Rule
When the incoming and outgoing segments both have exclusive DisplacedInner lanes and there are valid outgoing lane groups for far turns, the only valid outgoing lane group is DisplacedInner.
Highway Rules
When all segments on a node are highways, the existing code will be used for lane routing. Since highways do not have in-segment medians, they are beyond the scope of this project.
This issue depends on #1589.
Basic Non-Highway Routing Strategy
RoutingManager
's logic for car lanes (non-highway rules) will be revised as follows:Standard
andExpress
lane groups on the same segment will be treated as one for this operation.The code will be structured to allow for node-based routing in the future. This will allow the routing of incoming segments to adapt to each other. Such an enhancement will also improve highway rules.
Valid Outgoing Lane Groups
A
DisplacedInner
lane group is exclusive ifm_allowConnect
isfalse
andm_laneType
isVehicle
. This excludes both Airports DLC cargo roads andTransportVehicle
lanes from special CFI rules for displaced lanes.Far Turn
An outgoing lane group is valid for far turns if its relative arrow direction is Left (RHT) or Right (LHT) and any one of the following conditions are met:
DisplacedOuter
lane group on the nearest segment with incoming lanes in the clockwise (RHT) or counter-clockwise (LHT) direction.DisplacedInner
lane group.Express
orStandard
lane group and there is no exclusiveDisplacedInner
lane group on the same segment. (The presence of an exclusiveDisplacedInner
lane group triggers the CFI rule.)Near Turn
An outgoing lane group is valid for near turns if its relative arrow direction is Right (RHT) or Left (LHT) and any of the following conditions are met:
Standard
orExpress
lane group.DisplacedInner
lane group that is not exclusive.Forward, Standard Rule
DisplacedOuter
and there is noDisplacedOuter
outgoing lane group, it is handled as if it wereDisplacedInner
.Express
, then outgoingDisplacedInner
andStandard
lane groups are both valid.DisplacedInner
and anExpress
outgoing lane group is available, then that the valid outgoing lane group.Standard
lane group is selected as valid.Forward, CFI Rule
When the incoming and outgoing segments both have exclusive
DisplacedInner
lanes and there are valid outgoing lane groups for far turns, the only valid outgoing lane group isDisplacedInner
.Highway Rules
When all segments on a node are highways, the existing code will be used for lane routing. Since highways do not have in-segment medians, they are beyond the scope of this project.