Apply code review suggestions

This commit is contained in:
Ted John 2021-03-12 21:26:22 +00:00
parent 4b9c704096
commit 87dc006b8c
1 changed files with 6 additions and 4 deletions

View File

@ -200,8 +200,11 @@ void research_finish_item(ResearchItem* researchItem)
if (rideEntry != nullptr && base_ride_type != RIDE_TYPE_NULL)
{
if (base_ride_type >= RIDE_TYPE_COUNT)
if (RideTypeIsValid(base_ride_type))
{
log_warning("Invalid ride type: %d", base_ride_type);
base_ride_type = ride_entry_get_first_non_null_ride_type(rideEntry);
}
rct_string_id availabilityString;
ride_type_set_invented(base_ride_type);
@ -528,8 +531,7 @@ bool research_insert_scenery_group_entry(ObjectEntryIndex entryIndex, bool resea
bool ride_type_is_invented(uint32_t rideType)
{
Guard::Assert(rideType < std::size(_researchedRideTypes), GUARD_LINE);
return _researchedRideTypes[rideType];
return RideTypeIsValid(rideType) ? _researchedRideTypes[rideType] : false;
}
bool ride_entry_is_invented(int32_t rideEntryIndex)
@ -539,7 +541,7 @@ bool ride_entry_is_invented(int32_t rideEntryIndex)
void ride_type_set_invented(uint32_t rideType)
{
if (rideType < std::size(_researchedRideTypes))
if (RideTypeIsValid(rideType))
{
_researchedRideTypes[rideType] = true;
}