Codechange: use std::string to cache engine/group/vehicle names
This commit is contained in:
@@ -1332,18 +1332,18 @@ static bool VehicleNumberSorter(const Vehicle * const &a, const Vehicle * const
|
||||
/** Sort vehicles by their name */
|
||||
static bool VehicleNameSorter(const Vehicle * const &a, const Vehicle * const &b)
|
||||
{
|
||||
static char last_name[2][64];
|
||||
static std::string last_name[2] = { {}, {} };
|
||||
|
||||
if (a != _last_vehicle[0]) {
|
||||
_last_vehicle[0] = a;
|
||||
SetDParam(0, a->index);
|
||||
GetString(last_name[0], STR_VEHICLE_NAME, lastof(last_name[0]));
|
||||
last_name[0] = GetString(STR_VEHICLE_NAME);
|
||||
}
|
||||
|
||||
if (b != _last_vehicle[1]) {
|
||||
_last_vehicle[1] = b;
|
||||
SetDParam(0, b->index);
|
||||
GetString(last_name[1], STR_VEHICLE_NAME, lastof(last_name[1]));
|
||||
last_name[1] = GetString(STR_VEHICLE_NAME);
|
||||
}
|
||||
|
||||
int r = StrNaturalCompare(last_name[0], last_name[1]); // Sort by name (natural sorting).
|
||||
|
Reference in New Issue
Block a user