1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 01:22:25 +01:00

Fix #25028: Stalls can only use 1 colour preset

Co-authored-by: Gymnasiast <Gymnasiast@users.noreply.github.com>
This commit is contained in:
Jonas (Elessar2)
2025-11-16 14:56:15 +01:00
committed by GitHub
parent 7f346d6c45
commit 5c8867098d
9 changed files with 31 additions and 25 deletions

View File

@@ -70,9 +70,9 @@ set(TITLE_SEQUENCE_VERSION "0.4.26")
set(TITLE_SEQUENCE_URL "https://github.com/OpenRCT2/title-sequences/releases/download/v${TITLE_SEQUENCE_VERSION}/title-sequences.zip")
set(TITLE_SEQUENCE_SHA256 "dabb9787b1576342fca4dd9f64b3f8cfa04a7e6ce9c2bb9610f47b762905c858")
set(OBJECTS_VERSION "1.7.4")
set(OBJECTS_VERSION "1.7.5")
set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v${OBJECTS_VERSION}/objects.zip")
set(OBJECTS_SHA256 "9fa6365450cd7fe4e71d5278d67a10e6526fcd0bb1ec60120dfc66a189ac8911")
set(OBJECTS_SHA256 "c8b9d3039a920f67caf15b09e8312cc4f80d59ed7fe0288625b9ccedef606797")
set(OPENSFX_VERSION "1.0.6")
set(OPENSFX_URL "https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v${OPENSFX_VERSION}/opensound.zip")

View File

@@ -255,6 +255,7 @@ Appreciation for contributors who have provided substantial work, but are no lon
* Garrett Leach (GarrettLeach)
* Ruohao (Jater) Xu (jaterx)
* Marcel Vos (MarcelVos96)
* Jonas Doggart
## Toolchain
* (Balletie) - macOS

View File

