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: Assert from towns looking outside map when trying to build tunnels #8600

Merged
merged 1 commit into from Jan 31, 2021

Conversation

2TallTyler
Copy link
Member

Motivation / Problem

@SamuXarick reported an assertion error during map generation related to GrowTownWithTunnel() checking the slope of a tile outside the map.

Description

When looking up the slope to measure the height of the mountain, the town needs to check the validity of the tile before attempting to measure the slope. Checking a tile outside the map would produce an assertion error in TileHeight() via GetTileSlope(), as in the crash report linked above.

Limitations

I cannot reliably reproduce the assertion error in Scenario Editor or during live gameplay, so testing is based on repeatedly running map generation with and without this change.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

src/town_cmd.cpp Show resolved Hide resolved
@TrueBrain TrueBrain merged commit 1dda7d6 into OpenTTD:master Jan 31, 2021
@2TallTyler 2TallTyler deleted the fix_tunnel_assert branch January 31, 2021 12:32
@2TallTyler 2TallTyler restored the fix_tunnel_assert branch February 24, 2021 21:44
@2TallTyler 2TallTyler deleted the fix_tunnel_assert branch February 27, 2021 16:45
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