summaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2018-09-23 19:26:09 +0200
committerMichael Lutz <michi@icosahedron.de>2018-12-08 20:13:27 +0100
commit8d7cd6a5262ae151e30fe6db18d04648ebe9d8d7 (patch)
tree808780a96841751582ed1b91122310b1a439a8b6 /src/string.cpp
parent05a93c121c2066baa58e075a3ba6f04f18ab594d (diff)
downloadopenttd-8d7cd6a5262ae151e30fe6db18d04648ebe9d8d7.tar.xz
Add: [OSX] Native natural sort implementation.
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/string.cpp b/src/string.cpp
index 66140b7d4..845225d6f 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -33,6 +33,10 @@
#include "os/windows/string_uniscribe.h"
#endif
+#if defined(WITH_COCOA)
+#include "os/macosx/string_osx.h"
+#endif
+
#ifdef WITH_ICU_SORT
/* Required by strnatcmp. */
#include <unicode/ustring.h>
@@ -593,6 +597,11 @@ int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
if (res != 0) return res - 2; // Convert to normal C return values.
#endif
+#if defined(WITH_COCOA) && !defined(STRGEN) && !defined(SETTINGSGEN)
+ int res = MacOSStringCompare(s1, s2);
+ if (res != 0) return res - 2; // Convert to normal C return values.
+#endif
+
/* Do a normal comparison if ICU is missing or if we cannot create a collator. */
return strcasecmp(s1, s2);
}