mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Allow different default colours per stall
This commit is contained in:
@@ -550,6 +550,8 @@ void RideObject::ReadJson(IReadObjectContext* context, const json_t* root)
|
||||
_legacyType.shop_item = SHOP_ITEM_NONE;
|
||||
_legacyType.shop_item_secondary = SHOP_ITEM_NONE;
|
||||
|
||||
_presetColours = ReadJsonCarColours(json_object_get(properties, "carColours"));
|
||||
|
||||
if (IsRideTypeShopOrFacility(_legacyType.ride_type[0]))
|
||||
{
|
||||
// Standard car info for a shop
|
||||
@@ -623,7 +625,6 @@ void RideObject::ReadJson(IReadObjectContext* context, const json_t* root)
|
||||
}
|
||||
|
||||
auto availableTrackPieces = ObjectJsonHelpers::GetJsonStringArray(json_object_get(properties, "availableTrackPieces"));
|
||||
_presetColours = ReadJsonCarColours(json_object_get(properties, "carColours"));
|
||||
}
|
||||
|
||||
_legacyType.flags |= ObjectJsonHelpers::GetFlags<uint32_t>(
|
||||
|
||||
@@ -216,6 +216,7 @@ static void ride_shop_connected(Ride* ride);
|
||||
static void ride_spiral_slide_update(Ride* ride);
|
||||
static void ride_update(Ride* ride);
|
||||
void loc_6DDF9C(Ride* ride, TileElement* tileElement);
|
||||
static bool ride_is_ride(Ride* ride);
|
||||
|
||||
Ride* get_ride(int32_t index)
|
||||
{
|
||||
@@ -5898,7 +5899,17 @@ void ride_set_colour_preset(Ride* ride, uint8_t index)
|
||||
{
|
||||
const track_colour_preset_list* colourPresets = &RideColourPresets[ride->type];
|
||||
TrackColour colours = { COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK };
|
||||
if (index < colourPresets->count)
|
||||
// Stalls save their default colour in the vehicle settings (since they share a common ride type)
|
||||
if (!ride_is_ride(ride))
|
||||
{
|
||||
auto rideEntry = get_ride_entry(ride->subtype);
|
||||
if (rideEntry != nullptr && rideEntry->vehicle_preset_list->count > 0)
|
||||
{
|
||||
auto list = rideEntry->vehicle_preset_list->list[0];
|
||||
colours = { list.main, list.additional_1, list.additional_2 };
|
||||
}
|
||||
}
|
||||
else if (index < colourPresets->count)
|
||||
{
|
||||
colours = colourPresets->list[index];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user