From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Tue, 23 May 2023 11:38:51 +0000 (+0200) Subject: improve squad macros, make logic more versatile and consider the squad of the entity... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c46b200427e3498ece3563e64052f959c0094cd3;p=xonotic%2Fxonotic-data.pk3dir.git improve squad macros, make logic more versatile and consider the squad of the entity owner --- 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;