summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/cargotype.cpp2
-rw-r--r--src/group_gui.cpp2
-rw-r--r--src/industry_gui.cpp4
-rw-r--r--src/network/network_content_gui.cpp4
-rw-r--r--src/network/network_gui.cpp2
-rw-r--r--src/newgrf_gui.cpp2
-rw-r--r--src/signs_gui.cpp2
-rw-r--r--src/town_gui.cpp2
-rw-r--r--src/vehicle_gui.cpp2
10 files changed, 12 insertions, 12 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 8b018261f..c25d43703 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -157,7 +157,7 @@ static int CDECL EngineNameSorter(const EngineID *a, const EngineID *b)
GetString(last_name[1], STR_ENGINE_NAME, lastof(last_name[1]));
}
- int r = strcmp(last_name[0], last_name[1]); // sort by name
+ int r = strnatcmp(last_name[0], last_name[1]); // Sort by name (natural sorting).
/* Use EngineID to sort instead since we want consistent sorting */
if (r == 0) return EngineNumberSorter(a, b);
diff --git a/src/cargotype.cpp b/src/cargotype.cpp
index 94edd27f5..66b3840cf 100644
--- a/src/cargotype.cpp
+++ b/src/cargotype.cpp
@@ -134,7 +134,7 @@ static int CDECL CargoSpecNameSorter(const CargoSpec * const *a, const CargoSpec
GetString(a_name, (*a)->name, lastof(a_name));
GetString(b_name, (*b)->name, lastof(b_name));
- int res = strcmp(a_name, b_name);
+ int res = strnatcmp(a_name, b_name); // Sort by name (natural sorting).
/* If the names are equal, sort by cargo bitnum. */
return (res != 0) ? res : ((*a)->bitnum - (*b)->bitnum);
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 8db34bebe..e6ef1dc54 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -160,7 +160,7 @@ private:
GetString(last_name[1], STR_GROUP_NAME, lastof(last_name[1]));
}
- int r = strcmp(last_name[0], last_name[1]); // sort by name
+ int r = strnatcmp(last_name[0], last_name[1]); // Sort by name (natural sorting).
if (r == 0) return (*a)->index - (*b)->index;
return r;
}
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 32ffff33a..f365c060a 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -120,7 +120,7 @@ static int CDECL IndustryTypeNameSorter(const IndustryType *a, const IndustryTyp
SetDParam(0, indsp2->name);
GetString(industry_name[1], STR_JUST_STRING, lastof(industry_name[1]));
- int r = strcmp(industry_name[0], industry_name[1]);
+ int r = strnatcmp(industry_name[0], industry_name[1]); // Sort by name (natural sorting).
/* If the names are equal, sort by industry type. */
return (r != 0) ? r : (*a - *b);
@@ -1137,7 +1137,7 @@ protected:
GetString(buf_cache, STR_INDUSTRY_NAME, lastof(buf_cache));
}
- return strcmp(buf, buf_cache);
+ return strnatcmp(buf, buf_cache); // Sort by name (natural sorting).
}
/** Sort industries by type and name */
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 44b37cc4a..70cc0d8a1 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -266,7 +266,7 @@ class NetworkContentListWindow : public QueryStringBaseWindow, ContentCallback {
/** Sort content by name. */
static int CDECL NameSorter(const ContentInfo * const *a, const ContentInfo * const *b)
{
- return strcasecmp((*a)->name, (*b)->name);
+ return strnatcmp((*a)->name, (*b)->name); // Sort by name (natural sorting).
}
/** Sort content by type. */
@@ -278,7 +278,7 @@ class NetworkContentListWindow : public QueryStringBaseWindow, ContentCallback {
char b_str[64];
GetString(a_str, STR_CONTENT_TYPE_BASE_GRAPHICS + (*a)->type - CONTENT_TYPE_BASE_GRAPHICS, lastof(a_str));
GetString(b_str, STR_CONTENT_TYPE_BASE_GRAPHICS + (*b)->type - CONTENT_TYPE_BASE_GRAPHICS, lastof(b_str));
- r = strcasecmp(a_str, b_str);
+ r = strnatcmp(a_str, b_str);
}
if (r == 0) r = NameSorter(a, b);
return r;
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 6b1c15da7..7c4914aa7 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -279,7 +279,7 @@ protected:
/** Sort servers by name. */
static int CDECL NGameNameSorter(NetworkGameList * const *a, NetworkGameList * const *b)
{
- return strcasecmp((*a)->info.server_name, (*b)->info.server_name);
+ return strnatcmp((*a)->info.server_name, (*b)->info.server_name); // Sort by name (natural sorting).
}
/**
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 343c30df9..913a8ff29 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -1201,7 +1201,7 @@ private:
/** Sort grfs by name. */
static int CDECL NameSorter(const GRFConfig * const *a, const GRFConfig * const *b)
{
- int i = strcasecmp((*a)->GetName(), (*b)->GetName());
+ int i = strnatcmp((*a)->GetName(), (*b)->GetName()); // Sort by name (natural sorting).
if (i != 0) return i;
i = (*a)->version - (*b)->version;
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 7a6032596..70bb897db 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -92,7 +92,7 @@ struct SignList {
GetString(buf_cache, STR_SIGN_NAME, lastof(buf_cache));
}
- int r = strcasecmp(buf, buf_cache);
+ int r = strnatcmp(buf, buf_cache); // Sort by name (natural sorting).
return r != 0 ? r : ((*a)->index - (*b)->index);
}
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 7da0528a1..f4c302100 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -700,7 +700,7 @@ private:
GetString(buf_cache, STR_TOWN_NAME, lastof(buf_cache));
}
- return strcmp(buf, buf_cache);
+ return strnatcmp(buf, buf_cache); // Sort by name (natural sorting).
}
/** Sort by population */
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 46a4f1b8f..34eb67d4b 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -766,7 +766,7 @@ static int CDECL VehicleNameSorter(const Vehicle * const *a, const Vehicle * con
GetString(last_name[1], STR_VEHICLE_NAME, lastof(last_name[1]));
}
- int r = strcmp(last_name[0], last_name[1]);
+ int r = strnatcmp(last_name[0], last_name[1]); // Sort by name (natural sorting).
return (r != 0) ? r : VehicleNumberSorter(a, b);
}