diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index cbe0880891..d2587b4103 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3845,3 +3845,4 @@ STR_7003 :Audio file ‘{STRING}’ is truncated. Expected sample {INT32}, bu STR_7004 :Force Redraw STR_7005 :Drag an area of footpath STR_7006 :Draw border around image buttons +STR_7007 :Ride Type diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 1b2cec1cdd..d0b2c660a2 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -34,6 +34,7 @@ - Feature: [#25218] `sprite exportobject` command, which allows extracting images from an object. - Feature: [#25274] New title sequence (see https://github.com/OpenRCT2/title-sequences/releases/tag/v0.4.26 for credits). - Improved: [#2296, #2307] The land tool now takes sloped track and paths into account when modifying land. +- Improved: [#25192] Ride List now allows sorting by ride type. - Change: [#25111] Frozen guests no longer finish consuming any food or drink they are carrying. - Change: [#25161] Revert to the ‘fair ride price’ calculation of vanilla RCT2. - Change: [#25201] Ride List: put unknown popularity and satisfaction last when sorting. diff --git a/src/openrct2-ui/UiStringIds.h b/src/openrct2-ui/UiStringIds.h index d71305cba3..39d72a38f9 100644 --- a/src/openrct2-ui/UiStringIds.h +++ b/src/openrct2-ui/UiStringIds.h @@ -1787,6 +1787,7 @@ namespace OpenRCT2 STR_RIDE_LIST_INFORMATION_TYPE_TIP = 1844, STR_RIDE_LIST_INTENSITY = 6464, STR_RIDE_LIST_NAUSEA = 6466, + STR_RIDE_LIST_RIDETYPE = 7007, STR_RIDE_LIST_RUNNING_COST = 5771, STR_RIDE_LIST_RUNNING_COST_LABEL = 5780, STR_RIDE_LIST_RUNNING_COST_UNKNOWN = 5781, diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index c013567713..4ed3e973dd 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -86,6 +87,7 @@ namespace OpenRCT2::Ui::Windows enum InformationType { INFORMATION_TYPE_STATUS, + INFORMATION_TYPE_RIDETYPE, INFORMATION_TYPE_POPULARITY, INFORMATION_TYPE_SATISFACTION, INFORMATION_TYPE_PROFIT, @@ -109,6 +111,7 @@ namespace OpenRCT2::Ui::Windows static constexpr StringId ride_info_type_string_mapping[DROPDOWN_LIST_COUNT] = { STR_STATUS, + STR_RIDE_LIST_RIDETYPE, STR_POPULARITY, STR_SATISFACTION, STR_PROFIT, @@ -137,6 +140,7 @@ namespace OpenRCT2::Ui::Windows static constexpr bool ride_info_type_money_mapping[DROPDOWN_LIST_COUNT] = { false, // Status + false, // Ride Type false, // Popularity false, // Satisfaction true, // Profit @@ -833,6 +837,14 @@ namespace OpenRCT2::Ui::Windows ft.Add(ridePtr->ratings.intensity); } break; + case INFORMATION_TYPE_RIDETYPE: + { + const auto& rtd = ridePtr->getRideTypeDescriptor(); + auto rideTypeName = rtd.Naming.Name; + formatSecondary = STR_STRINGID; + ft.Add(rideTypeName); + break; + } case INFORMATION_TYPE_NAUSEA: formatSecondary = STR_RATING_UKNOWN_LABEL; if (RideHasRatings(*ridePtr)) @@ -1085,6 +1097,22 @@ namespace OpenRCT2::Ui::Windows return leftValue < rightValue; }); break; + case INFORMATION_TYPE_RIDETYPE: + SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { + auto* ridePtrLhs = GetRide(thisRide.id); + auto* ridePtrRhs = GetRide(otherRide.id); + if (!ridePtrLhs || !ridePtrRhs) + return ridePtrLhs != nullptr; + + auto rtdLhs = ridePtrLhs->getRideTypeDescriptor(); + auto rtdRhs = ridePtrRhs->getRideTypeDescriptor(); + + auto rideTypeNameLhs = LanguageGetString(rtdLhs.Naming.Name); + auto rideTypeNameRhs = LanguageGetString(rtdRhs.Naming.Name); + + return String::logicalCmp(rideTypeNameLhs, rideTypeNameRhs) > 0; + }); + break; case INFORMATION_TYPE_NAUSEA: SortListByPredicate([](const Ride& thisRide, const Ride& otherRide) -> bool { const auto leftValue = thisRide.ratings.isNull() ? RideRating::kUndefined : thisRide.ratings.nausea;