mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
Fix #17541: Station style not correctly saved to TD6
This commit is contained in:
parent
a75cc10dd5
commit
6852b184b6
4 changed files with 32 additions and 1 deletions
|
@ -17,6 +17,7 @@
|
|||
- Fix: [#17503] Parks with staff with an ID of 0 have all staff windows focus on that staff.
|
||||
- Fix: [#17508] Grid doesn’t disable after setting patrol area.
|
||||
- Fix: [#17533] Missing audio when specifying ‘--rct2-data-path’.
|
||||
- Fix: [#17541] Station style not correctly saved to TD6.
|
||||
- Fix: [#17553] Crash when moving invention list items to empty list.
|
||||
- Fix: [#17605] Crash when opening parks which have had objects removed externally.
|
||||
|
||||
|
|
|
@ -743,6 +743,23 @@ std::string_view GetStationIdentifierFromStyle(uint8_t style)
|
|||
return {};
|
||||
}
|
||||
|
||||
uint8_t GetStationStyleFromIdentifier(u8string_view identifier)
|
||||
{
|
||||
// Not supported in TD6, closest match.
|
||||
if (identifier == "openrct2.station.noplatformnoentrance")
|
||||
return RCT12_STATION_STYLE_INVISIBLE;
|
||||
|
||||
for (uint8_t i = RCT12_STATION_STYLE_PLAIN; i < std::size(_stationStyles); i++)
|
||||
{
|
||||
if (_stationStyles[i] == identifier)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return RCT12_STATION_STYLE_PLAIN;
|
||||
}
|
||||
|
||||
std::optional<uint8_t> GetStyleFromMusicIdentifier(std::string_view identifier)
|
||||
{
|
||||
auto it = std::find(std::begin(_musicStyles), std::end(_musicStyles), identifier);
|
||||
|
|
|
@ -854,6 +854,7 @@ std::string ConvertFormattedStringToOpenRCT2(std::string_view buffer);
|
|||
track_type_t RCT12FlatTrackTypeToOpenRCT2(RCT12TrackType origTrackType);
|
||||
RCT12TrackType OpenRCT2FlatTrackTypeToRCT12(track_type_t origTrackType);
|
||||
std::string_view GetStationIdentifierFromStyle(uint8_t style);
|
||||
uint8_t GetStationStyleFromIdentifier(u8string_view identifier);
|
||||
std::optional<uint8_t> GetStyleFromMusicIdentifier(std::string_view identifier);
|
||||
void RCT12AddDefaultObjects(ObjectList& objectList);
|
||||
void AppendRequiredObjects(ObjectList& objectList, ObjectType objectType, const RCT12::EntryList& entryList);
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "../object/ObjectList.h"
|
||||
#include "../object/ObjectManager.h"
|
||||
#include "../object/ObjectRepository.h"
|
||||
#include "../object/StationObject.h"
|
||||
#include "../rct1/RCT1.h"
|
||||
#include "../rct1/Tables.h"
|
||||
#include "../ride/RideConstruction.h"
|
||||
|
@ -79,6 +80,17 @@ static bool _trackDesignPlaceStateEntranceExitPlaced{};
|
|||
|
||||
static void TrackDesignPreviewClearMap();
|
||||
|
||||
static uint8_t TrackDesignGetEntranceStyle(const Ride& ride)
|
||||
{
|
||||
const auto* stationObject = ride.GetStationObject();
|
||||
if (stationObject == nullptr)
|
||||
return RCT12_STATION_STYLE_PLAIN;
|
||||
|
||||
const auto objectName = stationObject->GetIdentifier();
|
||||
|
||||
return GetStationStyleFromIdentifier(objectName);
|
||||
}
|
||||
|
||||
rct_string_id TrackDesign::CreateTrackDesign(TrackDesignState& tds, const Ride& ride)
|
||||
{
|
||||
type = ride.type;
|
||||
|
@ -121,7 +133,7 @@ rct_string_id TrackDesign::CreateTrackDesign(TrackDesignState& tds, const Ride&
|
|||
lift_hill_speed = ride.lift_hill_speed;
|
||||
num_circuits = ride.num_circuits;
|
||||
|
||||
entrance_style = ride.entrance_style;
|
||||
entrance_style = TrackDesignGetEntranceStyle(ride);
|
||||
max_speed = static_cast<int8_t>(ride.max_speed / 65536);
|
||||
average_speed = static_cast<int8_t>(ride.average_speed / 65536);
|
||||
ride_length = ride.GetTotalLength() / 65536;
|
||||
|
|
Loading…
Reference in a new issue