summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-11-27 22:52:12 +0000
committerterkhen <terkhen@openttd.org>2010-11-27 22:52:12 +0000
commit75f86a7a21c6c6ea2e5067a5eb9a8690d8584ed1 (patch)
tree9795c8c24286ea191df003631d9cc6af4c30e2bd /src/network
parent4b944cb13e6d75662a9246bf06523a320d814ace (diff)
downloadopenttd-75f86a7a21c6c6ea2e5067a5eb9a8690d8584ed1.tar.xz
(svn r21344) -Feature [FS#4214]: Natural sorting of strings using ICU.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_content_gui.cpp4
-rw-r--r--src/network/network_gui.cpp2
2 files changed, 3 insertions, 3 deletions
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).
}
/**