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

Disambiguate LeftHandDrive to TrafficDrivesOnLeft #580

Merged
merged 3 commits into from
Nov 29, 2019

Conversation

originalfoo
Copy link
Member

Fixes #577 - h/t @kianzarrin for reporting the issue

The term "LHD" (Left Hand Drive_r_) actually relates to traffic driving on the right (RHT, or Right Hand Traffic). However, TM:PE was regularly using the term to refer to the situation where traffic drives on the left (which is actually RHD / LHT).

To avoid ongoing mass confusion, this PR obsoletes Services.SimulationService.LeftHandDrive and adds a new disambiguous Services.SimulationService.TrafficDrivesOnLeft.

Uses of the obsolete property have been updated to use the new property. Also any instances of that code creating variables called lhd (ie. traffic drives on right) have been updated to lht (left hand traffic, which would be right hand driver).

Features affected include:

  • Junction restrictions (particularly "Turn on Red")
  • Lane arrows
  • Lane connectors
  • Priority signs
  • Timed Traffic Lights
  • Also, RoutingManager was updated, so anything that affects.

Everything should just work, as all that's changed is the property name, not it's value.

Side note: As far as I can tell, all uses of the now-obsolete LeftHandDrive property are updated to use TrafficDrivesOnLeft - should the obsolete property be removed?

LeftHandDrive actually means "traffic drives on right", but it's being used as "traffic drives on left". This is creating lots of confusion in the code base.

A new property has been added: `TrafficDrivesOnLeft` which leaves nothing to the imagination.
Makes code intent much clearer. Also changed variable names, where applicable, from `lhd` to `lht` for correctness.
@originalfoo originalfoo added Annoyance Not a bug, but just as annoying adjustments required An issue require some adjustments in code technical Tasks that need to be performed in order to improve quality and maintainability code cleanup Refactor code, remove old code, improve maintainability JUNCTION RESTRICTIONS Feature: Junction restrictions LANE ROUTING Feature: Lane arrows / connectors TRAFFIC LIGHTS Feature: Traffic lights - toggle, timed, etc labels Nov 29, 2019
@originalfoo originalfoo added this to the 11.0 milestone Nov 29, 2019
@originalfoo originalfoo self-assigned this Nov 29, 2019
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.

Good stuff

@krzychu124
Copy link
Member

I will check the code later but vanilla uses that term too. There is LeftHandDrive Vehicle.Flags and LeftHandDrive method in VehicleAI and SnowTruckAI so confusion is inevitable :)

@originalfoo
Copy link
Member Author

originalfoo commented Nov 29, 2019

I will check the code later but vanilla uses that term too. There is LeftHandDrive Vehicle.Flags and LeftHandDrive method in VehicleAI and SnowTruckAI so confusion is inevitable :)

Yes, vanilla is also incorrect in the terminology it uses = mass confusion.

Also, in some cases it will be valid to know which side driver is on - possibly for things like busses, trams, etc? In other words, which side do passengers transfer to the vehicle?

At some point it would be nice to try and wrap the vanilla wrongness in something less confusing but I'm lacking in C# knowledge as to how to fix that.

Copy link
Member

@krzychu124 krzychu124 left a comment

Choose a reason for hiding this comment

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

Looks good

@originalfoo
Copy link
Member Author

I've created #581 to track future work to disambiguate the vanilla usage of LeftHandDrive.

@originalfoo originalfoo merged commit bf17ddd into master Nov 29, 2019
@originalfoo originalfoo deleted the pr-disambiguate-lhd branch November 29, 2019 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adjustments required An issue require some adjustments in code Annoyance Not a bug, but just as annoying code cleanup Refactor code, remove old code, improve maintainability JUNCTION RESTRICTIONS Feature: Junction restrictions LANE ROUTING Feature: Lane arrows / connectors technical Tasks that need to be performed in order to improve quality and maintainability TRAFFIC LIGHTS Feature: Traffic lights - toggle, timed, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LeftHandDrive returns Right hand drive
3 participants