]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Minor cleanup in hook removing code (probably doesn't fix hook sometimes getting...
authorMario <mario@smbclan.net>
Sat, 28 Jan 2017 07:40:35 +0000 (17:40 +1000)
committerMario <mario@smbclan.net>
Sat, 28 Jan 2017 07:40:35 +0000 (17:40 +1000)
qcsrc/server/g_hook.qc

index ef4cbc5a65409f2858f5a90561fa4c0a4910d240..fbb4271dfbdaedfd46acdfb280615576fa76c878 100644 (file)
@@ -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);
 }