From: Mario Date: Wed, 1 Feb 2017 09:23:12 +0000 (+1000) Subject: Store real owner of crylink projectiles in a separate field (if realowner changes... X-Git-Tag: xonotic-v0.8.2~251 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=741cb43b12c3ced87a1bd9432a3d09a8559e155a;p=xonotic%2Fxonotic-data.pk3dir.git Store real owner of crylink projectiles in a separate field (if realowner changes when one of them is unlinked, a crash can occur) --- diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index e76117dc4..8268acdd3 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -64,6 +64,8 @@ REGISTER_WEAPON(CRYLINK, crylink, NEW(Crylink)); .float crylink_waitrelease; .entity crylink_lastgroup; +.entity crylink_owner; // we can't use realowner, as that's subject to change + .entity queuenext; .entity queueprev; #endif @@ -110,7 +112,7 @@ void W_Crylink_Dequeue_Raw(entity own, entity prev, entity me, entity next) void W_Crylink_Dequeue(entity e) { - W_Crylink_Dequeue_Raw(e.realowner, e.queueprev, e, e.queuenext); + W_Crylink_Dequeue_Raw(e.crylink_owner, e.queueprev, e, e.queuenext); } void W_Crylink_Reset(entity this) @@ -130,8 +132,8 @@ void W_Crylink_LinkExplode(entity e, entity e2, entity directhitentity) a = bound(0, 1 - (time - e.fade_time) * e.fade_rate, 1); .entity weaponentity = e.weaponentity_fld; - if(e == e.realowner.(weaponentity).crylink_lastgroup) - e.realowner.(weaponentity).crylink_lastgroup = NULL; + if(e == e.crylink_owner.(weaponentity).crylink_lastgroup) + e.crylink_owner.(weaponentity).crylink_lastgroup = NULL; float isprimary = !(e.projectiledeathtype & HITTYPE_SECONDARY); @@ -321,8 +323,8 @@ void W_Crylink_Touch(entity this, entity toucher) if(totaldamage && ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 2) || ((WEP_CVAR_BOTH(crylink, isprimary, linkexplode) == 1) && !W_Crylink_Touch_WouldHitFriendly(this, WEP_CVAR_BOTH(crylink, isprimary, radius))))) { .entity weaponentity = this.weaponentity_fld; - if(this == this.realowner.(weaponentity).crylink_lastgroup) - this.realowner.(weaponentity).crylink_lastgroup = NULL; + if(this == this.crylink_owner.(weaponentity).crylink_lastgroup) + this.crylink_owner.(weaponentity).crylink_lastgroup = NULL; W_Crylink_LinkExplode(this.queuenext, this, toucher); this.classname = "spike_oktoremove"; delete(this); @@ -378,6 +380,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity) proj = new(spike); proj.reset = W_Crylink_Reset; proj.realowner = proj.owner = actor; + proj.crylink_owner = actor; proj.weaponentity_fld = weaponentity; proj.bot_dodge = true; proj.bot_dodgerating = WEP_CVAR_PRI(crylink, damage); @@ -490,6 +493,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity) proj.weaponentity_fld = weaponentity; proj.reset = W_Crylink_Reset; proj.realowner = proj.owner = actor; + proj.crylink_owner = actor; proj.bot_dodge = true; proj.bot_dodgerating = WEP_CVAR_SEC(crylink, damage); if(shots == 1) {