From 7d31b5422a49f7dced6a7384337b4fc84031a6e3 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 28 Jan 2017 17:40:35 +1000 Subject: [PATCH] Minor cleanup in hook removing code (probably doesn't fix hook sometimes getting removed for no reason) --- qcsrc/server/g_hook.qc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) 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); } -- 2.39.2