Fixed a crash on game end of network games.

This commit is contained in:
lotodore
2007-10-02 18:26:22 +00:00
parent 985e6d7d86
commit 73c90d4106
+4 -12
View File
@@ -682,24 +682,16 @@ ServerGameStateStartRound::Process(ServerGameThread &server)
server.RemoveDisconnectedPlayers();
// Start next hand - if enough players are left.
int playersPositiveCashCounter = 0;
list<boost::shared_ptr<PlayerInterface> > playersWithCash = *curGame.getActivePlayerList();
playersWithCash.remove_if(boost::bind(&PlayerInterface::getMyCash, _1) < 1);
PlayerListIterator i = curGame.getSeatsList()->begin();
PlayerListIterator end = curGame.getSeatsList()->end();
while (i != end)
{
if ((*i)->getMyCash() > 0)
playersPositiveCashCounter++;
++i;
}
if (!playersPositiveCashCounter)
if (playersWithCash.empty())
{
// No more players left - restart.
server.SetState(SERVER_INITIAL_STATE::Instance());
retVal = MSG_NET_GAME_SERVER_END;
}
else if (playersPositiveCashCounter == 1)
else if (playersWithCash.size() == 1)
{
// View a dialog for a new game - delayed.
server.SetState(ServerGameStateNextGameDelay::Instance());