From c46b200427e3498ece3563e64052f959c0094cd3 Mon Sep 17 00:00:00 2001 From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Tue, 23 May 2023 13:38:51 +0200 Subject: [PATCH] improve squad macros, make logic more versatile and consider the squad of the entity owner --- qcsrc/common/gamemodes/gamemode/br/sv_squad.qh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/br/sv_squad.qh b/qcsrc/common/gamemodes/gamemode/br/sv_squad.qh index ac7b7b412..69bdfcaf1 100644 --- a/qcsrc/common/gamemodes/gamemode/br/sv_squad.qh +++ b/qcsrc/common/gamemodes/gamemode/br/sv_squad.qh @@ -3,9 +3,9 @@ // player squad entity .entity br_squad; -#define IN_SQUAD(a) ((a).br_squad != NULL) -#define SAME_SQUAD(a,b) (IN_SQUAD((a)) && ((a).br_squad == (b).br_squad)) -#define DIFF_SQUAD(a,b) (!IN_SQUAD((a)) || ((a).br_squad != (b).br_squad)) +#define IN_SQUAD(a) (((a).owner ? ((a).owner) : (a)).br_squad != NULL) +#define SAME_SQUAD(a,b) ((a == b) || (IN_SQUAD(a) && (((a).owner ? ((a).owner) : (a)).br_squad == ((b).owner ? ((b).owner) : (b)).br_squad))) +#define DIFF_SQUAD(a,b) ((!IN_SQUAD(a) && (a != b)) || (IN_SQUAD(a) && (((a).owner ? ((a).owner) : (a)).br_squad != ((b).owner ? ((b).owner) : (b)).br_squad))) int max_squad_size; -- 2.39.2