From 0831bb6ae1fa88f975c1a03fe9edcf15efc2a82a Mon Sep 17 00:00:00 2001 From: Lyberta Date: Mon, 9 Apr 2018 00:30:48 +0300 Subject: [PATCH] Avoid variables named team_. --- qcsrc/common/teams.qh | 6 +-- qcsrc/server/teamplay.qc | 102 +++++++++++++++++++-------------------- qcsrc/server/teamplay.qh | 44 ++++++++--------- 3 files changed, 76 insertions(+), 76 deletions(-) diff --git a/qcsrc/common/teams.qh b/qcsrc/common/teams.qh index 88666db0e..1a2e1b176 100644 --- a/qcsrc/common/teams.qh +++ b/qcsrc/common/teams.qh @@ -179,11 +179,11 @@ int Team_IndexToTeam(int index) } /// \brief Converts team value into team index. -/// \param[in] team_ Team value to convert. +/// \param[in] team_num Team value to convert. /// \return Team index. -int Team_TeamToIndex(int team_) +int Team_TeamToIndex(int team_num) { - switch (team_) + switch (team_num) { case NUM_TEAM_1: return 1; case NUM_TEAM_2: return 2; diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 4cc9ff960..7c8d8cea7 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -67,24 +67,24 @@ entity Team_GetTeam(int team_num) return g_team_entities[Team_TeamToIndex(team_num) - 1]; } -float Team_GetTeamScore(entity team_) +float Team_GetTeamScore(entity team_ent) { - return team_.m_team_score; + return team_ent.m_team_score; } -void Team_SetTeamScore(entity team_, float score) +void Team_SetTeamScore(entity team_ent, float score) { - team_.m_team_score = score; + team_ent.m_team_score = score; } -int Team_GetNumberOfAlivePlayers(entity team_) +int Team_GetNumberOfAlivePlayers(entity team_ent) { - return team_.m_num_players_alive; + return team_ent.m_num_players_alive; } -void Team_SetNumberOfAlivePlayers(entity team_, int number) +void Team_SetNumberOfAlivePlayers(entity team_ent, int number) { - team_.m_num_players_alive = number; + team_ent.m_num_players_alive = number; } int Team_GetNumberOfAliveTeams() @@ -100,14 +100,14 @@ int Team_GetNumberOfAliveTeams() return result; } -int Team_GetNumberOfControlPoints(entity team_) +int Team_GetNumberOfControlPoints(entity team_ent) { - return team_.m_num_control_points; + return team_ent.m_num_control_points; } -void Team_SetNumberOfControlPoints(entity team_, int number) +void Team_SetNumberOfControlPoints(entity team_ent, int number) { - team_.m_num_control_points = number; + team_ent.m_num_control_points = number; } int Team_GetNumberOfTeamsWithControlPoints() @@ -252,12 +252,12 @@ entity TeamBalance_CheckAllowedTeams(entity for_whom) entity balance = spawn(); for (int i = 0; i < NUM_TEAMS; ++i) { - entity team_ = balance.m_team_balance_team[i] = spawn(); - team_.m_team_score = g_team_entities[i].m_team_score; - team_.m_num_players = TEAM_NOT_ALLOWED; - team_.m_num_bots = 0; - team_.m_lowest_human = NULL; - team_.m_lowest_bot = NULL; + entity team_ent = balance.m_team_balance_team[i] = spawn(); + team_ent.m_team_score = g_team_entities[i].m_team_score; + team_ent.m_num_players = TEAM_NOT_ALLOWED; + team_ent.m_num_bots = 0; + team_ent.m_lowest_human = NULL; + team_ent.m_lowest_bot = NULL; } int teams_mask = 0; @@ -458,16 +458,16 @@ void TeamBalance_GetTeamCounts(entity balance, entity ignore) // Mutator has overriden the configuration. for (int i = 1; i <= NUM_TEAMS; ++i) { - entity team_ = TeamBalance_GetTeamFromIndex(balance, i); - if (TeamBalanceTeam_IsAllowed(team_)) + entity team_ent = TeamBalance_GetTeamFromIndex(balance, i); + if (TeamBalanceTeam_IsAllowed(team_ent)) { MUTATOR_CALLHOOK(TeamBalance_GetTeamCount, i, ignore, - team_.m_num_players, team_.m_num_bots, team_.m_lowest_human, - team_.m_lowest_bot); - team_.m_num_players = M_ARGV(2, float); - team_.m_num_bots = M_ARGV(3, float); - team_.m_lowest_human = M_ARGV(4, entity); - team_.m_lowest_bot = M_ARGV(5, entity); + team_ent.m_num_players, team_ent.m_num_bots, + team_ent.m_lowest_human, team_ent.m_lowest_bot); + team_ent.m_num_players = M_ARGV(2, float); + team_ent.m_num_bots = M_ARGV(3, float); + team_ent.m_lowest_human = M_ARGV(4, entity); + team_ent.m_lowest_bot = M_ARGV(5, entity); } } } @@ -497,39 +497,39 @@ void TeamBalance_GetTeamCounts(entity balance, entity ignore) { continue; } - entity team_ = TeamBalance_GetTeam(balance, team_num); - if (!TeamBalanceTeam_IsAllowed(team_)) + entity team_ent = TeamBalance_GetTeam(balance, team_num); + if (!TeamBalanceTeam_IsAllowed(team_ent)) { continue; } - ++team_.m_num_players; + ++team_ent.m_num_players; if (IS_BOT_CLIENT(it)) { - ++team_.m_num_bots; + ++team_ent.m_num_bots; } float temp_score = PlayerScore_Get(it, SP_SCORE); if (!IS_BOT_CLIENT(it)) { - if (team_.m_lowest_human == NULL) + if (team_ent.m_lowest_human == NULL) { - team_.m_lowest_human = it; + team_ent.m_lowest_human = it; continue; } - if (temp_score < PlayerScore_Get(team_.m_lowest_human, + if (temp_score < PlayerScore_Get(team_ent.m_lowest_human, SP_SCORE)) { - team_.m_lowest_human = it; + team_ent.m_lowest_human = it; } continue; } - if (team_.m_lowest_bot == NULL) + if (team_ent.m_lowest_bot == NULL) { - team_.m_lowest_bot = it; + team_ent.m_lowest_bot = it; continue; } - if (temp_score < PlayerScore_Get(team_.m_lowest_bot, SP_SCORE)) + if (temp_score < PlayerScore_Get(team_ent.m_lowest_bot, SP_SCORE)) { - team_.m_lowest_bot = it; + team_ent.m_lowest_bot = it; } }); } @@ -539,11 +539,11 @@ void TeamBalance_GetTeamCounts(entity balance, entity ignore) { if (Team_IsValidIndex(autocvar_g_campaign_forceteam)) { - entity team_ = TeamBalance_GetTeamFromIndex(balance, + entity team_ent = TeamBalance_GetTeamFromIndex(balance, autocvar_g_campaign_forceteam); - if (team_.m_num_players == team_.m_num_bots) + if (team_ent.m_num_players == team_ent.m_num_bots) { - ++team_.m_num_players; + ++team_ent.m_num_players; } } } @@ -814,29 +814,29 @@ entity TeamBalance_GetTeam(entity balance, int team_num) return TeamBalance_GetTeamFromIndex(balance, Team_TeamToIndex(team_num)); } -bool TeamBalanceTeam_IsAllowed(entity team_) +bool TeamBalanceTeam_IsAllowed(entity team_ent) { - return team_.m_num_players != TEAM_NOT_ALLOWED; + return team_ent.m_num_players != TEAM_NOT_ALLOWED; } -int TeamBalanceTeam_GetNumberOfPlayers(entity team_) +int TeamBalanceTeam_GetNumberOfPlayers(entity team_ent) { - return team_.m_num_players; + return team_ent.m_num_players; } -int TeamBalanceTeam_GetNumberOfBots(entity team_) +int TeamBalanceTeam_GetNumberOfBots(entity team_ent) { - return team_.m_num_bots; + return team_ent.m_num_bots; } -entity TeamBalanceTeam_GetLowestHuman(entity team_) +entity TeamBalanceTeam_GetLowestHuman(entity team_ent) { - return team_.m_lowest_human; + return team_ent.m_lowest_human; } -entity TeamBalanceTeam_GetLowestBot(entity team_) +entity TeamBalanceTeam_GetLowestBot(entity team_ent) { - return team_.m_lowest_bot; + return team_ent.m_lowest_bot; } int TeamBalance_CompareTeamsInternal(entity team_a, entity team_b, diff --git a/qcsrc/server/teamplay.qh b/qcsrc/server/teamplay.qh index 444c25d3c..d40b98504 100644 --- a/qcsrc/server/teamplay.qh +++ b/qcsrc/server/teamplay.qh @@ -18,38 +18,38 @@ entity Team_GetTeam(int team_num); // ========================= Team specific API ================================ /// \brief Returns the score of the team. -/// \param[in] team_ Team entity. +/// \param[in] team_ent Team entity. /// \return Score of the team. -float Team_GetTeamScore(entity team_); +float Team_GetTeamScore(entity team_ent); /// \brief Sets the score of the team. -/// \param[in,out] team_ Team entity. +/// \param[in,out] team_ent Team entity. /// \param[in] score Score to set. -void Team_SetTeamScore(entity team_, float score); +void Team_SetTeamScore(entity team_ent, float score); /// \brief Returns the number of alive players in a team. -/// \param[in] team_ Team entity. +/// \param[in] team_ent Team entity. /// \return Number of alive players in a team. -int Team_GetNumberOfAlivePlayers(entity team_); +int Team_GetNumberOfAlivePlayers(entity team_ent); /// \brief Sets the number of alive players in a team. -/// \param[in,out] team_ Team entity. +/// \param[in,out] team_ent Team entity. /// \param[in] number Number of players to set. -void Team_SetNumberOfAlivePlayers(entity team_, int number); +void Team_SetNumberOfAlivePlayers(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 control points owned by a team. -/// \param[in] team_ Team entity. +/// \param[in] team_ent Team entity. /// \return Number of control points owned by a team. -int Team_GetNumberOfControlPoints(entity team_); +int Team_GetNumberOfControlPoints(entity team_ent); /// \brief Sets the number of control points owned by a team. -/// \param[in,out] team_ Team entity. +/// \param[in,out] team_ent Team entity. /// \param[in] number Number of control points to set. -void Team_SetNumberOfControlPoints(entity team_, int number); +void Team_SetNumberOfControlPoints(entity team_ent, int number); /// \brief Returns the number of teams that own control points. /// \return Number of teams that own control points. @@ -239,39 +239,39 @@ entity TeamBalance_GetTeamFromIndex(entity balance, int index); entity TeamBalance_GetTeam(entity balance, int team_num); /// \brief Returns whether the team is allowed. -/// \param[in] team_ Team entity. +/// \param[in] team_ent Team entity. /// \return True if team is allowed, false otherwise. -bool TeamBalanceTeam_IsAllowed(entity team_); +bool TeamBalanceTeam_IsAllowed(entity team_ent); /// \brief Returns the number of players (both humans and bots) in a team. -/// \param[in] team_ Team entity. +/// \param[in] team_ent Team entity. /// \return Number of player (both humans and bots) in a team. /// \note You need to call TeamBalance_GetTeamCounts before calling this /// function. -int TeamBalanceTeam_GetNumberOfPlayers(entity team_); +int TeamBalanceTeam_GetNumberOfPlayers(entity team_ent); /// \brief Returns the number of bots in a team. -/// \param[in] team_ Team entity. +/// \param[in] team_ent Team entity. /// \return Number of bots in a team. /// \note You need to call TeamBalance_GetTeamCounts before calling this /// function. -int TeamBalanceTeam_GetNumberOfBots(entity team_); +int TeamBalanceTeam_GetNumberOfBots(entity team_ent); /// \brief Returns the human with the lowest score in a team or NULL if there is /// none. -/// \param[in] team_ Team entity. +/// \param[in] team_ent Team entity. /// \return Human with the lowest score in a team or NULL if there is none. /// \note You need to call TeamBalance_GetTeamCounts before calling this /// function. -entity TeamBalanceTeam_GetLowestHuman(entity team_); +entity TeamBalanceTeam_GetLowestHuman(entity team_ent); /// \brief Returns the bot with the lowest score in a team or NULL if there is /// none. -/// \param[in] team_ Team entity. +/// \param[in] team_ent Team entity. /// \return Bot with the lowest score in a team or NULL if there is none. /// \note You need to call TeamBalance_GetTeamCounts before calling this /// function. -entity TeamBalanceTeam_GetLowestBot(entity team_); +entity TeamBalanceTeam_GetLowestBot(entity team_ent); /// \brief Compares two teams for the purposes of game balance. /// \param[in] team_a First team. -- 2.39.2