Transfer small blind and minimum raise amount to client.
This commit is contained in:
@@ -489,10 +489,12 @@ Server Notification: Hand Start
|
|||||||
0 1 2 3
|
0 1 2 3
|
||||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Message Type = 81 | Message Length = 8 |
|
| Message Type = 81 | Message Length = 12 |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Your 1st Card | Your 2nd Card |
|
| Your 1st Card | Your 2nd Card |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| Small Blind |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
|
||||||
Card:
|
Card:
|
||||||
0 to 51
|
0 to 51
|
||||||
@@ -503,10 +505,12 @@ Server Request/Notification: Player's Turn
|
|||||||
0 1 2 3
|
0 1 2 3
|
||||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Message Type = 82 | Message Length = 8 |
|
| Message Type = 82 | Message Length = 16 |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Player ID |
|
| Player ID |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
| Minimum Raise |
|
||||||
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
| Game State | Reserved |
|
| Game State | Reserved |
|
||||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
|
||||||
|
|||||||
@@ -815,6 +815,7 @@ ClientStateWaitHand::InternalProcess(ClientThread &client, boost::shared_ptr<Net
|
|||||||
myCards[1] = (int)tmpData.yourCards[1];
|
myCards[1] = (int)tmpData.yourCards[1];
|
||||||
client.GetGame()->getSeatsList()->front()->setMyCards(myCards);
|
client.GetGame()->getSeatsList()->front()->setMyCards(myCards);
|
||||||
client.GetGame()->initHand();
|
client.GetGame()->initHand();
|
||||||
|
client.GetGame()->getCurrentHand()->setSmallBlind(tmpData.smallBlind);
|
||||||
client.GetGame()->startHand();
|
client.GetGame()->startHand();
|
||||||
client.GetGui().dealHoleCards();
|
client.GetGui().dealHoleCards();
|
||||||
client.GetGui().refreshGameLabels(GAME_STATE_PREFLOP);
|
client.GetGui().refreshGameLabels(GAME_STATE_PREFLOP);
|
||||||
@@ -952,6 +953,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
|
|
||||||
// Next player's turn.
|
// Next player's turn.
|
||||||
curGame->getCurrentHand()->getCurrentBeRo()->setCurrentPlayersTurnId(tmpPlayer->getMyID());
|
curGame->getCurrentHand()->getCurrentBeRo()->setCurrentPlayersTurnId(tmpPlayer->getMyID());
|
||||||
|
curGame->getCurrentHand()->getCurrentBeRo()->setMinimumRaise(turnData.minimumRaise);
|
||||||
// TODO: remove this
|
// TODO: remove this
|
||||||
curGame->getCurrentHand()->getCurrentBeRo()->setPlayersTurn(tmpPlayer->getMyID());
|
curGame->getCurrentHand()->getCurrentBeRo()->setPlayersTurn(tmpPlayer->getMyID());
|
||||||
|
|
||||||
|
|||||||
@@ -322,12 +322,14 @@ struct GCC_PACKED NetPacketHandStartData
|
|||||||
NetPacketHeader head;
|
NetPacketHeader head;
|
||||||
u_int16_t yourCard1;
|
u_int16_t yourCard1;
|
||||||
u_int16_t yourCard2;
|
u_int16_t yourCard2;
|
||||||
|
u_int32_t smallBlind;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GCC_PACKED NetPacketPlayersTurnData
|
struct GCC_PACKED NetPacketPlayersTurnData
|
||||||
{
|
{
|
||||||
NetPacketHeader head;
|
NetPacketHeader head;
|
||||||
u_int32_t playerId;
|
u_int32_t playerId;
|
||||||
|
u_int32_t minimumRaise;
|
||||||
u_int16_t gameState;
|
u_int16_t gameState;
|
||||||
u_int16_t reserved;
|
u_int16_t reserved;
|
||||||
};
|
};
|
||||||
@@ -2923,6 +2925,7 @@ NetPacketHandStart::SetData(const NetPacketHandStart::Data &inData)
|
|||||||
|
|
||||||
tmpData->yourCard1 = htons(inData.yourCards[0]);
|
tmpData->yourCard1 = htons(inData.yourCards[0]);
|
||||||
tmpData->yourCard2 = htons(inData.yourCards[1]);
|
tmpData->yourCard2 = htons(inData.yourCards[1]);
|
||||||
|
tmpData->smallBlind = htonl(inData.smallBlind);
|
||||||
|
|
||||||
// Check the packet - just in case.
|
// Check the packet - just in case.
|
||||||
Check(GetRawData());
|
Check(GetRawData());
|
||||||
@@ -2935,6 +2938,7 @@ NetPacketHandStart::GetData(NetPacketHandStart::Data &outData) const
|
|||||||
|
|
||||||
outData.yourCards[0] = ntohs(tmpData->yourCard1);
|
outData.yourCards[0] = ntohs(tmpData->yourCard1);
|
||||||
outData.yourCards[1] = ntohs(tmpData->yourCard2);
|
outData.yourCards[1] = ntohs(tmpData->yourCard2);
|
||||||
|
outData.smallBlind = ntohl(tmpData->smallBlind);
|
||||||
}
|
}
|
||||||
|
|
||||||
const NetPacketHandStart *
|
const NetPacketHandStart *
|
||||||
@@ -2985,6 +2989,7 @@ NetPacketPlayersTurn::SetData(const NetPacketPlayersTurn::Data &inData)
|
|||||||
|
|
||||||
tmpData->playerId = htonl(inData.playerId);
|
tmpData->playerId = htonl(inData.playerId);
|
||||||
tmpData->gameState = htons(inData.gameState);
|
tmpData->gameState = htons(inData.gameState);
|
||||||
|
tmpData->minimumRaise = htonl(inData.minimumRaise);
|
||||||
|
|
||||||
// Check the packet - just in case.
|
// Check the packet - just in case.
|
||||||
Check(GetRawData());
|
Check(GetRawData());
|
||||||
@@ -2997,6 +3002,7 @@ NetPacketPlayersTurn::GetData(NetPacketPlayersTurn::Data &outData) const
|
|||||||
|
|
||||||
outData.playerId = ntohl(tmpData->playerId);
|
outData.playerId = ntohl(tmpData->playerId);
|
||||||
outData.gameState = static_cast<GameState>(ntohs(tmpData->gameState));
|
outData.gameState = static_cast<GameState>(ntohs(tmpData->gameState));
|
||||||
|
outData.minimumRaise = ntohl(tmpData->minimumRaise);
|
||||||
}
|
}
|
||||||
|
|
||||||
const NetPacketPlayersTurn *
|
const NetPacketPlayersTurn *
|
||||||
|
|||||||
@@ -419,6 +419,7 @@ ServerGameStateWaitAck::InternalProcess(ServerGameThread &server, SessionWrapper
|
|||||||
if (server.GetSessionManager().CountReadySessions() == server.GetSessionManager().GetRawSessionCount())
|
if (server.GetSessionManager().CountReadySessions() == server.GetSessionManager().GetRawSessionCount())
|
||||||
{
|
{
|
||||||
// Everyone is ready.
|
// Everyone is ready.
|
||||||
|
server.GetSessionManager().ResetAllReadyFlags();
|
||||||
server.SetState(SERVER_START_GAME_STATE::Instance());
|
server.SetState(SERVER_START_GAME_STATE::Instance());
|
||||||
retVal = MSG_SOCK_INIT_DONE;
|
retVal = MSG_SOCK_INIT_DONE;
|
||||||
}
|
}
|
||||||
@@ -505,8 +506,6 @@ ServerGameStateStartHand::~ServerGameStateStartHand()
|
|||||||
int
|
int
|
||||||
ServerGameStateStartHand::Process(ServerGameThread &server)
|
ServerGameStateStartHand::Process(ServerGameThread &server)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<NetPacket> answer(new NetPacketHandStart);
|
|
||||||
|
|
||||||
// Initialize hand.
|
// Initialize hand.
|
||||||
Game &curGame = server.GetGame();
|
Game &curGame = server.GetGame();
|
||||||
curGame.initHand();
|
curGame.initHand();
|
||||||
@@ -533,6 +532,7 @@ ServerGameStateStartHand::Process(ServerGameThread &server)
|
|||||||
NetPacketHandStart::Data handStartData;
|
NetPacketHandStart::Data handStartData;
|
||||||
handStartData.yourCards[0] = static_cast<unsigned>(cards[0]);
|
handStartData.yourCards[0] = static_cast<unsigned>(cards[0]);
|
||||||
handStartData.yourCards[1] = static_cast<unsigned>(cards[1]);
|
handStartData.yourCards[1] = static_cast<unsigned>(cards[1]);
|
||||||
|
handStartData.smallBlind = curGame.getCurrentHand()->getSmallBlind();
|
||||||
static_cast<NetPacketHandStart *>(notifyCards.get())->SetData(handStartData);
|
static_cast<NetPacketHandStart *>(notifyCards.get())->SetData(handStartData);
|
||||||
|
|
||||||
server.GetSender().Send(tmpPlayer->getNetSessionData()->GetSocket(), notifyCards);
|
server.GetSender().Send(tmpPlayer->getNetSessionData()->GetSocket(), notifyCards);
|
||||||
@@ -690,6 +690,7 @@ ServerGameStateStartRound::Process(ServerGameThread &server)
|
|||||||
NetPacketPlayersTurn::Data playersTurnData;
|
NetPacketPlayersTurn::Data playersTurnData;
|
||||||
playersTurnData.gameState = (GameState)curGame.getCurrentHand()->getActualRound();
|
playersTurnData.gameState = (GameState)curGame.getCurrentHand()->getActualRound();
|
||||||
playersTurnData.playerId = curPlayer->getMyUniqueID();
|
playersTurnData.playerId = curPlayer->getMyUniqueID();
|
||||||
|
playersTurnData.minimumRaise = curGame.getCurrentHand()->getCurrentBeRo()->getMinimumRaise();
|
||||||
static_cast<NetPacketPlayersTurn *>(notification.get())->SetData(playersTurnData);
|
static_cast<NetPacketPlayersTurn *>(notification.get())->SetData(playersTurnData);
|
||||||
|
|
||||||
server.SendToAllPlayers(notification, SessionData::Game);
|
server.SendToAllPlayers(notification, SessionData::Game);
|
||||||
|
|||||||
@@ -310,6 +310,21 @@ SessionManager::CountReadySessions() const
|
|||||||
return counter;
|
return counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SessionManager::ResetAllReadyFlags()
|
||||||
|
{
|
||||||
|
boost::mutex::scoped_lock lock(m_sessionMapMutex);
|
||||||
|
|
||||||
|
SessionMap::iterator i = m_sessionMap.begin();
|
||||||
|
SessionMap::iterator end = m_sessionMap.end();
|
||||||
|
|
||||||
|
while (i != end)
|
||||||
|
{
|
||||||
|
(*i).second.sessionData->ResetReadyFlag();
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SessionManager::Clear()
|
SessionManager::Clear()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -737,6 +737,7 @@ public:
|
|||||||
struct Data
|
struct Data
|
||||||
{
|
{
|
||||||
u_int16_t yourCards[2];
|
u_int16_t yourCards[2];
|
||||||
|
u_int32_t smallBlind;
|
||||||
};
|
};
|
||||||
|
|
||||||
NetPacketHandStart();
|
NetPacketHandStart();
|
||||||
@@ -761,6 +762,7 @@ public:
|
|||||||
{
|
{
|
||||||
GameState gameState;
|
GameState gameState;
|
||||||
u_int32_t playerId;
|
u_int32_t playerId;
|
||||||
|
u_int32_t minimumRaise;
|
||||||
};
|
};
|
||||||
|
|
||||||
NetPacketPlayersTurn();
|
NetPacketPlayersTurn();
|
||||||
|
|||||||
@@ -64,7 +64,9 @@ public:
|
|||||||
bool IsPlayerConnected(unsigned uniqueId) const;
|
bool IsPlayerConnected(unsigned uniqueId) const;
|
||||||
|
|
||||||
void ForEach(boost::function<void (SessionWrapper)> func);
|
void ForEach(boost::function<void (SessionWrapper)> func);
|
||||||
|
|
||||||
unsigned CountReadySessions() const;
|
unsigned CountReadySessions() const;
|
||||||
|
void ResetAllReadyFlags();
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
unsigned GetRawSessionCount();
|
unsigned GetRawSessionCount();
|
||||||
|
|||||||
Reference in New Issue
Block a user