#define _spawnfunc_check(fld) \
if (fieldname == #fld) continue;
- #define spawnfunc_1(id, whitelist) spawnfunc_2(id, whitelist)
+ noref entity __spawnfunc_expect;
+ bool __spawnfunc_unreachable_workaround = true;
+
+ #define spawnfunc_1(id) spawnfunc_2(id, FIELDS_UNION)
#define spawnfunc_2(id, whitelist) \
- void spawnfunc_##id(entity this) \
+ void __spawnfunc_##id(entity this); \
+ [[accumulate]] void spawnfunc_##id(entity this) \
{ \
- this = self; \
+ if (self == __spawnfunc_expect) \
+ { \
+ /* engine call */ \
+ __spawnfunc_expect = NULL; \
+ this = self; \
+ } \
+ else \
+ { \
+ assert(this); \
+ } \
if (!this.sourceLocFile) \
{ \
this.sourceLocFile = __FILE__; \
} \
this.spawnfunc_checked = true; \
} \
+ __spawnfunc_##id(this); \
+ if (__spawnfunc_unreachable_workaround) return; \
} \
- [[accumulate]] void spawnfunc_##id(entity this)
+ void __spawnfunc_##id(entity this)
#define FIELD_SCALAR(fld, n) \
fld(n)
FIELD_SCALAR(fld, modelindex) \
FIELD_SCALAR(fld, modelscale) \
FIELD_SCALAR(fld, model) \
+ FIELD_SCALAR(fld, monsterid) \
FIELD_SCALAR(fld, monster_moveflags) \
+ FIELD_SCALAR(fld, monster_name) \
FIELD_SCALAR(fld, movetype) \
FIELD_SCALAR(fld, netname) \
FIELD_SCALAR(fld, nextthink) \
FIELD_VEC(fld, velocity) \
/**/
- #define spawnfunc(...) EVAL(OVERLOAD(spawnfunc, __VA_ARGS__, FIELDS_UNION))
+ #define spawnfunc(...) EVAL(OVERLOAD(spawnfunc, __VA_ARGS__))
#endif