Rewrote the code which handles leaving of players during the network game. Some bug is still remaining.

This commit is contained in:
lotodore
2007-06-15 10:38:41 +00:00
parent a7598a20eb
commit e19f6c7471
8 changed files with 110 additions and 50 deletions
+6 -2
View File
@@ -637,6 +637,10 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
server.SendToAllPlayers(endHand);
}
// Remove disconnected players. This is the one and only place to do this.
server.RemoveDisconnectedPlayers();
// Start next hand - if enough players are left.
int playersPositiveCashCounter = 0;
for (int i = 0; i < curGame.getStartQuantityPlayers(); i++)
@@ -728,9 +732,9 @@ ServerRecvStateWaitPlayerAction::Process(ServerRecvThread &server)
// If the player we are waiting for left, continue without him.
PlayerInterface *tmpPlayer = GetCurrentPlayer(server.GetGame());
assert(tmpPlayer);
if (!tmpPlayer->getMyActiveStatus())
assert(!tmpPlayer->getMyName().empty());
if (!server.IsPlayerConnected(tmpPlayer->getMyName()))
{
assert(tmpPlayer->getMyAction() == PLAYER_ACTION_FOLD && tmpPlayer->getMyCash() == 0);
PerformPlayerAction(server, tmpPlayer, PLAYER_ACTION_FOLD, 0);
server.SetState(ServerRecvStateStartRound::Instance());