Fix bug #1396 - can start game with everyone on the same team.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9456 4a71c877-e1ca-e34f-864e-861f7616d084
master
Guangcong Luo 2010-01-24 04:48:56 +00:00 committed by Git SVN Gateway
parent f4de16db77
commit 4e828632be
1 changed files with 23 additions and 2 deletions

View File

@ -2001,7 +2001,8 @@ UDWORD addPlayerBox(BOOL players)
if(players)
{
int numPlayers = 0;
int numPlayers = 0, team = -1;
bool allOnSameTeam = true;
for (i=0;i<game.maxPlayers;i++)
{
@ -2015,6 +2016,26 @@ UDWORD addPlayerBox(BOOL players)
}
}
if (game.alliance != ALLIANCES_TEAMS)
{
allOnSameTeam = false;
}
else for (i=0; i<game.maxPlayers; i++)
{
if (game.skDiff[i] || isHumanPlayer(i))
{
if (team == -1)
{
team = NetPlay.players[i].team;
}
else if (NetPlay.players[i].team != team)
{
allOnSameTeam = false;
break;
}
}
}
for (i=0;i<game.maxPlayers;i++)
{
if(ingame.localOptionsReceived)
@ -2054,7 +2075,7 @@ UDWORD addPlayerBox(BOOL players)
if (ingame.localOptionsReceived && NetPlay.players[i].allocated) // only draw if real player!
{
// add a 'ready' button
if (numPlayers > 1) // only if we have enough players to start
if (numPlayers > 1 && !allOnSameTeam) // only if we have enough players to start
{
drawReadyButton(i);
}