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: Assertion failure when post road-works cleanup removes all road pieces #7903

Conversation

JGRennison
Copy link
Contributor

When road works have completed on a tile, if _settings_game.economy.mod_road_rebuild is true, CleanUpRoadBits() may remove all road bits currently on the tile.
In this case, after RemoveRoad() is called, the tile is no longer a road tile.
The subsequent call to GetRoadOwner() causes an assertion failure.

Once RemoveRoad() is called in this case, TileLoop_Road() should return early as the tile is no longer a road tile and all subsequent road tile checks/actions are no longer applicable.

Copy link
Contributor

@nielsmh nielsmh left a comment

Choose a reason for hiding this comment

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

Looks correct. I don't understand why this can remove all road bits from a tile though, that sounds slightly weird, but is a separate discussion.

@LordAro LordAro merged commit 12380fc into OpenTTD:master Jan 5, 2020
@JGRennison JGRennison deleted the fix-post-road-works-cleanup-assertion-failure branch January 9, 2024 19:16
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

3 participants