]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/oo.qh
Merge branch 'terencehill/quickmenu_file_example' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / oo.qh
index 2925e9ee09c7b2cf41f18ecae7c7209d825450ac..a0d6f35db34b9ba8e76ba2af2c1aa3457779d1bb 100644 (file)
@@ -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
 
@@ -152,7 +169,7 @@ STATIC_INIT(RegisterClasses)
        class(cname).type name[cnt];
 
 #define ENDCLASS(cname) \
-       [[last]] INIT(cname) \
+       INIT(cname) \
        { \
                return this; \
        }