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

Skip searching for best emergency lane for non-car vehicles #1408

Merged
merged 3 commits into from
Feb 15, 2022

Conversation

krzychu124
Copy link
Member

Airport DLC introduced new case when some vehicle flags can be used.
New usage can be found in PassengerPlaneAI - combination of Emergency and Emergency2 and WaitingCargo flags represents assignment of passenger aircraft to one of six Airlines (new DLC feature). Because of that some aircrafts are wasting time in simulation loop trying to find best lane. Since our impl. is using lane routing created by RoutingManager probably better lane cannot be found (we don't collect Plane lane transition data - although might be required in #1368) also missing is vehicle Car check is really old bug (2017) but was not used before in such way.

Removed redundant if tests, merged into one.
isLargeVehicle:
image

@krzychu124 krzychu124 added STABLE TM:PE STABLE branch PATHFINDER Pathfinding tweaks or issues DLS Dynamic Lane Selection TEST TEST version of the mod / workshop page labels Feb 15, 2022
@krzychu124 krzychu124 self-assigned this Feb 15, 2022
@originalfoo
Copy link
Member

originalfoo commented Feb 15, 2022

Are there potentially other situations where we might run in to trouble with non-car vehicle having emergency flag set?

Looking at MayFindBestLane() -

if ((vehicleState.vehicleType & (ExtVehicleType.RoadVehicle & ~ExtVehicleType.Bus)) == ExtVehicleType.None) {

RoadVehicle includes Emergency...

If you find all references to ExtVehicleType.Emergency and look for where that's being set, there may be some fringe cases where something like aircraft or fire/medic/police helicopter can get that type assigned? For example, DetermineVehicleType() or DetermineVehicleTypeFromAIType() - do they need to do some additional checks before returning ExtVehicleType.Emergency?

@krzychu124
Copy link
Member Author

Are there potentially other situations where we might run in to trouble with non-car vehicle having emergency flag set?
RoadVehicle includes Emergency...

The thing is, before use of that method there is a check if vehicle is vanilla VehicleType Car :)
2nd, MayFindBestLane() is testing our ExtVehicleType, and we assign Emergency only to emergency vehicles (with lights) and we don't manage any air vehicles -> ExtVehicleType is always None

Copy link
Member

@originalfoo originalfoo left a comment

Choose a reason for hiding this comment

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

Built from source as RELEASE, tested in game breifly - didn't notice any issues.

LGTM 👍

@originalfoo
Copy link
Member

originalfoo commented Feb 15, 2022

Want me to prep a hotfix milestone for STABLE/TEST, or will this be going in 11.6.5.0 -> TEST?

@krzychu124
Copy link
Member Author

Naah, we are going according to plan, so this will be in 11.6.5 TEST

@krzychu124 krzychu124 added this to the 11.6.5 milestone Feb 15, 2022
@DaEgi01
Copy link
Contributor

DaEgi01 commented Feb 15, 2022

I bet this can be written cleaner

if (1)
  if (2)
    if (3)
      if (4)

but if it works, it works :D

@krzychu124 krzychu124 merged commit d405a08 into master Feb 15, 2022
@krzychu124 krzychu124 deleted the bugfix/find-best-emergency-lane-skip-noncars branch February 15, 2022 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DLS Dynamic Lane Selection PATHFINDER Pathfinding tweaks or issues STABLE TM:PE STABLE branch TEST TEST version of the mod / workshop page
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants