From b9382ae9fc938a08bed947b0688b83de45ddc508 Mon Sep 17 00:00:00 2001 From: Matthias Moninger <5415177+ZehMatt@users.noreply.github.com> Date: Sun, 21 May 2023 19:36:08 +0300 Subject: [PATCH] Disallow firing staff who are currently fixing or inspecting rides (#20260) * Disallow firing staff who are currently fixing or inspecting rides * Disable fire button when staff member is inspecting/fixing a ride * Add changelog entry * Up network version * Improve error message --------- Co-authored-by: Rik Smeets <30838294+rik-smeets@users.noreply.github.com> --- data/language/en-GB.txt | 2 ++ distribution/changelog.txt | 1 + src/openrct2-ui/windows/Staff.cpp | 2 ++ src/openrct2/actions/StaffFireAction.cpp | 9 +++++++++ src/openrct2/localisation/StringIds.h | 3 +++ src/openrct2/network/NetworkBase.cpp | 2 +- 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 9b8cd466a9..399108a25d 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3693,6 +3693,8 @@ STR_6587 :The OpenRCT2 Title Theme is a work of Allister Brimble,{NEWLINE}lic STR_6588 :Thanks to Herman Riddering for allowing us to record the 35er Voigt. STR_6589 :Show window buttons on the left STR_6590 :Show the window buttons (e.g. to close the window) on the left of the title bar instead of on the right. +STR_6591 :Staff member is currently fixing a ride and can’t be fired. +STR_6592 :Staff member is currently inspecting a ride and can’t be fired. ############# # Scenarios # diff --git a/distribution/changelog.txt b/distribution/changelog.txt index e6cb218e40..3833201b9b 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -8,6 +8,7 @@ - Fix: [#19823] Parkobj: disallow overriding objects of different object types. - Fix: [#20111] All coaster types can access the new diagonal slope pieces. - Fix: [#20155] Fairground organ style 2 shows up as regular music, rather than for the merry-go-round. +- Fix: [#20260] Ride locks up when inspecting/fixing staff member is fired. 0.4.5 (2023-05-08) ------------------------------------------------------------------------ diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 92bbd998ba..700b5bce77 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -1055,6 +1055,8 @@ private: { SetWidgetDisabled(WIDX_PICKUP, true); } + + SetWidgetDisabled(WIDX_FIRE, staff->State == PeepState::Fixing || staff->State == PeepState::Inspecting); } } diff --git a/src/openrct2/actions/StaffFireAction.cpp b/src/openrct2/actions/StaffFireAction.cpp index 2bc1623ac5..0ab237c0ad 100644 --- a/src/openrct2/actions/StaffFireAction.cpp +++ b/src/openrct2/actions/StaffFireAction.cpp @@ -49,6 +49,15 @@ GameActions::Result StaffFireAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); } + if (staff->State == PeepState::Fixing) + { + return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_FIRE_STAFF_FIXING, STR_NONE); + } + else if (staff->State == PeepState::Inspecting) + { + return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_FIRE_STAFF_INSPECTING, STR_NONE); + } + return GameActions::Result(); } diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index bf533667f9..433c8c953f 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -3997,6 +3997,9 @@ enum : uint16_t STR_WINDOW_BUTTONS_ON_THE_LEFT = 6589, STR_WINDOW_BUTTONS_ON_THE_LEFT_TIP = 6590, + STR_CANT_FIRE_STAFF_FIXING = 6591, + STR_CANT_FIRE_STAFF_INSPECTING = 6592, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working /* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings }; diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 8b3b4866f2..471bd7d445 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -43,7 +43,7 @@ // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "3" +#define NETWORK_STREAM_VERSION "4" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION