Avoid assertion getting hit in scenery_is_invented() (#11079)

This commit is contained in:
Michael Steenbeek 2020-03-27 12:53:18 +01:00 committed by GitHub
parent b70c5cefd6
commit c6e42ac313
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -882,6 +882,11 @@ void S6Exporter::ExportResearchedSceneryItems()
{
ScenerySelection scenerySelection = { static_cast<uint8_t>((sceneryEntryIndex >> 8) & 0xFF),
static_cast<uint16_t>(sceneryEntryIndex & 0xFF) };
// SV6 allows for more scenery types than there are. Avoid triggering an assertion in scenery_is_invented().
if (scenerySelection.SceneryType >= SCENERY_TYPE_COUNT)
break;
if (scenery_is_invented(scenerySelection))
{
int32_t quadIndex = sceneryEntryIndex >> 5;