Fixed pot distribution in network games. Resetting computer player list after each game.

This commit is contained in:
lotodore
2007-08-11 21:21:41 +00:00
parent fd13bb56a1
commit 42cf7cb735
3 changed files with 9 additions and 4 deletions
+2 -4
View File
@@ -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
+6
View File
@@ -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
{ {
+1
View File
@@ -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;