mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-22 23:33:04 +01:00
Add ride type filter to Ride List window
This commit is contained in:
committed by
Gymnasiast
parent
09a0d056c6
commit
bc528348cf
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/network/Network.h>
|
||||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/ride/RideManager.hpp>
|
||||
#include <openrct2/ride/RideRatings.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
@@ -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<uint16_t>(ridePtr->ratings.intensity);
|
||||
}
|
||||
break;
|
||||
case INFORMATION_TYPE_RIDETYPE:
|
||||
{
|
||||
const auto& rtd = ridePtr->getRideTypeDescriptor();
|
||||
auto rideTypeName = rtd.Naming.Name;
|
||||
formatSecondary = STR_STRINGID;
|
||||
ft.Add<StringId>(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;
|
||||
|
||||
Reference in New Issue
Block a user