]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/teamplay.qc
Merge branch 'maint' (early part before Transifex)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / teamplay.qc
index 2f6963bf71b9f0d85c1a86cae7fcafffebadc602..b19597cdeb05c7c679bff8f537b64b94abc19ba9 100644 (file)
@@ -1,20 +1,25 @@
-string cache_mutatormsg;
-string cache_lastmutatormsg;
+#include "teamplay.qh"
+#include "_all.qh"
 
-// client counts for each team
-float c1, c2, c3, c4;
-// # of bots on those teams
-float cb1, cb2, cb3, cb4;
+#include "cl_client.qh"
+#include "race.qh"
+#include "scores.qh"
+#include "scores_rules.qh"
 
-//float audit_teams_time;
+#include "bot/bot.qh"
+
+#include "command/vote.qh"
+
+#include "mutators/mutators_include.qh"
+
+#include "../common/deathtypes.qh"
+#include "../common/teams.qh"
 
 void TeamchangeFrags(entity e)
 {
        PlayerScore_Clear(e);
 }
 
-void entcs_init();
-
 void LogTeamchange(float player_id, float team_number, float type)
 {
        if(!autocvar_sv_eventlog)
@@ -36,6 +41,7 @@ void ActivateTeamplay()
 {
        serverflags |= SERVERFLAG_TEAMPLAY;
        teamplay = 1;
+       cvar_set("teamplay", "2");  // DP needs this for sending proper getstatus replies.
 }
 
 void InitGameplayMode()
@@ -52,8 +58,9 @@ void InitGameplayMode()
        world.maxs = mi_max;
 
        MapInfo_LoadMapSettings(mapname);
-       teamplay = 0;
        serverflags &= ~SERVERFLAG_TEAMPLAY;
+       teamplay = 0;
+       cvar_set("teamplay", "0");  // DP needs this for sending proper getstatus replies.
 
        if (!cvar_value_issafe(world.fog))
        {
@@ -276,8 +283,7 @@ string getwelcomemessage(void)
 {
        string s, modifications, motd;
 
-       ret_string = "";
-       MUTATOR_CALLHOOK(BuildMutatorsPrettyString);
+       MUTATOR_CALLHOOK(BuildMutatorsPrettyString, "");
        modifications = ret_string;
 
        if(g_weaponarena)
@@ -425,8 +431,7 @@ void CheckAllowedTeams (entity for_whom)
                // cover anything else by treating it like tdm with no teams spawned
                dm = 2;
 
-               ret_float = dm;
-               MUTATOR_CALLHOOK(GetTeamCount);
+               MUTATOR_CALLHOOK(GetTeamCount, dm);
                dm = ret_float;
 
                if(dm >= 4)
@@ -595,11 +600,11 @@ float TeamSmallerEqThanTeam(float ta, float tb, entity e)
 
        // invalid
        if(ca < 0 || cb < 0)
-               return FALSE;
+               return false;
 
        // equal
        if(ta == tb)
-               return TRUE;
+               return true;
 
        if(IS_REAL_CLIENT(e))
        {
@@ -613,10 +618,10 @@ float TeamSmallerEqThanTeam(float ta, float tb, entity e)
        // keep teams alive (teams of size 0 always count as smaller, ignoring score)
        if(ca < 1)
                if(cb >= 1)
-                       return TRUE;
+                       return true;
        if(ca >= 1)
                if(cb < 1)
-                       return FALSE;
+                       return false;
 
        // first, normalize
        f = max(ca, cb, 1);
@@ -735,7 +740,7 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam)
                // otherwise end up on the smallest team (handled below)
        }
 
-       smallest = FindSmallestTeam(pl, TRUE);
+       smallest = FindSmallestTeam(pl, true);
 
        if(!only_return_best && !pl.bot_forced_team)
        {
@@ -812,7 +817,7 @@ void SV_ChangeTeam(float _color)
        if(scolor == dcolor)
        {
                //bprint("same team change\n");
-               SetPlayerTeam(self, dteam, steam, TRUE);
+               SetPlayerTeam(self, dteam, steam, true);
                return;
        }
 
@@ -840,7 +845,7 @@ void SV_ChangeTeam(float _color)
                TeamchangeFrags(self);
        }
 
-       SetPlayerTeam(self, dteam, steam, FALSE);
+       SetPlayerTeam(self, dteam, steam, false);
 
        if(IS_PLAYER(self) && steam != dteam)
        {
@@ -984,7 +989,7 @@ void ShufflePlayerOutOfTeam (float source_team)
 
        // move the player to the new team
        TeamchangeFrags(selected);
-       SetPlayerTeam(selected, smallestteam, source_team, FALSE);
+       SetPlayerTeam(selected, smallestteam, source_team, false);
 
        if(selected.deadflag == DEAD_NO)
                Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE, selected.origin, '0 0 0');