1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +01:00

Improve bound checking on scenery invention (#11171)

This commit is contained in:
Tulio Leao
2020-04-03 08:31:13 -03:00
committed by GitHub
parent 08d38f3d24
commit 6cf113ae6f

View File

@@ -601,20 +601,39 @@ void ride_entry_set_invented(int32_t rideEntryIndex)
bool scenery_is_invented(const ScenerySelection& sceneryItem)
{
assert(sceneryItem.SceneryType < SCENERY_TYPE_COUNT);
return _researchedSceneryItems[sceneryItem.SceneryType][sceneryItem.EntryIndex];
if (sceneryItem.SceneryType < SCENERY_TYPE_COUNT)
{
return _researchedSceneryItems[sceneryItem.SceneryType][sceneryItem.EntryIndex];
}
else
{
log_warning("Invalid Scenery Type");
return false;
}
}
void scenery_set_invented(const ScenerySelection& sceneryItem)
{
assert(sceneryItem.SceneryType < SCENERY_TYPE_COUNT);
_researchedSceneryItems[sceneryItem.SceneryType][sceneryItem.EntryIndex] = true;
if (sceneryItem.SceneryType < SCENERY_TYPE_COUNT)
{
_researchedSceneryItems[sceneryItem.SceneryType][sceneryItem.EntryIndex] = true;
}
else
{
log_warning("Invalid Scenery Type");
}
}
void scenery_set_not_invented(const ScenerySelection& sceneryItem)
{
assert(sceneryItem.SceneryType < SCENERY_TYPE_COUNT);
_researchedSceneryItems[sceneryItem.SceneryType][sceneryItem.EntryIndex] = false;
if (sceneryItem.SceneryType < SCENERY_TYPE_COUNT)
{
_researchedSceneryItems[sceneryItem.SceneryType][sceneryItem.EntryIndex] = false;
}
else
{
log_warning("Invalid Scenery Type");
}
}
bool scenery_group_is_invented(int32_t sgIndex)