Skip to content

Commit

Permalink
Remove some hardcoded numbers (#11004)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gymnasiast committed Mar 23, 2020
1 parent 9860f1e commit e66a675
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/openrct2/actions/RideCreateAction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ DEFINE_GAME_ACTION(RideCreateAction, GAME_COMMAND_CREATE_RIDE, RideCreateGameAct
}

int32_t rideEntryIndex = ride_get_entry_index(_rideType, _subType);
if (rideEntryIndex >= 128)
if (rideEntryIndex >= MAX_RIDE_OBJECTS)
{
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_INVALID_RIDE_TYPE);
}
Expand Down
4 changes: 2 additions & 2 deletions src/openrct2/ride/Ride.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3062,7 +3062,7 @@ static bool ride_does_vehicle_colour_exist(uint8_t ride_sub_type, vehicle_colour

int32_t ride_get_unused_preset_vehicle_colour(uint8_t ride_sub_type)
{
if (ride_sub_type >= 128)
if (ride_sub_type >= MAX_RIDE_OBJECTS)
{
return 0;
}
Expand Down Expand Up @@ -5554,7 +5554,7 @@ bool Ride::NameExists(const std::string_view& name, ride_id_t excludeRideId)
*/
int32_t ride_get_random_colour_preset_index(uint8_t ride_type)
{
if (ride_type >= 128)
if (ride_type >= std::size(RideColourPresets))
{
return 0;
}
Expand Down

0 comments on commit e66a675

Please sign in to comment.