Inform players when another player is no longer allowed to rejoin.
This commit is contained in:
+2
-1
@@ -812,7 +812,8 @@ NetPlayerAction ::= ENUMERATED {
|
|||||||
|
|
||||||
NetPlayerState ::= ENUMERATED {
|
NetPlayerState ::= ENUMERATED {
|
||||||
playerStateNormal (0),
|
playerStateNormal (0),
|
||||||
playerStateSessionInactive (1)
|
playerStateSessionInactive (1),
|
||||||
|
playerStateNoMoney (2)
|
||||||
}
|
}
|
||||||
|
|
||||||
NonZeroId ::= INTEGER(1..4294967295)
|
NonZeroId ::= INTEGER(1..4294967295)
|
||||||
|
|||||||
@@ -183,8 +183,6 @@ protected:
|
|||||||
boost::shared_ptr<PlayerData> GetPlayerDataByUniqueId(unsigned id);
|
boost::shared_ptr<PlayerData> GetPlayerDataByUniqueId(unsigned id);
|
||||||
boost::shared_ptr<PlayerData> GetPlayerDataByName(const std::string &name);
|
boost::shared_ptr<PlayerData> GetPlayerDataByName(const std::string &name);
|
||||||
|
|
||||||
void RemoveDisconnectedPlayers();
|
|
||||||
|
|
||||||
void AddServerInfo(unsigned serverId, const ServerInfo &info);
|
void AddServerInfo(unsigned serverId, const ServerInfo &info);
|
||||||
void ClearServerInfoMap();
|
void ClearServerInfoMap();
|
||||||
bool GetSelectedServer(unsigned &serverId) const;
|
bool GetSelectedServer(unsigned &serverId) const;
|
||||||
|
|||||||
@@ -1609,9 +1609,6 @@ void
|
|||||||
ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client, boost::shared_ptr<NetPacket> tmpPacket)
|
ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client, boost::shared_ptr<NetPacket> tmpPacket)
|
||||||
{
|
{
|
||||||
if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_handStartMessage) {
|
if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_handStartMessage) {
|
||||||
// Remove all players which left the server.
|
|
||||||
client->RemoveDisconnectedPlayers();
|
|
||||||
|
|
||||||
// Hand was started.
|
// Hand was started.
|
||||||
// These are the cards. Good luck.
|
// These are the cards. Good luck.
|
||||||
HandStartMessage_t *netHandStart = &tmpPacket->GetMsg()->choice.handStartMessage;
|
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);
|
boost::shared_ptr<PlayerInterface> tmpPlayer = client->GetGame()->getPlayerByNumber((i + client->GetOrigGuiPlayerNum()) % client->GetStartData().numberOfPlayers);
|
||||||
if (!tmpPlayer)
|
if (!tmpPlayer)
|
||||||
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
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;
|
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
|
void
|
||||||
ClientThread::AddServerInfo(unsigned serverId, const ServerInfo &info)
|
ClientThread::AddServerInfo(unsigned serverId, const ServerInfo &info)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1199,7 +1199,13 @@ ServerGameStateHand::StartNewHand(boost::shared_ptr<ServerGame> server)
|
|||||||
PlayerListIterator player_end = curGame.getSeatsList()->end();
|
PlayerListIterator player_end = curGame.getSeatsList()->end();
|
||||||
while (player_i != player_end) {
|
while (player_i != player_end) {
|
||||||
NetPlayerState_t *seatState = (NetPlayerState_t *)calloc(1, sizeof(NetPlayerState_t));
|
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);
|
ASN_SEQUENCE_ADD(&netHandStart->seatStates.list, seatState);
|
||||||
++player_i;
|
++player_i;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -82,16 +82,18 @@ NetPlayerState_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
|
|||||||
|
|
||||||
static asn_INTEGER_enum_map_t asn_MAP_NetPlayerState_value2enum_1[] = {
|
static asn_INTEGER_enum_map_t asn_MAP_NetPlayerState_value2enum_1[] = {
|
||||||
{ 0, 17, "playerStateNormal" },
|
{ 0, 17, "playerStateNormal" },
|
||||||
{ 1, 26, "playerStateSessionInactive" }
|
{ 1, 26, "playerStateSessionInactive" },
|
||||||
|
{ 2, 18, "playerStateNoMoney" }
|
||||||
};
|
};
|
||||||
static unsigned int asn_MAP_NetPlayerState_enum2value_1[] = {
|
static unsigned int asn_MAP_NetPlayerState_enum2value_1[] = {
|
||||||
|
2, /* playerStateNoMoney(2) */
|
||||||
0, /* playerStateNormal(0) */
|
0, /* playerStateNormal(0) */
|
||||||
1 /* playerStateSessionInactive(1) */
|
1 /* playerStateSessionInactive(1) */
|
||||||
};
|
};
|
||||||
static asn_INTEGER_specifics_t asn_SPC_NetPlayerState_specs_1 = {
|
static asn_INTEGER_specifics_t asn_SPC_NetPlayerState_specs_1 = {
|
||||||
asn_MAP_NetPlayerState_value2enum_1, /* "tag" => N; sorted by tag */
|
asn_MAP_NetPlayerState_value2enum_1, /* "tag" => N; sorted by tag */
|
||||||
asn_MAP_NetPlayerState_enum2value_1, /* N => "tag"; sorted by N */
|
asn_MAP_NetPlayerState_enum2value_1, /* N => "tag"; sorted by N */
|
||||||
2, /* Number of elements in the maps */
|
3, /* Number of elements in the maps */
|
||||||
0, /* Enumeration is not extensible */
|
0, /* Enumeration is not extensible */
|
||||||
1, /* Strict enumeration */
|
1, /* Strict enumeration */
|
||||||
0, /* Native long size */
|
0, /* Native long size */
|
||||||
|
|||||||
+2
-1
@@ -21,7 +21,8 @@ extern "C" {
|
|||||||
/* Dependencies */
|
/* Dependencies */
|
||||||
typedef enum NetPlayerState {
|
typedef enum NetPlayerState {
|
||||||
NetPlayerState_playerStateNormal = 0,
|
NetPlayerState_playerStateNormal = 0,
|
||||||
NetPlayerState_playerStateSessionInactive = 1
|
NetPlayerState_playerStateSessionInactive = 1,
|
||||||
|
NetPlayerState_playerStateNoMoney = 2
|
||||||
}
|
}
|
||||||
e_NetPlayerState;
|
e_NetPlayerState;
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import org.bn.types.*;
|
|||||||
playerStateNormal ,
|
playerStateNormal ,
|
||||||
@ASN1EnumItem ( name = "playerStateSessionInactive", hasTag = true , tag = 1 )
|
@ASN1EnumItem ( name = "playerStateSessionInactive", hasTag = true , tag = 1 )
|
||||||
playerStateSessionInactive ,
|
playerStateSessionInactive ,
|
||||||
|
@ASN1EnumItem ( name = "playerStateNoMoney", hasTag = true , tag = 2 )
|
||||||
|
playerStateNoMoney ,
|
||||||
}
|
}
|
||||||
|
|
||||||
private EnumType value;
|
private EnumType value;
|
||||||
|
|||||||
Reference in New Issue
Block a user