Fixed pot distribution in network games. Resetting computer player list after each game.
This commit is contained in:
@@ -335,6 +335,7 @@ ServerRecvStateInit::InternalProcess(ServerRecvThread &server, SessionWrapper se
|
|||||||
}
|
}
|
||||||
else if (packet->ToNetPacketStartEvent())
|
else if (packet->ToNetPacketStartEvent())
|
||||||
{
|
{
|
||||||
|
server.ResetComputerPlayerList();
|
||||||
int remainingSlots = server.GetGameData().maxNumberOfPlayers - server.GetCurNumberOfPlayers();
|
int remainingSlots = server.GetGameData().maxNumberOfPlayers - server.GetCurNumberOfPlayers();
|
||||||
for (int i = 1; i <= remainingSlots; i++)
|
for (int i = 1; i <= remainingSlots; i++)
|
||||||
{
|
{
|
||||||
@@ -581,7 +582,7 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
|||||||
int newRound = curGame.getCurrentHand()->getActualRound();
|
int newRound = curGame.getCurrentHand()->getActualRound();
|
||||||
|
|
||||||
// If round changes, deal cards if needed.
|
// If round changes, deal cards if needed.
|
||||||
if (newRound != curRound)
|
if (newRound != curRound && newRound != GAME_STATE_POST_RIVER)
|
||||||
{
|
{
|
||||||
assert(newRound > curRound);
|
assert(newRound > curRound);
|
||||||
// Retrieve active players. If only one player is left, no cards are shown.
|
// Retrieve active players. If only one player is left, no cards are shown.
|
||||||
@@ -651,9 +652,6 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server)
|
|||||||
}
|
}
|
||||||
else // hand is over
|
else // hand is over
|
||||||
{
|
{
|
||||||
// Let the engine find out the winner(s).
|
|
||||||
curGame.getCurrentHand()->getCurrentBeRo()->run();
|
|
||||||
|
|
||||||
// Retrieve active players. If only one player is left, no cards are shown.
|
// Retrieve active players. If only one player is left, no cards are shown.
|
||||||
std::list<boost::shared_ptr<PlayerInterface> > activePlayers = GetActivePlayers(curGame);
|
std::list<boost::shared_ptr<PlayerInterface> > activePlayers = GetActivePlayers(curGame);
|
||||||
// if (activePlayers.empty()) TODO throw exception
|
// if (activePlayers.empty()) TODO throw exception
|
||||||
|
|||||||
@@ -485,6 +485,12 @@ ServerRecvThread::AddComputerPlayer(boost::shared_ptr<PlayerData> player)
|
|||||||
m_computerPlayers.push_back(player);
|
m_computerPlayers.push_back(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ServerRecvThread::ResetComputerPlayerList()
|
||||||
|
{
|
||||||
|
m_computerPlayers.clear();
|
||||||
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
ServerRecvThread::GetCurNumberOfPlayers() const
|
ServerRecvThread::GetCurNumberOfPlayers() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ protected:
|
|||||||
void RemoveDisconnectedPlayers();
|
void RemoveDisconnectedPlayers();
|
||||||
|
|
||||||
void AddComputerPlayer(boost::shared_ptr<PlayerData> player);
|
void AddComputerPlayer(boost::shared_ptr<PlayerData> player);
|
||||||
|
void ResetComputerPlayerList();
|
||||||
|
|
||||||
size_t GetCurNumberOfPlayers() const;
|
size_t GetCurNumberOfPlayers() const;
|
||||||
bool IsPlayerConnected(const std::string &playerName) const;
|
bool IsPlayerConnected(const std::string &playerName) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user