From: Rudolf Polzer Date: Thu, 5 Apr 2012 13:15:28 +0000 (+0200) Subject: when "a CSQC entity changed its type", make sure ALL entity fields are cleared X-Git-Tag: xonotic-v0.7.0~346 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1de949c4ea9fe731097ffda83a4b0eac58c0836f;p=xonotic%2Fxonotic-data.pk3dir.git when "a CSQC entity changed its type", make sure ALL entity fields are cleared --- diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 12343e6a2..d4a8a38de 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -2,6 +2,19 @@ // BEGIN REQUIRED CSQC FUNCTIONS //include "main.qh" +.entity clearentity_ent; +void clearentity(entity e) +{ + if(!clearentity_ent) + { + clearentity_ent = spawn(); + clearentity_ent.classname = "clearentity"; + } + float n = e.entnum; + copyentity(clearentity_ent, e); + e.entnum = n; +} + #define DP_CSQC_ENTITY_REMOVE_IS_B0RKED void menu_show_error() { @@ -706,6 +719,7 @@ void CSQC_Ent_Update(float bIsNewEntity) //print(_("A CSQC entity changed its type!\n")); print(sprintf(_("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n"), num_for_edict(self), self.entnum, self.enttype, t)); Ent_Remove(); + clearentity(self); bIsNewEntity = 1; } }