Inform players when another player is no longer allowed to rejoin.
This commit is contained in:
@@ -1609,9 +1609,6 @@ void
|
||||
ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client, boost::shared_ptr<NetPacket> tmpPacket)
|
||||
{
|
||||
if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_handStartMessage) {
|
||||
// Remove all players which left the server.
|
||||
client->RemoveDisconnectedPlayers();
|
||||
|
||||
// Hand was started.
|
||||
// These are the cards. Good luck.
|
||||
HandStartMessage_t *netHandStart = &tmpPacket->GetMsg()->choice.handStartMessage;
|
||||
@@ -1657,7 +1654,18 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = client->GetGame()->getPlayerByNumber((i + client->GetOrigGuiPlayerNum()) % client->GetStartData().numberOfPlayers);
|
||||
if (!tmpPlayer)
|
||||
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
||||
tmpPlayer->setIsSessionActive(*seatState == NetPlayerState_playerStateNormal);
|
||||
switch (*seatState)
|
||||
{
|
||||
case NetPlayerState_playerStateNormal :
|
||||
tmpPlayer->setIsSessionActive(true);
|
||||
break;
|
||||
case NetPlayerState_playerStateSessionInactive :
|
||||
tmpPlayer->setIsSessionActive(false);
|
||||
break;
|
||||
case NetPlayerState_playerStateNoMoney :
|
||||
tmpPlayer->setMyCash(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1161,29 +1161,6 @@ ClientThread::GetPlayerDataByName(const std::string &name)
|
||||
return tmpPlayer;
|
||||
}
|
||||
|
||||
void
|
||||
ClientThread::RemoveDisconnectedPlayers()
|
||||
{
|
||||
// This should only be called between hands.
|
||||
if (m_game) {
|
||||
PlayerList tmpList(m_game->getSeatsList());
|
||||
PlayerListIterator i = tmpList->begin();
|
||||
PlayerListIterator end = tmpList->end();
|
||||
while (i != end) {
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = *i;
|
||||
if (tmpPlayer->getMyActiveStatus()) {
|
||||
// If a player is not in the player data list, it was disconnected.
|
||||
if (!GetPlayerDataByUniqueId(tmpPlayer->getMyUniqueID()).get()) {
|
||||
if (tmpPlayer->isKicked()) {
|
||||
tmpPlayer->setMyCash(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ClientThread::AddServerInfo(unsigned serverId, const ServerInfo &info)
|
||||
{
|
||||
|
||||
@@ -1199,7 +1199,13 @@ ServerGameStateHand::StartNewHand(boost::shared_ptr<ServerGame> server)
|
||||
PlayerListIterator player_end = curGame.getSeatsList()->end();
|
||||
while (player_i != player_end) {
|
||||
NetPlayerState_t *seatState = (NetPlayerState_t *)calloc(1, sizeof(NetPlayerState_t));
|
||||
*seatState = (*player_i)->isSessionActive() ? NetPlayerState_playerStateNormal : NetPlayerState_playerStateSessionInactive;
|
||||
if ((*player_i)->getMyCash() <= 0) {
|
||||
*seatState = NetPlayerState_playerStateNoMoney;
|
||||
} else if (!(*player_i)->isSessionActive()) {
|
||||
*seatState = NetPlayerState_playerStateSessionInactive;
|
||||
} else {
|
||||
*seatState = NetPlayerState_playerStateNormal;
|
||||
}
|
||||
ASN_SEQUENCE_ADD(&netHandStart->seatStates.list, seatState);
|
||||
++player_i;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user