From 0248621502eadc474948f84dbc3bf2d3358a91c8 Mon Sep 17 00:00:00 2001 From: Jim Date: Wed, 8 Jul 2020 20:48:08 +0200 Subject: [PATCH] Increase handyman randomness in queue (#12145) * Increase randomness when handyman is on queue path * Add myself to contributors * Refactor hex variable probabilities * Add check if queue is connected to a ride * Update changelog * Bump network version * Update replays Co-authored-by: duncanspumpkin --- CMakeLists.txt | 4 ++-- contributors.md | 1 + distribution/changelog.txt | 1 + openrct2.proj | 4 ++-- src/openrct2/network/Network.cpp | 2 +- src/openrct2/peep/Staff.cpp | 7 ++++++- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07b99489e1..07a3748e67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,8 +29,8 @@ set(TITLE_SEQUENCE_SHA1 "304d13a126c15bf2c86ff13b81a2f2cc1856ac8d") set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v1.0.15/objects.zip") set(OBJECTS_SHA1 "dfd5864cf7d0449c0fb280c5c6b902a24816df6c") -set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v0.0.14/replays.zip") -set(REPLAYS_SHA1 "5A0198B4337A43199702F5ED6069161C8A735332") +set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v0.0.15/replays.zip") +set(REPLAYS_SHA1 "85EBF6760D39FA37BFDEBAA77992CB55A7C8C301") option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.") option(WITH_TESTS "Build tests") diff --git a/contributors.md b/contributors.md index e57df95300..0919871312 100644 --- a/contributors.md +++ b/contributors.md @@ -87,6 +87,7 @@ The following people are not part of the development team, but have been contrib * Chad Ian Anderson (pizza2004) - Added New Game option, bug fixes, misc. * Peter Ryszkiewicz (pRizz) - Added horizontal grid lines to finance charts. * Hudson Oliveira (hdpoliveira) - Misc. +* Jim Verheijde (Jimver) - Make handymen less likely to get stuck in queue lines. ## Bug fixes * (halfbro) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 2f283875d5..eb1ae12eba 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -47,6 +47,7 @@ - Fix: RCT1 scenarios have more items in the object list than are present in the park or the research list. - Improved: [#6530] Allow water and land height changes on park borders. - Improved: [#11390] Build hash written to screenshot metadata. +- Improved: [#3205] Make handymen less likely to get stuck in ride queues. - Technical: [#8110] OpenRCT2 now uses a single directory name for title sequences instead of three. - Technical: [#11517] Windows Vista is supported again (libzip regression in the previous release). - Technical: The required version of macOS has been increased to 10.14 (Mojave) for plugin support. diff --git a/openrct2.proj b/openrct2.proj index c7922fb424..27b9ad9149 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -48,8 +48,8 @@ 304d13a126c15bf2c86ff13b81a2f2cc1856ac8d https://github.com/OpenRCT2/objects/releases/download/v1.0.15/objects.zip dfd5864cf7d0449c0fb280c5c6b902a24816df6c - https://github.com/OpenRCT2/replays/releases/download/v0.0.14/replays.zip - 5A0198B4337A43199702F5ED6069161C8A735332 + https://github.com/OpenRCT2/replays/releases/download/v0.0.15/replays.zip + 85EBF6760D39FA37BFDEBAA77992CB55A7C8C301 diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index a1e8eeb6b4..9bdd2ce3d8 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -32,7 +32,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 "20" +#define NETWORK_STREAM_VERSION "21" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static Peep* _pickup_peep = nullptr; diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index 450b5d1f6f..5578f88ba6 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -643,7 +643,12 @@ bool Staff::DoHandymanPathFinding() bool chooseRandom = true; if (litterDirection != INVALID_DIRECTION && pathDirections & (1 << litterDirection)) { - if ((scenario_rand() & 0xFFFF) >= 0x1999) + /// Check whether path is a queue path and connected to a ride + bool connectedQueue = (pathElement->IsQueue() && pathElement->GetRideIndex() != RIDE_ID_NULL); + /// When in a queue path make the probability of following litter much lower (10% instead of 90%) + /// as handymen often get stuck when there is litter on a normal path next to a queue they are in + uint32_t chooseRandomProbability = connectedQueue ? 0xE666 : 0x1999; + if ((scenario_rand() & 0xFFFF) >= chooseRandomProbability) { chooseRandom = false; newDirection = litterDirection;