]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
Remove 2 unnecessary macros
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / clanarena / sv_clanarena.qc
index 9cd378f0fe6eacd521fe22e6f0bf3c5557b00ce5..163b996c3f61a95996b8aa281d90b19580c60da8 100644 (file)
@@ -62,7 +62,6 @@ int CA_GetWinnerTeam()
 
 void nades_Clear(entity player);
 
-#define CA_ALIVE_TEAMS_OK() (Team_GetNumberOfAliveTeams() == NumTeams(ca_teams))
 float CA_CheckWinner()
 {
        if(round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0)
@@ -115,7 +114,7 @@ bool CA_CheckTeams()
        static int prev_missing_teams_mask;
        allowed_to_spawn = true;
        CA_count_alive_players();
-       if(CA_ALIVE_TEAMS_OK())
+       if (Team_GetNumberOfAliveTeams() == NumTeams(ca_teams))
        {
                if(prev_missing_teams_mask > 0)
                        Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS);
@@ -298,7 +297,7 @@ MUTATOR_HOOKFUNCTION(ca, ClientDisconnect)
 {
        entity player = M_ARGV(0, entity);
 
-       if (player.caplayer == 1)
+       if (IS_PLAYER(player) && !IS_DEAD(player))
                ca_LastPlayerForTeam_Notify(player);
        return true;
 }
@@ -307,7 +306,7 @@ MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver)
 {
        entity player = M_ARGV(0, entity);
 
-       if (!IS_DEAD(player))
+       if (IS_PLAYER(player) && !IS_DEAD(player))
                ca_LastPlayerForTeam_Notify(player);
        if (player.killindicator_teamchange == -2) // player wants to spectate
                player.caplayer = 0;
@@ -421,7 +420,8 @@ MUTATOR_HOOKFUNCTION(ca, SpectateNext)
 {
        entity client = M_ARGV(0, entity);
 
-       if (!autocvar_g_ca_spectate_enemies && client.caplayer)
+       if (!autocvar_g_ca_spectate_enemies && client.caplayer
+               && Team_GetNumberOfAlivePlayers(Entity_GetTeam(client)))
        {
                entity targ = M_ARGV(1, entity);
                M_ARGV(1, entity) = CA_SpectateNext(client, targ);
@@ -435,7 +435,8 @@ MUTATOR_HOOKFUNCTION(ca, SpectatePrev)
        entity targ = M_ARGV(1, entity);
        entity first = M_ARGV(2, entity);
 
-       if (!autocvar_g_ca_spectate_enemies && client.caplayer)
+       if (!autocvar_g_ca_spectate_enemies && client.caplayer
+               && Team_GetNumberOfAlivePlayers(Entity_GetTeam(client)))
        {
                do { targ = targ.chain; }
                while(targ && DIFF_TEAM(targ, client));
@@ -448,6 +449,8 @@ MUTATOR_HOOKFUNCTION(ca, SpectatePrev)
                                return MUT_SPECPREV_RETURN;
                }
        }
+       else
+               return MUT_SPECPREV_CONTINUE;
 
        M_ARGV(1, entity) = targ;