From: TimePath Date: Wed, 6 May 2015 08:38:18 +0000 (+0000) Subject: Explain `CLASS` and `NEW` macros X-Git-Tag: xonotic-v0.8.1~61^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ca97fcf09ae82c8e67f7cc23eb4a6e7938517613;p=xonotic%2Fxonotic-data.pk3dir.git Explain `CLASS` and `NEW` macros --- diff --git a/qcsrc/menu/oo/base.qh b/qcsrc/menu/oo/base.qh index db1dfcf6a..5c74f0d6d 100644 --- a/qcsrc/menu/oo/base.qh +++ b/qcsrc/menu/oo/base.qh @@ -29,6 +29,10 @@ entity spawnObject(entity this, entity) return this; } +// Classes have a `spawn##cname(entity, entity)` constructor +// The parameters are used as locals for [[accumulate]] + +// Macro to hide this implementation detail #define NEW(cname) (spawn##cname(null_entity, null_entity)) #define CLASS(cname, base) \ @@ -64,4 +68,4 @@ entity cname##_vtbl; \ #define SUPER(cname) (cname##_vtbl.vtblbase) -#endif +#endif \ No newline at end of file