From c429fc329a8865218161805ed9d91c3d5e289008 Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Mon, 4 Apr 2022 20:10:24 +0200 Subject: [PATCH] Add a new warning for queue length complaints --- data/language/en-GB.txt | 1 + distribution/changelog.txt | 1 + src/openrct2/entity/Guest.h | 1 + src/openrct2/entity/Peep.cpp | 32 ++++++++++++++++++++++++++- src/openrct2/localisation/StringIds.h | 2 ++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 2e0e7f210a..f1907b3f34 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3676,6 +3676,7 @@ STR_6484 :See-Through vegetation toggle STR_6485 :See-Through vehicles toggle STR_6486 :See-Through guests toggle STR_6487 :See-Through staff toggle +STR_6488 :{RED}Guests are complaining about the length of the queues in your park.{NEWLINE}Consider shortening problematic queues, or increase the ride’s throughput. ############# # Scenarios # diff --git a/distribution/changelog.txt b/distribution/changelog.txt index c281255048..bf001c40c4 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -35,6 +35,7 @@ - Improved: [#16408] Improve --version cli option to report more compatibility information. - Improved: [#16740] Allow staff patrol areas to be defined with individual tiles rather than groups of 4x4. - Improved: [#16764] [Plugin] Add hook 'map.save', called before the map is about is saved. +- Improved: [#16925] The queue length of 1000 guests is lifted, and a warning for too long queues is added instead. - Change: [#14484] Make the Heartline Twister coaster ratings a little bit less hateful. - Change: [#16077] When importing SV6 files, the RCT1 land types are only added when they were actually used. - Change: [#16424] Following an entity in the title sequence no longer toggles underground view when it's underground. diff --git a/src/openrct2/entity/Guest.h b/src/openrct2/entity/Guest.h index e84efd381a..d8831e2156 100644 --- a/src/openrct2/entity/Guest.h +++ b/src/openrct2/entity/Guest.h @@ -25,6 +25,7 @@ #define PEEP_VANDALISM_WARNING_THRESHOLD 15 #define PEEP_NOEXIT_WARNING_THRESHOLD 8 #define PEEP_LOST_WARNING_THRESHOLD 8 +#define PEEP_TOO_LONG_QUEUE_THRESHOLD 25 #define PEEP_MAX_HAPPINESS 255 #define PEEP_MAX_HUNGER 255 diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index cfca4da97a..c47dc78997 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -1012,9 +1012,19 @@ void peep_problem_warnings_update() disgust_counter = 0, toilet_counter = 0, vandalism_counter = 0; uint8_t* warning_throttle = gPeepWarningThrottle; + int32_t inQueueCounter = 0; + int32_t tooLongQueueCounter = 0; + std::map queueComplainingGuestsMap; + for (auto peep : EntityList()) { - if (peep->OutsideOfPark || peep->Thoughts[0].freshness > 5) + if (peep->OutsideOfPark) + continue; + + if (peep->State == PeepState::Queuing || peep->State == PeepState::QueuingFront) + inQueueCounter++; + + if (peep->Thoughts[0].freshness > 5) continue; switch (peep->Thoughts[0].type) @@ -1068,6 +1078,10 @@ void peep_problem_warnings_update() case PeepThoughtType::Vandalism: // 0x21 vandalism_counter++; break; + case PeepThoughtType::QueuingAges: + tooLongQueueCounter++; + queueComplainingGuestsMap[peep->Thoughts[0].rideId]++; + break; default: break; } @@ -1157,6 +1171,22 @@ void peep_problem_warnings_update() News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_GETTING_LOST_OR_STUCK, 16, {}); } } + + if (warning_throttle[7]) + --warning_throttle[7]; + else if (tooLongQueueCounter > PEEP_TOO_LONG_QUEUE_THRESHOLD && tooLongQueueCounter > inQueueCounter / 20) + { // The amount of guests complaining about queue duration is at least 5% of the amount of queuing guests. + // This includes guests who are no longer queuing. + warning_throttle[7] = 4; + if (gConfigNotifications.guest_warnings) + { + auto rideWithMostQueueComplaints = std::max_element( + queueComplainingGuestsMap.begin(), queueComplainingGuestsMap.end(), + [](auto& lhs, auto& rhs) { return lhs.second < rhs.second; }); + auto rideId = rideWithMostQueueComplaints->first.ToUnderlying(); + News::AddItemToQueue(News::ItemType::Ride, STR_PEEPS_COMPLAINING_ABOUT_QUEUE_LENGTH_WARNING, rideId, {}); + } + } } void peep_stop_crowd_noise() diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index d389c6c060..77af76400a 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -3946,6 +3946,8 @@ enum : uint16_t STR_SHORTCUT_SEE_THROUGH_GUESTS_TOGGLE = 6486, STR_SHORTCUT_SEE_THROUGH_STAFF_TOGGLE = 6487, + STR_PEEPS_COMPLAINING_ABOUT_QUEUE_LENGTH_WARNING = 6488, + // 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 };