Fix #7784: Vehicle tab takes 1st car colour instead of tab_vehicle's colour (#10544)

This commit is contained in:
Michael Steenbeek 2020-01-12 10:32:11 +01:00 committed by GitHub
parent 09ac8a0c59
commit f05aeb1fcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -5,6 +5,7 @@
- Feature: [#10189] Make Track Designs work in multiplayer.
- Change: [#1164] Use available translations for shortcut key bindings.
- Fix: [#5249] No collision detection when building ride entrance at heights > 85.5m.
- Fix: [#7784] Vehicle tab takes 1st car colour instead of tab_vehicle's colour.
- Fix: [#10228] Can't import RCT1 Deluxe from Steam.
- Fix: [#10313] Path furniture can be placed on level crossings.
- Fix: [#10325] Crash when banners have no text.

View File

@ -1357,7 +1357,7 @@ static void window_ride_draw_tab_vehicle(rct_drawpixelinfo* dpi, rct_window* w)
ride->subtype, ride->num_cars_per_train, rideEntry->tab_vehicle);
rct_ride_entry_vehicle* rideVehicleEntry = &rideEntry->vehicles[vehicle];
vehicle_colour vehicleColour = ride_get_vehicle_colour(ride, 0);
vehicle_colour vehicleColour = ride_get_vehicle_colour(ride, rideEntry->tab_vehicle);
int32_t spriteIndex = 32;
if (w->page == WINDOW_RIDE_PAGE_VEHICLE)
spriteIndex += w->frame_no;

View File

@ -3108,8 +3108,16 @@ vehicle_colour ride_get_vehicle_colour(Ride* ride, int32_t vehicleIndex)
{
vehicle_colour result;
// Prevent indexing array out of bounds
vehicleIndex = std::min(vehicleIndex, MAX_CARS_PER_TRAIN);
if (ride->colour_scheme_type == VEHICLE_COLOUR_SCHEME_PER_VEHICLE)
{
// Prevent indexing array out of bounds
vehicleIndex = std::min(vehicleIndex, MAX_CARS_PER_TRAIN);
}
else
{
// In this case, only the first car will be set and the rest will be either black or some residual colour.
vehicleIndex = 0;
}
result.main = ride->vehicle_colours[vehicleIndex].Body;
result.additional_1 = ride->vehicle_colours[vehicleIndex].Trim;