mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 20:43:04 +01:00
Close #24400: Sort rides with preservation order alphabetically
This commit is contained in:
@@ -2185,6 +2185,14 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowSetResize(*this, kSizeRides, kSizeRides);
|
||||
}
|
||||
|
||||
static std::string GetRideString(RideId rideId)
|
||||
{
|
||||
const auto* ride = GetRide(rideId);
|
||||
if (ride == nullptr)
|
||||
return "";
|
||||
return ride->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00672544
|
||||
@@ -2206,6 +2214,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the rides alphabetically
|
||||
std::stable_sort(_rideableRides.begin(), _rideableRides.end(), [](const RideId& a, const RideId& b) {
|
||||
return String::compare(GetRideString(a), GetRideString(b), false) < 0;
|
||||
});
|
||||
|
||||
if (oldSize != _rideableRides.size())
|
||||
{
|
||||
Invalidate();
|
||||
|
||||
Reference in New Issue
Block a user