From 736d9448af5457e18cb62719f4c2f3ebfae4b3ff Mon Sep 17 00:00:00 2001 From: Andrew <5436387+fidwell@users.noreply.github.com> Date: Sun, 18 May 2025 05:56:44 -0400 Subject: [PATCH] Close #22476: Add time since last inspection to Rides List window (#24080) * Add time since last inspection to ride window * Changelog * Add missing entry to ride_info_type_money_mapping Make dropdown wider * Consistent formatting * Update distribution/changelog.txt --------- Co-authored-by: Tulio Leao --- data/language/en-GB.txt | 4 ++++ distribution/changelog.txt | 3 ++- src/openrct2-ui/UiStringIds.h | 4 ++++ src/openrct2-ui/windows/RideList.cpp | 29 +++++++++++++++++++++++++++- 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 6b570e689c..a942f1eb93 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3818,3 +3818,7 @@ STR_6770 :Frame rate limit: STR_6771 :Internal speed (default) STR_6772 :Vertical sync STR_6773 :Unrestricted +STR_6774 :Time since last inspection +STR_6775 :{COMMA16} minute +STR_6776 :{COMMA16} minutes +STR_6777 :more than 4 hours diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 09d2ea1cff..4be365f9fd 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,6 +1,7 @@ 0.4.23 (in development) ------------------------------------------------------------------------ -- Feature: [#24313] [Plugin] Add API for setting a ride vehicle’s sprite to a smoke plume. +- Feature: [#22476] “Time since last inspection” statistic is available in the rides window. +- Feature: [#24313] [Plugin] Add API for setting a ride vehicle’s sprite to a smoke plume. - Improved: [#24364] Improve the fallback vehicle sprites for Zero G Rolls, and allow small ones to be built without cheats if the fallbacks are available. - Improved: [#24368] Clicking the in-game update notication now leads to a more user-friendly download page. - Change: [#24342] g2.dat is now split into g2.dat and fonts.dat. diff --git a/src/openrct2-ui/UiStringIds.h b/src/openrct2-ui/UiStringIds.h index 429d733cec..03642a47c4 100644 --- a/src/openrct2-ui/UiStringIds.h +++ b/src/openrct2-ui/UiStringIds.h @@ -1734,6 +1734,10 @@ namespace OpenRCT2 STR_CLOSE_ALL = 1011, STR_DOWN_TIME = 1833, STR_DOWN_TIME_LABEL = 1840, + STR_LAST_INSPECTION = 6774, + STR_LAST_INSPECTION_LABEL_MINUTE = 6775, + STR_LAST_INSPECTION_LABEL_MINUTES = 6776, + STR_LAST_INSPECTION_LABEL_MORE_THAN_FOUR_HOURS = 6777, STR_EXCITEMENT_LABEL = 6463, STR_GUESTS_FAVOURITE = 1834, STR_GUESTS_FAVOURITE_LABEL = 1842, diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index 4606142d18..22e824d734 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -97,6 +97,7 @@ namespace OpenRCT2::Ui::Windows INFORMATION_TYPE_QUEUE_TIME, INFORMATION_TYPE_RELIABILITY, INFORMATION_TYPE_DOWN_TIME, + INFORMATION_TYPE_LAST_INSPECTION, INFORMATION_TYPE_GUESTS_FAVOURITE, INFORMATION_TYPE_EXCITEMENT, INFORMATION_TYPE_INTENSITY, @@ -119,6 +120,7 @@ namespace OpenRCT2::Ui::Windows STR_QUEUE_TIME, STR_RELIABILITY, STR_DOWN_TIME, + STR_LAST_INSPECTION, STR_GUESTS_FAVOURITE, STR_RIDE_LIST_EXCITEMENT, STR_RIDE_LIST_INTENSITY, @@ -146,6 +148,7 @@ namespace OpenRCT2::Ui::Windows false, // Queue time false, // Reliability false, // Down time + false, // Last inspection false, // Guests favourite false, // Excitement false, // Intensity @@ -211,7 +214,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_SORT].right = width - 60 + 54; auto dropdownStart = widgets[WIDX_CURRENT_INFORMATION_TYPE].top; - ResizeDropdown(WIDX_CURRENT_INFORMATION_TYPE, { 150, dropdownStart }, { width - 216, kDropdownHeight }); + ResizeDropdown(WIDX_CURRENT_INFORMATION_TYPE, { 100, dropdownStart }, { width - 166, kDropdownHeight }); // Refreshing the list can be a very intensive operation // owing to its use of ride_has_any_track_elements(). @@ -704,6 +707,25 @@ namespace OpenRCT2::Ui::Windows ft.Add(ridePtr->downtime); formatSecondary = STR_DOWN_TIME_LABEL; break; + case INFORMATION_TYPE_LAST_INSPECTION: + { + const auto lastInspection = ridePtr->lastInspection; + ft.Add(lastInspection); + + if (lastInspection <= 1) + { + formatSecondary = STR_LAST_INSPECTION_LABEL_MINUTE; + } + else if (lastInspection <= 240) + { + formatSecondary = STR_LAST_INSPECTION_LABEL_MINUTES; + } + else + { + formatSecondary = STR_LAST_INSPECTION_LABEL_MORE_THAN_FOUR_HOURS; + } + break; + } case INFORMATION_TYPE_GUESTS_FAVOURITE: formatSecondary = 0; if (ridePtr->isRide()) @@ -907,6 +929,11 @@ namespace OpenRCT2::Ui::Windows return thisRide.downtime <= otherRide.downtime; }); break; + case INFORMATION_TYPE_LAST_INSPECTION: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + return thisRide.lastInspection <= otherRide.lastInspection; + }); + break; case INFORMATION_TYPE_GUESTS_FAVOURITE: SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { return thisRide.guestsFavourite <= otherRide.guestsFavourite;