mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-21 23:03:04 +01:00
Refactor existing structs to use u8string_view
This commit is contained in:
@@ -609,7 +609,7 @@ struct RideTypeLabel
|
|||||||
{
|
{
|
||||||
ride_type_t RideTypeId;
|
ride_type_t RideTypeId;
|
||||||
StringId LabelId;
|
StringId LabelId;
|
||||||
const char* LabelString;
|
u8string_view LabelString;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used for sorting the vehicle type dropdown.
|
// Used for sorting the vehicle type dropdown.
|
||||||
@@ -617,7 +617,7 @@ struct VehicleTypeLabel
|
|||||||
{
|
{
|
||||||
ObjectEntryIndex SubTypeId;
|
ObjectEntryIndex SubTypeId;
|
||||||
StringId LabelId;
|
StringId LabelId;
|
||||||
const char* LabelString;
|
u8string_view LabelString;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used for sorting the entrance type dropdown.
|
// Used for sorting the entrance type dropdown.
|
||||||
@@ -1807,11 +1807,11 @@ private:
|
|||||||
for (uint8_t i = 0; i < RIDE_TYPE_COUNT; i++)
|
for (uint8_t i = 0; i < RIDE_TYPE_COUNT; i++)
|
||||||
{
|
{
|
||||||
auto name = GetRideTypeNameForDropdown(i);
|
auto name = GetRideTypeNameForDropdown(i);
|
||||||
_rideDropdownData.push_back({ i, name, ls.GetString(name) });
|
_rideDropdownData.push_back({ i, name, u8string_view{ ls.GetString(name) } });
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(_rideDropdownData.begin(), _rideDropdownData.end(), [](auto& a, auto& b) {
|
std::sort(_rideDropdownData.begin(), _rideDropdownData.end(), [](auto& a, auto& b) {
|
||||||
return String::Compare(a.LabelString, b.LabelString, true) < 0;
|
return a.LabelString.compare(b.LabelString) < 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
_rideDropdownDataLanguage = ls.GetCurrentLanguage();
|
_rideDropdownDataLanguage = ls.GetCurrentLanguage();
|
||||||
@@ -1948,13 +1948,13 @@ private:
|
|||||||
if (!RideEntryIsInvented(rideEntryIndex) && !gCheatsIgnoreResearchStatus)
|
if (!RideEntryIsInvented(rideEntryIndex) && !gCheatsIgnoreResearchStatus)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_vehicleDropdownData.push_back(
|
auto name = currentRideEntry->naming.Name;
|
||||||
{ rideEntryIndex, currentRideEntry->naming.Name, ls.GetString(currentRideEntry->naming.Name) });
|
_vehicleDropdownData.push_back({ rideEntryIndex, name, u8string_view{ ls.GetString(name) } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(_vehicleDropdownData.begin(), _vehicleDropdownData.end(), [](auto& a, auto& b) {
|
std::sort(_vehicleDropdownData.begin(), _vehicleDropdownData.end(), [](auto& a, auto& b) {
|
||||||
return String::Compare(a.LabelString, b.LabelString, true) < 0;
|
return a.LabelString.compare(b.LabelString) < 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
_vehicleDropdownExpanded = selectionShouldBeExpanded;
|
_vehicleDropdownExpanded = selectionShouldBeExpanded;
|
||||||
|
|||||||
Reference in New Issue
Block a user