Added winner list for network client.
This commit is contained in:
@@ -54,7 +54,7 @@ public:
|
|||||||
virtual void distributePot() =0;
|
virtual void distributePot() =0;
|
||||||
|
|
||||||
virtual std::list<int> getWinners() const =0;
|
virtual std::list<int> getWinners() const =0;
|
||||||
|
virtual void setWinners(const std::list<int> &winners) =0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ void LocalBoard::distributePot() {
|
|||||||
int highestCardsValue;
|
int highestCardsValue;
|
||||||
size_t winnerCount;
|
size_t winnerCount;
|
||||||
size_t mod;
|
size_t mod;
|
||||||
int winnerPointer;
|
// int winnerPointer;
|
||||||
bool winnerHit;
|
bool winnerHit;
|
||||||
|
|
||||||
// level loop
|
// level loop
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public:
|
|||||||
void distributePot();
|
void distributePot();
|
||||||
|
|
||||||
std::list<int> getWinners() const { return winners; }
|
std::list<int> getWinners() const { return winners; }
|
||||||
|
void setWinners(const std::list<int> &w) { winners = w; }
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -121,7 +121,14 @@ ClientBoard::distributePot()
|
|||||||
std::list<int>
|
std::list<int>
|
||||||
ClientBoard::getWinners() const
|
ClientBoard::getWinners() const
|
||||||
{
|
{
|
||||||
|
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||||
return winners;
|
return winners;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClientBoard::setWinners(const std::list<int> &w)
|
||||||
|
{
|
||||||
|
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||||
|
winners = w;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public:
|
|||||||
void distributePot();
|
void distributePot();
|
||||||
|
|
||||||
std::list<int> getWinners() const;
|
std::list<int> getWinners() const;
|
||||||
|
void setWinners(const std::list<int> &winners);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable boost::recursive_mutex m_syncMutex;
|
mutable boost::recursive_mutex m_syncMutex;
|
||||||
|
|||||||
@@ -1097,7 +1097,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
throw ClientException(__FILE__, __LINE__, ERR_NET_UNKNOWN_PLAYER_ID, 0);
|
||||||
|
|
||||||
tmpPlayer->setMyCash(endHandData.playerMoney);
|
tmpPlayer->setMyCash(endHandData.playerMoney);
|
||||||
// TODO use moneyWon
|
|
||||||
curGame->getCurrentHand()->getBoard()->setPot(0);
|
curGame->getCurrentHand()->getBoard()->setPot(0);
|
||||||
|
|
||||||
client.GetGui().postRiverRunAnimation1();
|
client.GetGui().postRiverRunAnimation1();
|
||||||
@@ -1125,6 +1125,7 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
NetPacketEndOfHandShowCards::PlayerResultList::const_iterator end
|
NetPacketEndOfHandShowCards::PlayerResultList::const_iterator end
|
||||||
= endHandData.playerResults.end();
|
= endHandData.playerResults.end();
|
||||||
|
|
||||||
|
list<int> winnerList;
|
||||||
int highestValueOfCards = 0;
|
int highestValueOfCards = 0;
|
||||||
while (i != end)
|
while (i != end)
|
||||||
{
|
{
|
||||||
@@ -1144,11 +1145,14 @@ ClientStateRunHand::InternalProcess(ClientThread &client, boost::shared_ptr<NetP
|
|||||||
if (tmpPlayer->getMyCardsValueInt() > highestValueOfCards)
|
if (tmpPlayer->getMyCardsValueInt() > highestValueOfCards)
|
||||||
highestValueOfCards = tmpPlayer->getMyCardsValueInt();
|
highestValueOfCards = tmpPlayer->getMyCardsValueInt();
|
||||||
tmpPlayer->setMyCash((*i).playerMoney);
|
tmpPlayer->setMyCash((*i).playerMoney);
|
||||||
// TODO use moneyWon
|
|
||||||
|
if ((*i).moneyWon)
|
||||||
|
winnerList.push_back((*i).playerId);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
curGame->getCurrentHand()->getCurrentBeRo()->setHighestCardsValue(highestValueOfCards);
|
curGame->getCurrentHand()->getCurrentBeRo()->setHighestCardsValue(highestValueOfCards);
|
||||||
curGame->getCurrentHand()->getBoard()->setPot(0);
|
curGame->getCurrentHand()->getBoard()->setPot(0);
|
||||||
|
curGame->getCurrentHand()->getBoard()->setWinners(winnerList);
|
||||||
|
|
||||||
client.GetGui().postRiverRunAnimation1();
|
client.GetGui().postRiverRunAnimation1();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user