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

Fix: [AI/GS] CanBuildConnectedRoadPartsHere neighbours tiles were at times incorrect #8036

Conversation

SamuXarick
Copy link
Contributor

@SamuXarick SamuXarick commented Mar 13, 2020

This bug was very difficult to reproduce.
Seems to happen when the map size changes between a save and another. In the first map that has an AI calling this function for the first time, the neighbours diffs are calculated. The next calls, no longer recomputes the neighbour diffs. If I now load a save of a different map size, the neighbours are still of the previous map.

PS: I request backport, if that is still possible. My AI makes heavy use of this function with the pathfinder routine.

Copy link
Contributor

@glx22 glx22 left a comment

Choose a reason for hiding this comment

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

Nice catch. This removes some optimisations, but I don't think there's an easy way to cache this array.

@glx22 glx22 added the backport requested This PR should be backport to current release (RC / stable) label Mar 13, 2020
@ldpl
Copy link
Contributor

ldpl commented Mar 13, 2020

It's not that hard to cache, same as other _map size variables. Just probably not worth it.

@LordAro LordAro merged commit 971201b into OpenTTD:master Mar 13, 2020
@SamuXarick SamuXarick deleted the CanBuildConnectedRoadPartsHere-incorrect-neighbours branch March 13, 2020 18:12
@LordAro LordAro added backported This PR is backported to a current release (RC / stable) and removed backport requested This PR should be backport to current release (RC / stable) labels Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported This PR is backported to a current release (RC / stable)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants