]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/_all.inc
Client: Type check
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / _all.inc
index 563a86c3c09ba21bc9feda3ab56db1d9fcc1d4ec..97d560b5c4708542a199781e853fa87b2b99af1d 100644 (file)
 #endif
 
 #if defined(CSQC)
-       #include "../dpdefs/csprogsdefs.qh"
-       #include "../dpdefs/keycodes.qh"
+       #include <dpdefs/csprogsdefs.qh>
+       #include <dpdefs/keycodes.qh>
 #elif defined(SVQC)
-       #include "../server/sys-pre.qh"
-       #include "../dpdefs/progsdefs.qh"
-       #include "../dpdefs/dpextensions.qh"
-       #include "../server/sys-post.qh"
+       #include <server/sys-pre.qh>
+       #include <dpdefs/progsdefs.qh>
+       #include <dpdefs/dpextensions.qh>
+       #include <server/sys-post.qh>
 #elif defined(MENUQC)
-       #include "../dpdefs/menudefs.qh"
-       #include "../dpdefs/keycodes.qh"
+       #include <dpdefs/menudefs.qh>
+       #include <dpdefs/keycodes.qh>
 #endif
 
+#include "bool.qh"
+#include "int.qh"
+
 #include "macro.qh"
 
+#if NDEBUG
+    #define TC(T, sym) MACRO_BEGIN MACRO_END
+#else
+    #define TC(T, sym) MACRO_BEGIN \
+        if (!is_##T(sym)) LOG_WARNINGF("Type check failed: " #sym " :: " #T); \
+    MACRO_END
+#endif
+
+bool is_float (float  this) { return true; }
+bool is_vector(vector this) { return true; }
+bool is_string(string this) { return true; }
+bool is_entity(entity this) { return true; }
+bool is_int   (float  this) { return this == floor(this); }
+bool is_bool  (float  this) { return this == true || this == false; }
+
 #include "warpzone/mathlib.qc"
 
 #include "accumulate.qh"
+#include "angle.qc"
 #include "arraylist.qh"
 #include "bits.qh"
-#include "bool.qh"
 #include "color.qh"
 #include "counting.qh"
 #include "cvar.qh"
 #include "file.qh"
 #include "functional.qh"
 #include "i18n.qh"
-#include "int.qh"
 #include "iter.qh"
 #include "lazy.qh"
 #include "linkedlist.qh"
 #include "log.qh"
-#include "map.qc"
+#include "map.qh"
+#include "markdown.qh"
 #include "math.qh"
 #include "misc.qh"
 #include "net.qh"
 #include "nil.qh"
-#include "noise.qc"
+#include "noise.qh"
 #include "oo.qh"
 #include "p2mathlib.qc"
 #include "progname.qh"