ENDCLASS(PlayerState)
.PlayerState _ps;
-#if NDEBUG
- #define PS(this) (this._ps)
-#else
- PlayerState PS(entity this) { assert(IS_CLIENT(this)); return this._ps; }
-#endif
+#define PS(this) (this._ps)
// TODO: renew on death
void PlayerState_attach(entity this);
#include <dpdefs/keycodes.qh>
#endif
+#include "bool.qh"
+#include "int.qh"
+
#include "macro.qh"
+#ifndef NDEBUG
+ #define TC(T, sym) MACRO_BEGIN \
+ if (!is_##T(sym)) LOG_WARNINGF("Type check failed: " #sym " :: " #T); \
+ MACRO_END
+#else
+ #define TC(T, sym) MACRO_BEGIN MACRO_END
+#endif
+
+bool is_int(float f) { return f == f | 0; }
+bool is_bool(float f) { return f == true || f == 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"
#define CLASS(cname, base) \
entityclass(cname, base); \
class(cname).bool instanceOf##cname; \
+ bool is_##cname(entity e) { return e.instanceOf##cname; } \
VTBL(cname, base) \
INIT_STATIC(cname) \
{ \
#define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
#define IS_CLIENT(v) (v.flags & FL_CLIENT)
+#define is_client IS_CLIENT
#define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
#define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
#define IS_NOT_A_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
void SpectateCopy(entity this, entity spectatee)
{
+ TC(Client, this); TC(Client, spectatee);
+
MUTATOR_CALLHOOK(SpectateCopy, spectatee, this);
PS(this) = PS(spectatee);
this.armortype = spectatee.armortype;