X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Flib%2Foo.qh;h=a0d6f35db34b9ba8e76ba2af2c1aa3457779d1bb;hb=e9f30b97435c6afe3d6911f21e1f4fd1b97e93da;hp=558a8731992bbc458ae41530572e928a174108d8;hpb=2b728b9c59ef61318b7ca5a261cb7fa45d2143aa;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/lib/oo.qh b/qcsrc/lib/oo.qh index 558a87319..a0d6f35db 100644 --- a/qcsrc/lib/oo.qh +++ b/qcsrc/lib/oo.qh @@ -3,6 +3,7 @@ #include "misc.qh" #include "nil.qh" +#include "static.qh" #ifdef MENUQC #define NULL (null_entity) @@ -49,6 +50,22 @@ entity __spawn(string _classname, string _sourceFile, int _sourceLine, bool pure #endif #define spawn() __spawn("entity", __FILE__, __LINE__, false) +entity _clearentity_ent; +STATIC_INIT(clearentity) +{ + _clearentity_ent = new(clearentity); +} +void clearentity(entity e) +{ +#ifdef CSQC + int n = e.entnum; +#endif + copyentity(_clearentity_ent, e); +#ifdef CSQC + e.entnum = n; +#endif +} + // Classes have a `spawn##cname(entity)` constructor // The parameter is used across [[accumulate]] functions