@@ -1,5 +1,6 @@
0.4.29 (in development)
------------------------------------------------------------------------
- Improved: [#25028] Stalls now support colour presets, just like regular rides.
- Improved: [#25426] Building the track designs index is now quicker.
- Improved: [#25490] The New Ride window can now be resized.
- Fix: [#6228] The saved queue line path connections are not preserved when placing track designs (original bug).

View File

@@ -218,8 +218,8 @@
<LibsSha256 Condition="'$(Platform)'=='Win32'">490263b873dd02c13a043a04d26bb9837d2d378dacd8b2c8d29660fef44db3db</LibsSha256>
<TitleSequencesUrl>https://github.com/OpenRCT2/title-sequences/releases/download/v0.4.26/title-sequences.zip</TitleSequencesUrl>
<TitleSequencesSha256>dabb9787b1576342fca4dd9f64b3f8cfa04a7e6ce9c2bb9610f47b762905c858</TitleSequencesSha256>
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.7.4/objects.zip</ObjectsUrl>
<ObjectsSha256>9fa6365450cd7fe4e71d5278d67a10e6526fcd0bb1ec60120dfc66a189ac8911</ObjectsSha256>
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.7.5/objects.zip</ObjectsUrl>
<ObjectsSha256>c8b9d3039a920f67caf15b09e8312cc4f80d59ed7fe0288625b9ccedef606797</ObjectsSha256>
<OpenSFXUrl>https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.6/opensound.zip</OpenSFXUrl>
<OpenSFXSha256>06b90f3e19c216752df441d551b26a9e3e1ba7755bdd2102504b73bf993608be</OpenSFXSha256>
<OpenMSXUrl>https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6.1/openmusic.zip</OpenMSXUrl>

View File

@@ -31,13 +31,13 @@
namespace OpenRCT2::GameActions
{
RideCreateAction::RideCreateAction(
ride_type_t rideType, ObjectEntryIndex subType, colour_t colour1, colour_t colour2,
ride_type_t rideType, ObjectEntryIndex subType, uint8_t trackColourPreset, uint8_t vehicleColourPreset,
ObjectEntryIndex entranceObjectIndex)
: _rideType(rideType)
, _subType(subType)
, _entranceObjectIndex(entranceObjectIndex)
, _colour1(colour1)
, _colour2(colour2)
, _trackColourPreset(trackColourPreset)
, _vehicleColourPreset(vehicleColourPreset)
{
}
@@ -46,8 +46,8 @@ namespace OpenRCT2::GameActions
visitor.Visit("rideType", _rideType);
visitor.Visit("rideObject", _subType);
visitor.Visit("entranceObject", _entranceObjectIndex);
visitor.Visit("colour1", _colour1);
visitor.Visit("colour2", _colour2);
visitor.Visit("colour1", _trackColourPreset);
visitor.Visit("colour2", _vehicleColourPreset);
}
ride_type_t RideCreateAction::GetRideType() const
@@ -69,7 +69,8 @@ namespace OpenRCT2::GameActions
{
GameAction::Serialise(stream);
stream << DS_TAG(_rideType) << DS_TAG(_subType) << DS_TAG(_entranceObjectIndex) << DS_TAG(_colour1) << DS_TAG(_colour2);
stream << DS_TAG(_rideType) << DS_TAG(_subType) << DS_TAG(_entranceObjectIndex) << DS_TAG(_trackColourPreset)
<< DS_TAG(_vehicleColourPreset);
}
Result RideCreateAction::Query(GameState_t& gameState) const
@@ -95,9 +96,9 @@ namespace OpenRCT2::GameActions
}
const auto& colourPresets = GetRideTypeDescriptor(_rideType).ColourPresets;
if (_colour1 >= colourPresets.count)
if (_trackColourPreset >= colourPresets.count)
{
LOG_ERROR("Can't create ride, invalid colour preset %d", _colour1);
LOG_ERROR("Can't create ride, invalid colour preset %d", _trackColourPreset);
return Result(Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, STR_ERR_INVALID_COLOUR);
}
@@ -109,7 +110,7 @@ namespace OpenRCT2::GameActions
}
const auto* presetList = rideEntry->vehicle_preset_list;
if ((presetList->count > 0 && presetList->count != 255) && _colour2 >= presetList->count)
if ((presetList->count > 0 && presetList->count != 255) && _vehicleColourPreset >= presetList->count)
{
return Result(Status::InvalidParameters, STR_CANT_CREATE_NEW_RIDE_ATTRACTION, kStringIdNone);
}
@@ -139,7 +140,7 @@ namespace OpenRCT2::GameActions
ride->type = _rideType;
ride->subtype = rideEntryIndex;
ride->setColourPreset(_colour1);
ride->setColourPreset(_trackColourPreset, _vehicleColourPreset);
ride->overallView.SetNull();
ride->setNameToDefault();
@@ -288,7 +289,7 @@ namespace OpenRCT2::GameActions
ride->mode = ride->getDefaultMode();
ride->minCarsPerTrain = rideEntry->min_cars_in_train;
ride->maxCarsPerTrain = rideEntry->max_cars_in_train;
RideSetVehicleColoursToRandomPreset(*ride, _colour2);
RideSetVehicleColoursToRandomPreset(*ride, _vehicleColourPreset);
auto* windowMgr = Ui::GetWindowManager();
windowMgr->InvalidateByClass(WindowClass::rideList);

View File

@@ -19,13 +19,13 @@ namespace OpenRCT2::GameActions
ride_type_t _rideType{ kRideTypeNull };
ObjectEntryIndex _subType{ kObjectEntryIndexNull };
ObjectEntryIndex _entranceObjectIndex{ kObjectEntryIndexNull };
colour_t _colour1{ COLOUR_NULL };
colour_t _colour2{ COLOUR_NULL };
uint8_t _trackColourPreset{ COLOUR_NULL };
uint8_t _vehicleColourPreset{ COLOUR_NULL };
public:
RideCreateAction() = default;
RideCreateAction(
ride_type_t rideType, ObjectEntryIndex subType, colour_t colour1, colour_t colour2,
ride_type_t rideType, ObjectEntryIndex subType, uint8_t trackColourPreset, uint8_t vehicleColourPreset,
ObjectEntryIndex entranceStyleIndex);
void AcceptParameters(GameActionParameterVisitor&) final;

View File

@@ -47,7 +47,7 @@
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
constexpr uint8_t kStreamVersion = 2;
constexpr uint8_t kStreamVersion = 3;
const std::string kStreamID = std::string(kOpenRCT2Version) + "-" + std::to_string(kStreamVersion);

View File

@@ -4347,7 +4347,7 @@ int32_t RideGetRandomColourPresetIndex(ride_type_t rideType)
*
* Based on rct2: 0x006B4776
*/
void Ride::setColourPreset(uint8_t index)
void Ride::setColourPreset(uint8_t trackColourPreset, uint8_t vehicleColourPreset)
{
const TrackColourPresetList* colourPresets = &getRideTypeDescriptor().ColourPresets;
TrackColour colours = { COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK };
@@ -4357,13 +4357,16 @@ void Ride::setColourPreset(uint8_t index)
const auto* rideEntry = GetRideEntryByIndex(subtype);
if (rideEntry != nullptr && rideEntry->vehicle_preset_list->count > 0)
{
auto list = rideEntry->vehicle_preset_list->list[0];
colours = { list.Body, list.Trim, list.Tertiary };
if (vehicleColourPreset < rideEntry->vehicle_preset_list->count)
{
auto list = rideEntry->vehicle_preset_list->list[vehicleColourPreset];
colours = { list.Body, list.Trim, list.Tertiary };
}
}
}
else if (index < colourPresets->count)
else if (trackColourPreset < colourPresets->count)
{
colours = colourPresets->list[index];
colours = colourPresets->list[trackColourPreset];
}
for (size_t i = 0; i < std::size(trackColours); i++)
{

View File

@@ -380,7 +380,7 @@ public:
RideMode getDefaultMode() const;
void setColourPreset(uint8_t index);
void setColourPreset(uint8_t trackColourPreset, uint8_t vehicleColourPreset);
const RideObjectEntry* getRideEntry() const;