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

NPF bails out when source tile is also a destination tile #7114

merged 5 commits into from Jan 31, 2019


Copy link

J0anJosep commented Jan 26, 2019

If the tile a vehicle is leaving is also a valid destination tile, NPF just returns INVALID_TRACKDIR and does no pathfinding at all.

As NPF(Ship-Train-RoadVehicle)ChooseTrack call the pathfinder with the NPF_FLAG_IGNORE_START_TILE set, use it for not accepting the starting tile as a valid destination tile.

Please, do a thorough review of this PR and make sure it doesn't create any new bug.


This comment has been minimized.

Copy link

SamuXarick commented Jan 30, 2019

I tried to trigger the asserts. Tried by ordering a ship to go to depot right after leaving it, it walks now, no longer doing 180º reverse.

Tried no tracks in front of the ship, of a train, and road vehicle, and the asserts don't trigger. It's always chosing a track different than invalid.

I also checked with river generation. Doesn't make any difference. The code there always require that the river has moved one step minimum from a tile to another.

@LordAro LordAro merged commit 029c48c into OpenTTD:master Jan 31, 2019
1 check passed
1 check passed
OpenTTD CI Build #20190126.29 succeeded
PeterN added a commit to PeterN/OpenTTD that referenced this pull request Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.