]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/string.qh
remove multiple declarations of v_angle, document usage of v_angle and angles
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / string.qh
index 384188091d0c4b0c92917bacafd3253707be3fe6..617891d8b6230f75bafe674b423896d90ac068f1 100644 (file)
@@ -4,7 +4,18 @@
 #include "sort.qh"
 #include "oo.qh"
 
-#ifndef SVQC
+#ifdef CSQC
+       float stringwidth_colors(string s, vector theSize)
+       {
+               return stringwidth_builtin(s, true, theSize);
+       }
+
+       float stringwidth_nocolors(string s, vector theSize)
+       {
+               return stringwidth_builtin(s, false, theSize);
+       }
+#endif
+#ifdef MENUQC
        float stringwidth_colors(string s, vector theSize)
        {
                return stringwidth(s, true, theSize);
@@ -328,7 +339,12 @@ int vercmp(string v1, string v2)
        return vercmp_recursive(v1, v2);
 }
 
+const string HEXDIGITS_MINSET = "0123456789ABCDEFabcdef";
 const string HEXDIGITS = "0123456789ABCDEF0123456789abcdef";
 #define HEXDIGIT_TO_DEC_RAW(d) (strstrofs(HEXDIGITS, (d), 0))
 #define HEXDIGIT_TO_DEC(d) ((HEXDIGIT_TO_DEC_RAW(d) | 0x10) - 0x10)
-#define DEC_TO_HEXDIGIT(d) (substring(HEXDIGITS, (d), 1))
+#define DEC_TO_HEXDIGIT(d) (substring(HEXDIGITS_MINSET, (d), 1))
+#define IS_HEXDIGIT(d) (strstrofs(HEXDIGITS_MINSET, (d), 0) >= 0)
+
+const string DIGITS = "0123456789";
+#define IS_DIGIT(d) (strstrofs(DIGITS, (d), 0) >= 0)