fix if else branching logic 1024/head
authordrjaska <drjaska83@gmail.com>
Mon, 30 May 2022 02:36:56 +0000 (05:36 +0300)
committerdrjaska <drjaska83@gmail.com>
Mon, 30 May 2022 02:36:56 +0000 (05:36 +0300)
qcsrc/server/damage.qc

index db9ddd0d9bd70c35034c7b933816561e330d63fd..3cbc07c57d3dddb989bd6b954ad58df86e6186f0 100644 (file)
@@ -629,14 +629,9 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
                if(IS_PLAYER(attacker))
                {
                        // avoid dealing damage or force to other independent players
-                       if(IS_PLAYER(targ) && targ != attacker && (IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(targ)))
-                       {
-                               damage = 0;
-                               force = '0 0 0';
-                       }
-                       // avoid dealing damage or force to things owned by other independent players
-                       if(targ.realowner)
-                       if(IS_INDEPENDENT_PLAYER(targ.realowner) && attacker != targ.realowner)
+                       // and avoid dealing damage or force to things owned by other independent players
+                       if((IS_PLAYER(targ) && targ != attacker && (IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(targ))) ||
+                               (targ.realowner && IS_INDEPENDENT_PLAYER(targ.realowner) && attacker != targ.realowner))
                        {
                                damage = 0;
                                force = '0 0 0';