mirror of https://github.com/OpenRCT2/OpenRCT2.git
Register the ride set appearance action to prevent server crash (#8691)
* Register the ride set appearance action to prevent server crash * Bump network version * Copy the type back when deserialising This should really be fixed by adding RideSetAppearanceType to the dataserialiser * Switch the types to prevent possible serialiser issues
This commit is contained in:
parent
3be6137fde
commit
d03bd95598
|
@ -57,6 +57,7 @@ namespace GameActions
|
||||||
Register<RideSetColourSchemeAction>();
|
Register<RideSetColourSchemeAction>();
|
||||||
Register<RideSetNameAction>();
|
Register<RideSetNameAction>();
|
||||||
Register<RideSetStatusAction>();
|
Register<RideSetStatusAction>();
|
||||||
|
Register<RideSetAppearanceAction>();
|
||||||
Register<SetParkEntranceFeeAction>();
|
Register<SetParkEntranceFeeAction>();
|
||||||
Register<SignSetNameAction>();
|
Register<SignSetNameAction>();
|
||||||
Register<SignSetStyleAction>();
|
Register<SignSetStyleAction>();
|
||||||
|
|
|
@ -39,7 +39,7 @@ DEFINE_GAME_ACTION(RideSetAppearanceAction, GAME_COMMAND_SET_RIDE_APPEARANCE, Ga
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
NetworkRideId_t _rideIndex{ -1 };
|
NetworkRideId_t _rideIndex{ -1 };
|
||||||
RideSetAppearanceType _type;
|
uint8_t _type;
|
||||||
uint8_t _value;
|
uint8_t _value;
|
||||||
uint32_t _index;
|
uint32_t _index;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public:
|
||||||
}
|
}
|
||||||
RideSetAppearanceAction(ride_id_t rideIndex, RideSetAppearanceType type, uint8_t value, uint32_t index)
|
RideSetAppearanceAction(ride_id_t rideIndex, RideSetAppearanceType type, uint8_t value, uint32_t index)
|
||||||
: _rideIndex(rideIndex)
|
: _rideIndex(rideIndex)
|
||||||
, _type(type)
|
, _type(static_cast<uint8_t>(type))
|
||||||
, _value(value)
|
, _value(value)
|
||||||
, _index(index)
|
, _index(index)
|
||||||
{
|
{
|
||||||
|
@ -63,8 +63,7 @@ public:
|
||||||
void Serialise(DataSerialiser & stream) override
|
void Serialise(DataSerialiser & stream) override
|
||||||
{
|
{
|
||||||
GameAction::Serialise(stream);
|
GameAction::Serialise(stream);
|
||||||
auto type = static_cast<uint8_t>(_type);
|
stream << DS_TAG(_rideIndex) << DS_TAG(_type) << DS_TAG(_value) << DS_TAG(_index);
|
||||||
stream << DS_TAG(_rideIndex) << DS_TAG(type) << DS_TAG(_value) << DS_TAG(_index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GameActionResult::Ptr Query() const override
|
GameActionResult::Ptr Query() const override
|
||||||
|
@ -82,7 +81,7 @@ public:
|
||||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (_type)
|
switch (static_cast<RideSetAppearanceType>(_type))
|
||||||
{
|
{
|
||||||
case RideSetAppearanceType::TrackColourMain:
|
case RideSetAppearanceType::TrackColourMain:
|
||||||
case RideSetAppearanceType::TrackColourAdditional:
|
case RideSetAppearanceType::TrackColourAdditional:
|
||||||
|
@ -122,7 +121,7 @@ public:
|
||||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (_type)
|
switch (static_cast<RideSetAppearanceType>(_type))
|
||||||
{
|
{
|
||||||
case RideSetAppearanceType::TrackColourMain:
|
case RideSetAppearanceType::TrackColourMain:
|
||||||
ride->track_colour[_index].main = _value;
|
ride->track_colour[_index].main = _value;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
// This string specifies which version of network stream current build uses.
|
// This string specifies which version of network stream current build uses.
|
||||||
// It is used for making sure only compatible builds get connected, even within
|
// It is used for making sure only compatible builds get connected, even within
|
||||||
// single OpenRCT2 version.
|
// single OpenRCT2 version.
|
||||||
#define NETWORK_STREAM_VERSION "30"
|
#define NETWORK_STREAM_VERSION "31"
|
||||||
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
|
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
|
||||||
|
|
||||||
static rct_peep* _pickup_peep = nullptr;
|
static rct_peep* _pickup_peep = nullptr;
|
||||||
|
|
Loading…
Reference in New Issue