]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
added functions to support storing and fetching data for total amount of players... drjaska/teamplaytotalplayers
authordrjaska <drjaska83@gmail.com>
Sun, 28 Nov 2021 04:51:38 +0000 (06:51 +0200)
committerdrjaska <drjaska83@gmail.com>
Sun, 28 Nov 2021 04:51:38 +0000 (06:51 +0200)
not just the alive players anymore.

qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh

index c26a0b16550ac51062a40c742468d5f93f214076..348045ba1519ee9102588f57adcfc6304491c91a 100644 (file)
@@ -35,6 +35,7 @@ const int TEAM_NOT_ALLOWED = -1;
 .int m_num_players; ///< Number of players (both humans and bots) in a team.
 .int m_num_bots; ///< Number of bots in a team.
 .int m_num_players_alive; ///< Number of alive players in a team.
+.int m_num_players_total; ///< Number of total players in a team.
 .int m_num_control_points; ///< Number of control points owned by a team.
 
 string autocvar_g_forced_team_red;
@@ -92,6 +93,16 @@ void Team_SetNumberOfAlivePlayers(entity team_ent, int number)
        team_ent.m_num_players_alive = number;
 }
 
+int Team_GetNumberOfTotalPlayers(entity team_ent)
+{
+       return team_ent.m_num_players_total;
+}
+
+void Team_SetNumberOfTotalPlayers(entity team_ent, int number)
+{
+       team_ent.m_num_players_total = number;
+}
+
 int Team_GetNumberOfAliveTeams()
 {
        int result = 0;
@@ -105,6 +116,19 @@ int Team_GetNumberOfAliveTeams()
        return result;
 }
 
+int Team_GetNumberOfTotalTeams()
+{
+       int result = 0;
+       for (int i = 0; i < NUM_TEAMS; ++i)
+       {
+               if (g_team_entities[i].m_num_players_total > 0)
+               {
+                       ++result;
+               }
+       }
+       return result;
+}
+
 int Team_GetNumberOfControlPoints(entity team_ent)
 {
        return team_ent.m_num_control_points;
index 06787c6ffa06c72ec593b4429560949c99e74996..43e06dabd4fa08198376bdcbfec410e93606fc46 100644 (file)
@@ -46,15 +46,29 @@ void Team_SetTeamScore(entity team_ent, float score);
 /// \return Number of alive players in a team.
 int Team_GetNumberOfAlivePlayers(entity team_ent);
 
+/// \brief Returns the number of total players in a team.
+/// \param[in] team_ent Team entity.
+/// \return Number of total players in a team.
+int Team_GetNumberOfTotalPlayers(entity team_ent);
+
 /// \brief Sets the number of alive players in a team.
 /// \param[in,out] team_ent Team entity.
 /// \param[in] number Number of players to set.
 void Team_SetNumberOfAlivePlayers(entity team_ent, int number);
 
+/// \brief Sets the number of total players in a team.
+/// \param[in,out] team_ent Team entity.
+/// \param[in] number Number of players to set.
+void Team_SetNumberOfTotalPlayers(entity team_ent, int number);
+
 /// \brief Returns the number of alive teams.
 /// \return Number of alive teams.
 int Team_GetNumberOfAliveTeams();
 
+/// \brief Returns the number of total teams.
+/// \return Number of total teams.
+int Team_GetNumberOfTotalTeams();
+
 /// \brief Returns the number of control points owned by a team.
 /// \param[in] team_ent Team entity.
 /// \return Number of control points owned by a team.