]> 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 307b4bd081c6f35cbbfe75eb87925bdd0f44ac2c..97d560b5c4708542a199781e853fa87b2b99af1d 100644 (file)
        #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.qh"
+#include "markdown.qh"
 #include "math.qh"
 #include "misc.qh"
 #include "net.qh"