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

Prevent the user from setting invalid Lane Arrows, update if lane connections exist #1724

Merged
merged 2 commits into from
Mar 9, 2023

Conversation

krzychu124
Copy link
Member

Fixes #368

Enhancements in this PR:

  • validate Lane Arrows on load
  • calculate and refresh set of allowed lane arrows for SegmentEnd
  • reset custom lane arrows when after segment or node update the set of available lane arrows is significantly different (segment supports more or less arrow directions than before)
  • block invalid Lane Arrows in the Tool UI, shows a tooltip for disabled arrows
  • update Lane Arrows if the lane has any Lane Connection(s), to match direction of the lane connection
  • [performance] after doing many tests I decided to remove code for updating lane arrows from _RoadBaseAI/SegmentSimulationStepPatch since it does not provide any value other than wasting CPU time

Provided enhancements will solve a lot of mysterious issues reported by users in the past few years. Sometimes, for some reason (most likely segment update or bug in other feature) custom lane arrows became invalid, effectively causing huge pathfinding issues (including infamous "no cims coming from outside" when the users started a new city), since invalid arrows either don't create any lane transitions or only those of type "relaxed" which come with significant penalty for pathfinding when selected for regular vehicles.

Build ZIP

- calculate and refresh allowed lane arrows
- reset custom lane arrows when after segment or node update set of available lane arrows is significantly different (segment supports more or less arrow directions than before)
- block invalid Lane Arrows in Tool UI
- update lane arrows if lane has lane connection(s)
- fixed lane flag recalculation after validation phase
@krzychu124 krzychu124 added BUG Defect detected enhancement Improve existing feature UI User interface updates LANE ROUTING Feature: Lane arrows / connectors PATHFINDER Pathfinding tweaks or issues labels Feb 19, 2023
@krzychu124 krzychu124 added this to the 11.7.4.0 milestone Feb 19, 2023
@krzychu124 krzychu124 self-assigned this Feb 19, 2023
Copy link
Contributor

@chameleon-tbn chameleon-tbn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ingame, lgtm

@krzychu124 krzychu124 mentioned this pull request Mar 2, 2023
Copy link
Collaborator

@kvakvs kvakvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks and plays good.
Multiple confusions after updating the game to 1.16 and lots of mods going broken or dead.

@@ -215,6 +217,9 @@ private enum Trigger {
buttonLeft.ToggleFlag = API.Traffic.Enums.LaneArrows.Left;
buttonLeft.UpdateButtonSkinAndTooltip();
buttonLeft.ParentTool = this; // to access error reporting function on click
bool leftAllowed = (availableArrows & LaneArrows.Left) != 0;
buttonLeft.isEnabled = leftAllowed;
buttonLeft.tooltip = !leftAllowed ? T("LaneArrow: Direction not available") : string.Empty;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Translations, have they been updated?
image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, need to be updated/string needs to be added 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll create new PR with translations

@krzychu124 krzychu124 merged commit 183d209 into master Mar 9, 2023
@krzychu124 krzychu124 deleted the bugfix/invalid-arrow-directions-not-allowed branch March 9, 2023 19:42
@krzychu124 krzychu124 mentioned this pull request Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Defect detected enhancement Improve existing feature LANE ROUTING Feature: Lane arrows / connectors PATHFINDER Pathfinding tweaks or issues UI User interface updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent players from setting invalid lane arrows
3 participants