Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StayInLane(StayInLaneMode.Forward/Backward) when node.m_segment0 == 0 #618

Closed
kianzarrin opened this issue Jan 19, 2020 · 0 comments · Fixed by #619
Closed

StayInLane(StayInLaneMode.Forward/Backward) when node.m_segment0 == 0 #618

kianzarrin opened this issue Jan 19, 2020 · 0 comments · Fixed by #619
Labels
BUG Defect detected LANE ROUTING Feature: Lane arrows / connectors
Milestone

Comments

@kianzarrin
Copy link
Collaborator

The following code assumes that node.m_segment0 always exits:
(from https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition)

https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/blob/ab806f57362a2db7decffdbb336da5b64b5cdc74/TLM/TLM/UI/SubTools/LaneConnectorTool.cs#L372
if ((sourceLaneMarker.SegmentIndex == 0) ^ (stayInLaneMode == StayInLaneMode.Backward)) {
    continue;
}

Therefore when node.m_segment0 == 0 and the user tries to stay in lane only in one direction it will not work.

Reproduce:

  1. create a segment
  2. connect to more segments to it in a T shaped junction.
  3. bulldoze the segment from step 1
  4. use the lane connector tool to select the node and press SHIFT+S multiple times.

Suggested fix:
Find the smallest i where node.GetSegment(i) ~= 0
replace sourceLaneMarker.SegmentIndex == 0 with sourceLaneMarker.SegmentIndex == i

@kianzarrin kianzarrin added BUG Defect detected triage Awaiting issue categorisation labels Jan 19, 2020
@originalfoo originalfoo added LANE ROUTING Feature: Lane arrows / connectors and removed triage Awaiting issue categorisation labels Jan 19, 2020
kianzarrin added a commit to kianzarrin/Cities-Skylines-Traffic-Manager-President-Edition that referenced this issue Jan 19, 2020
@originalfoo originalfoo added this to the 11.0 milestone Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Defect detected LANE ROUTING Feature: Lane arrows / connectors
Projects
None yet
2 participants