mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-12-18 17:01:20 +00:00
Minor autobalance fix
This commit is contained in:
parent
fa6327c83b
commit
d03d597963
2 changed files with 10 additions and 15 deletions
16
src/p_tick.c
16
src/p_tick.c
|
@ -485,25 +485,21 @@ static void P_DoAutobalanceTeams(void)
|
||||||
{
|
{
|
||||||
i = M_RandomKey(count[G_GetTeam(1)]);
|
i = M_RandomKey(count[G_GetTeam(1)]);
|
||||||
NetPacket.packet.newteam = 2;
|
NetPacket.packet.newteam = 2;
|
||||||
NetPacket.packet.playernum = array[1][i];
|
NetPacket.packet.playernum = array[G_GetTeam(1)][i];
|
||||||
NetPacket.packet.verification = true;
|
|
||||||
NetPacket.packet.autobalance = true;
|
|
||||||
|
|
||||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
|
||||||
SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
i = M_RandomKey(count[G_GetTeam(2)]);
|
i = M_RandomKey(count[G_GetTeam(2)]);
|
||||||
NetPacket.packet.newteam = 1;
|
NetPacket.packet.newteam = 1;
|
||||||
NetPacket.packet.playernum = array[2][i];
|
NetPacket.packet.playernum = array[G_GetTeam(2)][i];
|
||||||
|
}
|
||||||
|
|
||||||
NetPacket.packet.verification = true;
|
NetPacket.packet.verification = true;
|
||||||
NetPacket.packet.autobalance = true;
|
NetPacket.packet.autobalance = true;
|
||||||
|
|
||||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||||
SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
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
|
// 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.
|
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();
|
P_DoTagStuff();
|
||||||
|
|
||||||
if (G_GametypeHasTeams())
|
if (G_GametypeHasTeams())
|
||||||
P_DoCTFStuff();
|
P_DoTeamGametypeStuff();
|
||||||
|
|
||||||
if (run)
|
if (run)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10506,7 +10506,6 @@ boolean P_SpectatorJoinGame(player_t *player)
|
||||||
|
|
||||||
// Team changing in Team Match and CTF
|
// Team changing in Team Match and CTF
|
||||||
// Pressing fire assigns you to a team that needs players if allowed.
|
// 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())
|
else if (G_GametypeHasTeams())
|
||||||
{
|
{
|
||||||
UINT8 changeto = G_GetMostDisadvantagedTeam();
|
UINT8 changeto = G_GetMostDisadvantagedTeam();
|
||||||
|
|
Loading…
Reference in a new issue