diff --git a/src/p_tick.c b/src/p_tick.c index 0b35ed7e3..4e802297f 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -485,24 +485,20 @@ static void P_DoAutobalanceTeams(void) { i = M_RandomKey(count[G_GetTeam(1)]); NetPacket.packet.newteam = 2; - NetPacket.packet.playernum = array[1][i]; - NetPacket.packet.verification = true; - NetPacket.packet.autobalance = true; - - usvalue = SHORT(NetPacket.value.l|NetPacket.value.b); - SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue)); + NetPacket.packet.playernum = array[G_GetTeam(1)][i]; } else { i = M_RandomKey(count[G_GetTeam(2)]); NetPacket.packet.newteam = 1; - NetPacket.packet.playernum = array[2][i]; - NetPacket.packet.verification = true; - NetPacket.packet.autobalance = true; - - usvalue = SHORT(NetPacket.value.l|NetPacket.value.b); - SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue)); + NetPacket.packet.playernum = array[G_GetTeam(2)][i]; } + + NetPacket.packet.verification = true; + NetPacket.packet.autobalance = true; + + usvalue = SHORT(NetPacket.value.l|NetPacket.value.b); + SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue)); } } @@ -651,7 +647,7 @@ static inline void P_DoTagStuff(void) } } -static inline void P_DoCTFStuff(void) +static inline void P_DoTeamGametypeStuff(void) { // Automatic team balance for CTF and team match if (leveltime % (TICRATE * 5) == 0) //only check once per five seconds for the sake of CPU conservation. @@ -803,7 +799,7 @@ void P_Ticker(boolean run) P_DoTagStuff(); if (G_GametypeHasTeams()) - P_DoCTFStuff(); + P_DoTeamGametypeStuff(); if (run) { diff --git a/src/p_user.c b/src/p_user.c index 7e2ef1bf5..c0d9e2f69 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -10506,7 +10506,6 @@ boolean P_SpectatorJoinGame(player_t *player) // Team changing in Team Match and CTF // Pressing fire assigns you to a team that needs players if allowed. - // Partial code reproduction from p_tick.c autobalance code. else if (G_GametypeHasTeams()) { UINT8 changeto = G_GetMostDisadvantagedTeam();