#endif
}
+// clears any IL data from an entity (not an intrusive list)
+// it should be used only in very particular cases such as after a copyentity call
+void IL_REMOVE_RAW(entity it)
+{
+ it.il_lists = '0 0 0';
+ for (int i = 0; i < IL_MAX * 2; ++i)
+ it.il_links_flds[i] = nil;
+}
+
// called when an entity is deleted with delete() / remove()
// or when a player disconnects
void ONREMOVE(entity this)
/* this = NULL; */ \
MACRO_END
+void IL_REMOVE_RAW(entity it);
+void copyentity_qc(entity src, entity dst)
+{
+ copyentity(src, dst); // builtin function
+ IL_REMOVE_RAW(dst);
+}
+
entity _clearentity_ent;
STATIC_INIT(clearentity)
{
int n = e.entnum;
#endif
bool was_pure = is_pure(e);
- copyentity(_clearentity_ent, e);
+ copyentity_qc(_clearentity_ent, e);
if (!was_pure) make_impure(e);
#ifdef CSQC
e.entnum = n;
{ \
if (cname##_vtbl && !this.transmute) \
{ \
- copyentity(cname##_vtbl, this); \
+ copyentity_qc(cname##_vtbl, this); \
return; \
} \
spawn##base##_static(this); \
void __spawnfunc_spawn(entity prototype)
{
entity e = new(clone);
- copyentity(prototype, e);
+ copyentity_qc(prototype, e);
IL_PUSH(g_map_entities, e);
#define X(T, fld, def) { e.fld = e.__spawnfunc_##fld; e.__spawnfunc_##fld = def; }
SPAWNFUNC_INTERNAL_FIELDS(X);
{
entity replacement = spawn();
Item_CopyFields(this, replacement);
- // DO NOT USE, causes #2792
- //copyentity(this, replacement);
replacement.m_isreplaced = true;
weapon_defaultspawnfunc(replacement, wep);
}
setorigin(flash, offset);
entity xflash = spawn();
- copyentity(flash, xflash);
+ copyentity_qc(flash, xflash);
flash.viewmodelforclient = actor;