Skip to content

Commit

Permalink
Replace some leftover use of uint8_t for ride subtype
Browse files Browse the repository at this point in the history
  • Loading branch information
Gymnasiast committed Jan 15, 2021
1 parent 5cd3014 commit 32d8dad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/openrct2/ride/Ride.cpp
Expand Up @@ -3107,11 +3107,11 @@ vehicle_colour ride_get_vehicle_colour(Ride* ride, int32_t vehicleIndex)
return result;
}

static bool ride_does_vehicle_colour_exist(uint8_t ride_sub_type, vehicle_colour* vehicleColour)
static bool ride_does_vehicle_colour_exist(ObjectEntryIndex subType, vehicle_colour* vehicleColour)
{
for (auto& ride : GetRideManager())
{
if (ride.subtype != ride_sub_type)
if (ride.subtype != subType)
continue;
if (ride.vehicle_colours[0].Body != vehicleColour->main)
continue;
Expand All @@ -3120,13 +3120,13 @@ static bool ride_does_vehicle_colour_exist(uint8_t ride_sub_type, vehicle_colour
return true;
}

int32_t ride_get_unused_preset_vehicle_colour(uint8_t ride_sub_type)
int32_t ride_get_unused_preset_vehicle_colour(ObjectEntryIndex subType)
{
if (ride_sub_type >= MAX_RIDE_OBJECTS)
if (subType >= MAX_RIDE_OBJECTS)
{
return 0;
}
rct_ride_entry* rideEntry = get_ride_entry(ride_sub_type);
rct_ride_entry* rideEntry = get_ride_entry(subType);
if (rideEntry == nullptr)
{
return 0;
Expand All @@ -3143,7 +3143,7 @@ int32_t ride_get_unused_preset_vehicle_colour(uint8_t ride_sub_type)
int32_t randomConfigIndex = util_rand() % numColourConfigurations;
vehicle_colour* preset = &presetList->list[randomConfigIndex];

if (ride_does_vehicle_colour_exist(ride_sub_type, preset))
if (ride_does_vehicle_colour_exist(subType, preset))
{
return randomConfigIndex;
}
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/ride/Ride.h
Expand Up @@ -1126,7 +1126,7 @@ int32_t ride_get_total_length(const Ride* ride);
int32_t ride_get_total_time(Ride* ride);
TrackColour ride_get_track_colour(Ride* ride, int32_t colourScheme);
vehicle_colour ride_get_vehicle_colour(Ride* ride, int32_t vehicleIndex);
int32_t ride_get_unused_preset_vehicle_colour(uint8_t ride_sub_type);
int32_t ride_get_unused_preset_vehicle_colour(ObjectEntryIndex subType);
void ride_set_vehicle_colours_to_random_preset(Ride* ride, uint8_t preset_index);
void ride_measurements_update();
void ride_breakdown_add_news_item(Ride* ride);
Expand Down

0 comments on commit 32d8dad

Please sign in to comment.