mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 23:34:37 +01:00
Merge pull request #16544 from ZehMatt/desync/gLastStationStyle
Refactor usage of gLastEntranceStyle
This commit is contained in:
@@ -68,9 +68,9 @@ set(OBJECTS_VERSION "1.2.6")
|
||||
set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v${OBJECTS_VERSION}/objects.zip")
|
||||
set(OBJECTS_SHA1 "cd86dd2e42edb513b18293ef7ae52a93a7cdfc57")
|
||||
|
||||
set(REPLAYS_VERSION "0.0.62")
|
||||
set(REPLAYS_VERSION "0.0.63")
|
||||
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v${REPLAYS_VERSION}/replays.zip")
|
||||
set(REPLAYS_SHA1 "0B234FA152AFA49F5204ADA97CBAAE39A538961B")
|
||||
set(REPLAYS_SHA1 "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709")
|
||||
|
||||
option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.")
|
||||
option(WITH_TESTS "Build tests")
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
<TitleSequencesSha1>304d13a126c15bf2c86ff13b81a2f2cc1856ac8d</TitleSequencesSha1>
|
||||
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.2.6/objects.zip</ObjectsUrl>
|
||||
<ObjectsSha1>cd86dd2e42edb513b18293ef7ae52a93a7cdfc57</ObjectsSha1>
|
||||
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.62/replays.zip</ReplaysUrl>
|
||||
<ReplaysSha1>0B234FA152AFA49F5204ADA97CBAAE39A538961B</ReplaysSha1>
|
||||
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.63/replays.zip</ReplaysUrl>
|
||||
<ReplaysSha1>DA39A3EE5E6B4B0D3255BFEF95601890AFD80709</ReplaysSha1>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4496,6 +4496,11 @@ static void WindowRideColourDropdown(rct_window* w, rct_widgetindex widgetIndex,
|
||||
{
|
||||
auto rideSetAppearanceAction = RideSetAppearanceAction(
|
||||
rideId, RideSetAppearanceType::EntranceStyle, ddIndex, 0);
|
||||
rideSetAppearanceAction.SetCallback([ddIndex](const GameAction*, const GameActions::Result* res) {
|
||||
if (res->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
gLastEntranceStyle = ddIndex;
|
||||
});
|
||||
GameActions::Execute(&rideSetAppearanceAction);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ void ride_construct_new(RideSelection listItem)
|
||||
int32_t colour1 = ride_get_random_colour_preset_index(listItem.Type);
|
||||
int32_t colour2 = ride_get_unused_preset_vehicle_colour(rideEntryIndex);
|
||||
|
||||
auto gameAction = RideCreateAction(listItem.Type, listItem.EntryIndex, colour1, colour2);
|
||||
auto gameAction = RideCreateAction(listItem.Type, listItem.EntryIndex, colour1, colour2, gLastEntranceStyle);
|
||||
|
||||
gameAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
|
||||
@@ -27,9 +27,11 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
RideCreateAction::RideCreateAction(int32_t rideType, ObjectEntryIndex subType, int32_t colour1, int32_t colour2)
|
||||
RideCreateAction::RideCreateAction(
|
||||
int32_t rideType, ObjectEntryIndex subType, int32_t colour1, int32_t colour2, ObjectEntryIndex entranceObjectIndex)
|
||||
: _rideType(rideType)
|
||||
, _subType(subType)
|
||||
, _entranceObjectIndex(entranceObjectIndex)
|
||||
, _colour1(colour1)
|
||||
, _colour2(colour2)
|
||||
{
|
||||
@@ -39,6 +41,7 @@ void RideCreateAction::AcceptParameters(GameActionParameterVisitor& visitor)
|
||||
{
|
||||
visitor.Visit("rideType", _rideType);
|
||||
visitor.Visit("rideObject", _subType);
|
||||
visitor.Visit("entranceObject", _entranceObjectIndex);
|
||||
visitor.Visit("colour1", _colour1);
|
||||
visitor.Visit("colour2", _colour2);
|
||||
}
|
||||
@@ -62,7 +65,7 @@ void RideCreateAction::Serialise(DataSerialiser& stream)
|
||||
{
|
||||
GameAction::Serialise(stream);
|
||||
|
||||
stream << DS_TAG(_rideType) << DS_TAG(_subType) << DS_TAG(_colour1) << DS_TAG(_colour2);
|
||||
stream << DS_TAG(_rideType) << DS_TAG(_subType) << DS_TAG(_entranceObjectIndex) << DS_TAG(_colour1) << DS_TAG(_colour2);
|
||||
}
|
||||
|
||||
GameActions::Result RideCreateAction::Query() const
|
||||
@@ -293,7 +296,7 @@ GameActions::Result RideCreateAction::Execute() const
|
||||
ride->entrance_style = OBJECT_ENTRY_INDEX_NULL;
|
||||
if (rtd.HasFlag(RIDE_TYPE_FLAG_HAS_ENTRANCE_EXIT))
|
||||
{
|
||||
ride->entrance_style = gLastEntranceStyle;
|
||||
ride->entrance_style = _entranceObjectIndex;
|
||||
}
|
||||
|
||||
ride->num_block_brakes = 0;
|
||||
|
||||
@@ -16,12 +16,14 @@ class RideCreateAction final : public GameActionBase<GameCommand::CreateRide>
|
||||
private:
|
||||
ObjectEntryIndex _rideType{ OBJECT_ENTRY_INDEX_NULL };
|
||||
ObjectEntryIndex _subType{ OBJECT_ENTRY_INDEX_NULL };
|
||||
ObjectEntryIndex _entranceObjectIndex{ OBJECT_ENTRY_INDEX_NULL };
|
||||
uint8_t _colour1{ 0xFF };
|
||||
uint8_t _colour2{ 0xFF };
|
||||
|
||||
public:
|
||||
RideCreateAction() = default;
|
||||
RideCreateAction(int32_t rideType, ObjectEntryIndex subType, int32_t colour1, int32_t colour2);
|
||||
RideCreateAction(
|
||||
int32_t rideType, ObjectEntryIndex subType, int32_t colour1, int32_t colour2, ObjectEntryIndex entranceStyleIndex);
|
||||
|
||||
void AcceptParameters(GameActionParameterVisitor& visitor) override;
|
||||
|
||||
|
||||
@@ -135,7 +135,6 @@ GameActions::Result RideSetAppearanceAction::Execute() const
|
||||
break;
|
||||
case RideSetAppearanceType::EntranceStyle:
|
||||
ride->entrance_style = _value;
|
||||
gLastEntranceStyle = _value;
|
||||
gfx_invalidate_screen();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ GameActions::Result TrackDesignAction::Query() const
|
||||
}
|
||||
|
||||
// Colours do not matter as will be overwritten
|
||||
auto rideCreateAction = RideCreateAction(_td.type, entryIndex, 0, 0);
|
||||
auto rideCreateAction = RideCreateAction(_td.type, entryIndex, 0, 0, gLastEntranceStyle);
|
||||
rideCreateAction.SetFlags(GetFlags());
|
||||
auto r = GameActions::ExecuteNested(&rideCreateAction);
|
||||
if (r.Error != GameActions::Status::Ok)
|
||||
@@ -148,7 +148,7 @@ GameActions::Result TrackDesignAction::Execute() const
|
||||
}
|
||||
|
||||
// Colours do not matter as will be overwritten
|
||||
auto rideCreateAction = RideCreateAction(_td.type, entryIndex, 0, 0);
|
||||
auto rideCreateAction = RideCreateAction(_td.type, entryIndex, 0, 0, gLastEntranceStyle);
|
||||
rideCreateAction.SetFlags(GetFlags());
|
||||
auto r = GameActions::ExecuteNested(&rideCreateAction);
|
||||
if (r.Error != GameActions::Status::Ok)
|
||||
|
||||
@@ -42,7 +42,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 "12"
|
||||
#define NETWORK_STREAM_VERSION "13"
|
||||
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
|
||||
|
||||
static Peep* _pickup_peep = nullptr;
|
||||
|
||||
@@ -1920,7 +1920,7 @@ int32_t TrackDesignGetZPlacement(TrackDesign* td6, Ride* ride, const CoordsXYZ&
|
||||
static money32 TrackDesignCreateRide(int32_t type, int32_t subType, int32_t flags, ride_id_t* outRideIndex)
|
||||
{
|
||||
// Don't set colours as will be set correctly later.
|
||||
auto gameAction = RideCreateAction(type, subType, 0, 0);
|
||||
auto gameAction = RideCreateAction(type, subType, 0, 0, gLastEntranceStyle);
|
||||
gameAction.SetFlags(flags);
|
||||
|
||||
auto res = GameActions::ExecuteNested(&gameAction);
|
||||
|
||||
Reference in New Issue
Block a user