summaryrefslogtreecommitdiffstats
path: root/src/core/General.h
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2019-10-30 00:12:58 +0100
committerSergeanur <s.anureev@yandex.ua>2019-10-30 00:35:31 +0100
commitc202fc3b550b8fc569f510e2002241eec399c18d (patch)
treee3d267990b344709533c925a4169cd71dfaa8394 /src/core/General.h
parentCRadar::Initialise() + fixes (diff)
downloadre3-c202fc3b550b8fc569f510e2002241eec399c18d.tar
re3-c202fc3b550b8fc569f510e2002241eec399c18d.tar.gz
re3-c202fc3b550b8fc569f510e2002241eec399c18d.tar.bz2
re3-c202fc3b550b8fc569f510e2002241eec399c18d.tar.lz
re3-c202fc3b550b8fc569f510e2002241eec399c18d.tar.xz
re3-c202fc3b550b8fc569f510e2002241eec399c18d.tar.zst
re3-c202fc3b550b8fc569f510e2002241eec399c18d.zip
Diffstat (limited to '')
-rw-r--r--src/core/General.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/core/General.h b/src/core/General.h
index d73cf36f..a7b240c2 100644
--- a/src/core/General.h
+++ b/src/core/General.h
@@ -104,6 +104,29 @@ public:
return (int)floorf(angle / DEGTORAD(45.0f));
}
+ // Unlike usual string comparison functions, these don't care about greater or lesser
+ static bool faststrcmp(const char *str1, const char *str2)
+ {
+ for (; *str1; str1++, str2++) {
+ if (*str1 != *str2)
+ return true;
+ }
+ return *str2 != '\0';
+ }
+
+ static bool faststricmp(const char *str1, const char *str2)
+ {
+ for (; *str1; str1++, str2++) {
+#if MUCH_SLOWER
+ if (toupper(*str1) != toupper(*str2))
+#else
+ if (__ascii_toupper(*str1) != __ascii_toupper(*str2))
+#endif
+ return true;
+ }
+ return *str2 != '\0';
+ }
+
// not too sure about all these...
static uint16 GetRandomNumber(void)
{ return myrand() & MYRAND_MAX; }