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

@@ -275,19 +275,18 @@ static EngineID _last_engine[2] = { INVALID_ENGINE, INVALID_ENGINE };
*/
static bool EngineNameSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
{
static char last_name[2][64] = { "", "" };
static std::string last_name[2] = { {}, {} };
if (a.engine_id != _last_engine[0]) {
_last_engine[0] = a.engine_id;
SetDParam(0, PackEngineNameDParam(a.engine_id, EngineNameContext::PurchaseList));
GetString(last_name[0], STR_ENGINE_NAME, lastof(last_name[0]));
last_name[0] = GetString(STR_ENGINE_NAME);
}
if (b.engine_id != _last_engine[1]) {
_last_engine[1] = b.engine_id;
SetDParam(0, PackEngineNameDParam(b.engine_id, EngineNameContext::PurchaseList));
GetString(last_name[1], STR_ENGINE_NAME, lastof(last_name[1]));
last_name[1] = GetString(STR_ENGINE_NAME);
}
int r = StrNaturalCompare(last_name[0], last_name[1]); // Sort by name (natural sorting).