From: Mario Date: Sat, 28 Jan 2017 07:40:35 +0000 (+1000) Subject: Minor cleanup in hook removing code (probably doesn't fix hook sometimes getting... X-Git-Tag: xonotic-v0.8.2~270 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7d31b5422a49f7dced6a7384337b4fc84031a6e3;p=xonotic%2Fxonotic-data.pk3dir.git Minor cleanup in hook removing code (probably doesn't fix hook sometimes getting removed for no reason) --- diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index ef4cbc5a6..fbb4271df 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -80,10 +80,8 @@ void RemoveGrapplingHooks(entity pl) { .entity weaponentity = weaponentities[slot]; if(pl.(weaponentity).hook) - { delete(pl.(weaponentity).hook); - pl.(weaponentity).hook = NULL; - } + pl.(weaponentity).hook = NULL; } //pl.disableclientprediction = false; @@ -91,15 +89,14 @@ void RemoveGrapplingHooks(entity pl) void RemoveHook(entity this) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - { - .entity weaponentity = weaponentities[slot]; - if(this.realowner.(weaponentity).hook == this) - this.realowner.(weaponentity).hook = NULL; - } + entity player = this.realowner; + .entity weaponentity = this.weaponentity_fld; + + if(player.(weaponentity).hook == this) + player.(weaponentity).hook = NULL; - if(this.realowner.move_movetype == MOVETYPE_FLY) - set_movetype(this.realowner, MOVETYPE_WALK); + if(player.move_movetype == MOVETYPE_FLY) + set_movetype(player, MOVETYPE_WALK); delete(this); }