From: Rudolf Polzer Date: Wed, 24 Nov 2010 19:56:58 +0000 (+0100) Subject: crylink link maintenance: fix one odd case that may have caused corruption X-Git-Tag: xonotic-v0.1.0preview~105 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b3d700484d92d30fbd2c3d540dc94fcb9e1131fb;p=xonotic%2Fxonotic-data.pk3dir.git crylink link maintenance: fix one odd case that may have caused corruption --- diff --git a/qcsrc/server/w_crylink.qc b/qcsrc/server/w_crylink.qc index bc41d0889..5a6910c86 100644 --- a/qcsrc/server/w_crylink.qc +++ b/qcsrc/server/w_crylink.qc @@ -9,6 +9,27 @@ REGISTER_WEAPON(CRYLINK, w_crylink, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_TYPE_SPLA .entity queuenext; .entity queueprev; +void W_Crylink_CheckLinks(entity e) +{ + float i; + entity p; + + if(e == world) + error("W_Crylink_CheckLinks: entity is world"); + + p = e; + for(i = 0; i < 1000; ++i) + { + if(p.queuenext.queueprev != p || p.queueprev.queuenext != p) + error("W_Crylink_CheckLinks: queue is inconsistent"); + p = p.queuenext; + if(p == e) + break; + } + if(i >= 1000) + error("W_Crylink_CheckLinks: infinite chain"); +} + void W_Crylink_Dequeue_Raw(entity own, entity prev, entity me, entity next) { if(me == own.crylink_lastgroup) @@ -39,27 +60,6 @@ void W_Crylink_LinkExplode (entity e, entity e2) remove (e); } -void W_Crylink_CheckLinks(entity e) -{ - float i; - entity p; - - if(e == world) - error("W_Crylink_CheckLinks: entity is world"); - - p = e; - for(i = 0; i < 1000; ++i) - { - if(p.queuenext.queueprev != p || p.queueprev.queuenext != p) - error("W_Crylink_CheckLinks: queue is inconsistent"); - p = p.queuenext; - if(p == e) - break; - } - if(i >= 1000) - error("W_Crylink_CheckLinks: infinite chain"); -} - // adjust towards center // returns the origin where they will meet... and the time till the meeting is // stored in w_crylink_linkjoin_time. @@ -233,6 +233,8 @@ void W_Crylink_Touch (void) f *= a; if (RadiusDamage (self, self.realowner, cvar("g_balance_crylink_primary_damage") * f, cvar("g_balance_crylink_primary_edgedamage") * f, cvar("g_balance_crylink_primary_radius"), world, cvar("g_balance_crylink_primary_force") * f, self.projectiledeathtype, other) && cvar("g_balance_crylink_primary_linkexplode")) { + if(self == self.realowner.crylink_lastgroup) + self.realowner.crylink_lastgroup = world; W_Crylink_LinkExplode(self.queuenext, self); remove (self); return; @@ -281,6 +283,8 @@ void W_Crylink_Touch2 (void) f *= a; if (RadiusDamage (self, self.realowner, cvar("g_balance_crylink_secondary_damage") * f, cvar("g_balance_crylink_secondary_edgedamage") * f, cvar("g_balance_crylink_secondary_radius"), world, cvar("g_balance_crylink_secondary_force") * f, self.projectiledeathtype, other) && cvar("g_balance_crylink_secondary_linkexplode")) { + if(self == self.realowner.crylink_lastgroup) + self.realowner.crylink_lastgroup = world; W_Crylink_LinkExplode(self.queuenext, self); remove (self); return;