Fixed a crash on game end of network games.
This commit is contained in:
@@ -682,24 +682,16 @@ ServerGameStateStartRound::Process(ServerGameThread &server)
|
|||||||
server.RemoveDisconnectedPlayers();
|
server.RemoveDisconnectedPlayers();
|
||||||
|
|
||||||
// Start next hand - if enough players are left.
|
// 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();
|
if (playersWithCash.empty())
|
||||||
PlayerListIterator end = curGame.getSeatsList()->end();
|
|
||||||
|
|
||||||
while (i != end)
|
|
||||||
{
|
|
||||||
if ((*i)->getMyCash() > 0)
|
|
||||||
playersPositiveCashCounter++;
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
if (!playersPositiveCashCounter)
|
|
||||||
{
|
{
|
||||||
// No more players left - restart.
|
// No more players left - restart.
|
||||||
server.SetState(SERVER_INITIAL_STATE::Instance());
|
server.SetState(SERVER_INITIAL_STATE::Instance());
|
||||||
retVal = MSG_NET_GAME_SERVER_END;
|
retVal = MSG_NET_GAME_SERVER_END;
|
||||||
}
|
}
|
||||||
else if (playersPositiveCashCounter == 1)
|
else if (playersWithCash.size() == 1)
|
||||||
{
|
{
|
||||||
// View a dialog for a new game - delayed.
|
// View a dialog for a new game - delayed.
|
||||||
server.SetState(ServerGameStateNextGameDelay::Instance());
|
server.SetState(ServerGameStateNextGameDelay::Instance());
|
||||||
|
|||||||
Reference in New Issue
Block a user