1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Fix #16234: Wrap vehicle colors when there are more than 32 trains (#16323)

* Wrap vehicle_colours in TrackDesignAction

* Wrap the color presets in set_vehicle_colours_to_random_preset

* Increment network version

* Update changelog.txt

Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
This commit is contained in:
GalBr
2022-01-09 00:03:58 +02:00
committed by GitHub
parent 47f126f1f0
commit fae4e6323f
4 changed files with 6 additions and 4 deletions

View File

@@ -24,6 +24,7 @@
- Fix: [#15998] Cannot set map size to the actual maximum.
- Fix: [#16007] Scenario Editor "Entry Price" appears to the right of the value field.
- Fix: [#16008] Tile Inspector can select elements from last tile without reselecting it.
- Fix: [#16024] Go-Karts with more thant 32 vehicles do not color themselves correctly.
- Fix: [#16063] Object Selection preview for objects with glass is broken.
- Fix: [#16075] Exporting track designs saves scenery in incorrect locations.
- Fix: [#16087] The Looping Roller Coaster booster is now always drawn correctly.

View File

@@ -259,7 +259,7 @@ GameActions::Result TrackDesignAction::Execute() const
for (size_t i = 0; i <= MAX_VEHICLES_PER_RIDE; i++)
{
auto tdIndex = std::min(i, std::size(_td.vehicle_colours) - 1);
auto tdIndex = i % std::size(_td.vehicle_colours);
ride->vehicle_colours[i].Body = _td.vehicle_colours[tdIndex].body_colour;
ride->vehicle_colours[i].Trim = _td.vehicle_colours[tdIndex].trim_colour;
ride->vehicle_colours[i].Ternary = _td.vehicle_additional_colour[tdIndex];

View File

@@ -41,7 +41,7 @@
// This string specifies which version of network stream current build uses.
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "9"
#define NETWORK_STREAM_VERSION "10"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static Peep* _pickup_peep = nullptr;

View File

@@ -2164,10 +2164,11 @@ void ride_set_vehicle_colours_to_random_preset(Ride* ride, uint8_t preset_index)
else
{
ride->colour_scheme_type = RIDE_COLOUR_SCHEME_DIFFERENT_PER_TRAIN;
uint32_t count = std::min(presetList->count, static_cast<uint8_t>(32));
uint32_t count = presetList->count;
for (uint32_t i = 0; i < count; i++)
{
VehicleColour* preset = &presetList->list[i];
auto index = i % static_cast<uint8_t>(32);
VehicleColour* preset = &presetList->list[index];
ride->vehicle_colours[i] = *preset;
}
}