Merge branch 'master' into jgrpp

# Conflicts:
#	src/company_gui.cpp
#	src/group_gui.cpp
#	src/newgrf.cpp
#	src/newgrf_debug_gui.cpp
#	src/saveload/saveload.cpp
This commit is contained in:
Jonathan G Rennison
2023-08-19 01:13:00 +01:00
22 changed files with 109 additions and 171 deletions

View File

@@ -1546,18 +1546,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).