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
merged 5 commits into from Jan 31, 2019

Conversation

J0anJosep
Copy link
Contributor

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.

@SamuXarick
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants