diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index c4326152fb..f26fdc4927 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3721,6 +3721,7 @@ STR_6270 :Terrain Surfaces STR_6271 :Terrain Edges STR_6272 :Stations STR_6273 :Music +STR_6274 :Can't set colour scheme... ############# # Scenarios # diff --git a/distribution/changelog.txt b/distribution/changelog.txt index f61e7a3915..f57bbd5370 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -15,6 +15,7 @@ - Feature: [#8259] Add say command to in-game console. - Change: [#7961] Add new object types: station, terrain surface, and terrain edge. - Change: [#8222] The climate setting has been moved from objective options to scenario options. +- Fix: [#3832] Changing the colour scheme of track pieces does not work in multiplayer. - Fix: [#6191] OpenRCT2 fails to run when the path has an emoji in it. - Fix: [#7439] Placement messages have mixed strings - Fix: [#7473] Disabling sound effects also disables "Disable audio on focus loss". diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index b6bd3aa14b..2441d874ed 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -4286,7 +4288,8 @@ static void window_ride_set_track_colour_scheme(rct_window* w, int32_t x, int32_ z = tileElement->base_height * 8; direction = tileElement->GetDirection(); - sub_6C683D(&x, &y, &z, direction, tileElement->AsTrack()->GetTrackType(), newColourScheme, nullptr, 4); + auto gameAction = RideSetColourSchemeAction(x, y, z, direction, tileElement->AsTrack()->GetTrackType(), newColourScheme); + GameActions::Execute(&gameAction); } /** diff --git a/src/openrct2/Game.h b/src/openrct2/Game.h index c26b00aefe..3dc212571c 100644 --- a/src/openrct2/Game.h +++ b/src/openrct2/Game.h @@ -88,8 +88,9 @@ enum GAME_COMMAND GAME_COMMAND_BALLOON_PRESS, GAME_COMMAND_MODIFY_TILE, GAME_COMMAND_EDIT_SCENARIO_OPTIONS, - GAME_COMMAND_PLACE_PEEP_SPAWN, // GA, TODO: refactor to separate array for just game actions - GAME_COMMAND_SET_CLIMATE, // GA + GAME_COMMAND_PLACE_PEEP_SPAWN, // GA, TODO: refactor to separate array for just game actions + GAME_COMMAND_SET_CLIMATE, // GA + GAME_COMMAND_SET_COLOUR_SCHEME, // GA GAME_COMMAND_COUNT, }; diff --git a/src/openrct2/actions/GameActionRegistration.cpp b/src/openrct2/actions/GameActionRegistration.cpp index 6ae3a6ce5d..d5c77b8671 100644 --- a/src/openrct2/actions/GameActionRegistration.cpp +++ b/src/openrct2/actions/GameActionRegistration.cpp @@ -21,6 +21,7 @@ #include "PlacePeepSpawnAction.hpp" #include "RideCreateAction.hpp" #include "RideDemolishAction.hpp" +#include "RideSetColourScheme.hpp" #include "RideSetName.hpp" #include "RideSetStatus.hpp" #include "SetParkEntranceFeeAction.hpp" @@ -46,6 +47,7 @@ namespace GameActions Register(); Register(); Register(); + Register(); Register(); Register(); Register(); diff --git a/src/openrct2/actions/RideSetColourScheme.hpp b/src/openrct2/actions/RideSetColourScheme.hpp new file mode 100644 index 0000000000..4ae5a8c5a6 --- /dev/null +++ b/src/openrct2/actions/RideSetColourScheme.hpp @@ -0,0 +1,71 @@ +/***************************************************************************** + * Copyright (c) 2014-2018 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include "../Cheats.h" +#include "../common.h" +#include "../core/MemoryStream.h" +#include "../interface/Window.h" +#include "../localisation/Localisation.h" +#include "../localisation/StringIds.h" +#include "../management/Finance.h" +#include "../ride/Ride.h" +#include "../world/Park.h" +#include "../world/Sprite.h" +#include "GameAction.h" + +struct RideSetColourSchemeAction : public GameActionBase +{ +private: + int32_t _x = 0, _y = 0, _z = 0, _direction = 0, _trackType = 0; + uint16_t _newColourScheme = 0; + +public: + RideSetColourSchemeAction() = default; + RideSetColourSchemeAction(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t trackType, uint16_t newColourScheme) + : _x(x) + , _y(y) + , _z(z) + , _direction(direction) + , _trackType(trackType) + , _newColourScheme(newColourScheme) + { + } + + uint16_t GetActionFlags() const override + { + return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED; + } + + void Serialise(DataSerialiser& stream) override + { + GameAction::Serialise(stream); + + stream << DS_TAG(_x) << DS_TAG(_y) << DS_TAG(_z) << DS_TAG(_direction) << DS_TAG(_trackType) + << DS_TAG(_newColourScheme); + } + + GameActionResult::Ptr Query() const override + { + return std::make_unique(); + } + + GameActionResult::Ptr Execute() const override + { + GameActionResult::Ptr res = std::make_unique(); + res->ExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION; + res->ErrorTitle = STR_CANT_SET_COLOUR_SCHEME; + + int32_t x = _x, y = _y, z = _z; + sub_6C683D(&x, &y, &z, _direction, _trackType, _newColourScheme, nullptr, 4); + + return res; + } +}; diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index 19b8af0ae6..b3450e5c85 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -3891,6 +3891,8 @@ enum STR_OBJECT_SELECTION_STATIONS = 6272, STR_OBJECT_SELECTION_MUSIC = 6273, + STR_CANT_SET_COLOUR_SCHEME = 6274, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 }; diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index b94e25b8ef..5d187d10bb 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -30,7 +30,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 rct_peep* _pickup_peep = nullptr; diff --git a/src/openrct2/network/NetworkAction.cpp b/src/openrct2/network/NetworkAction.cpp index 4b9f659ada..c488387268 100644 --- a/src/openrct2/network/NetworkAction.cpp +++ b/src/openrct2/network/NetworkAction.cpp @@ -120,6 +120,7 @@ const std::vector NetworkActions::Actions = { GAME_COMMAND_SET_RIDE_SETTING, GAME_COMMAND_SET_RIDE_PRICE, GAME_COMMAND_SET_BRAKES_SPEED, + GAME_COMMAND_SET_COLOUR_SCHEME, }, }, {