]> 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 4e0b12f255dbea477471c539aadd46dad8bdd648..97d560b5c4708542a199781e853fa87b2b99af1d 100644 (file)
@@ -1,27 +1,93 @@
-#include "Bool.qh"
-
-#include "../warpzonelib/mathlib.qc"
-
-#include "Accumulate.qh"
-#include "Counting.qh"
-#include "Cvar.qh"
-#include "Defer.qh"
-#include "Draw.qh"
-#include "I18N.qh"
-#include "Lazy.qh"
-#include "Log.qh"
-#include "Math.qh"
-#include "Nil.qh"
-#include "noise.qc"
-#include "OO.qh"
+#ifndef NOCOMPAT
+       #define COMPAT_NO_MOD_IS_XONOTIC
+#endif
+
+#include "compiler.qh"
+
+#ifndef QCC_SUPPORT_INT
+       #define int float
+#endif
+
+#ifndef QCC_SUPPORT_BOOL
+       #define bool float
+#endif
+
+#if defined(CSQC)
+       #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>
+#elif defined(MENUQC)
+       #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 "color.qh"
+#include "counting.qh"
+#include "cvar.qh"
+#include "defer.qh"
+#include "draw.qh"
+#include "enumclass.qh"
+#include "file.qh"
+#include "functional.qh"
+#include "i18n.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"
+#include "nil.qh"
+#include "noise.qh"
+#include "oo.qh"
 #include "p2mathlib.qc"
-#include "Player.qh"
-#include "prandom.qc"
-#include "Progname.qh"
-#include "Registry.qh"
+#include "progname.qh"
+#include "random.qc"
+#include "registry.qh"
+#include "registry_net.qh"
+#include "replicate.qh"
+#include "self.qh"
 #include "sortlist.qc"
-#include "String.qh"
-#include "Struct.qh"
+#include "sort.qh"
+#include "spawnfunc.qh"
+#include "static.qh"
+#include "stats.qh"
+#include "string.qh"
+#include "struct.qh"
 #include "test.qc"
+#include "unsafe.qh"
 #include "urllib.qc"
-#include "Vector.qh"
+#include "vector.qh"
+#include "yenc.qh"