Codechange: replace strnatcmp with C++ string capable version

This commit is contained in:
Rubidium
2023-04-27 15:39:10 +02:00
committed by rubidium42
parent df19673fbd
commit c829930440
22 changed files with 47 additions and 54 deletions

View File

@@ -202,7 +202,7 @@ static bool IndustryTypeNameSorter(const IndustryType &a, const IndustryType &b)
const IndustrySpec *indsp2 = GetIndustrySpec(b);
GetString(industry_name[1], indsp2->name, lastof(industry_name[1]));
int r = strnatcmp(industry_name[0], industry_name[1]); // Sort by name (natural sorting).
int r = StrNaturalCompare(industry_name[0], industry_name[1]); // Sort by name (natural sorting).
/* If the names are equal, sort by industry type. */
return (r != 0) ? r < 0 : (a < b);
@@ -1498,7 +1498,7 @@ protected:
/** Sort industries by name */
static bool IndustryNameSorter(const Industry * const &a, const Industry * const &b)
{
int r = strnatcmp(a->GetCachedName(), b->GetCachedName()); // Sort by name (natural sorting).
int r = StrNaturalCompare(a->GetCachedName(), b->GetCachedName()); // Sort by name (natural sorting).
if (r == 0) return a->index < b->index;
return r < 0;
}