Send list of cards which need to be shown instead of all cards of non-fold players.

This commit is contained in:
lotodore
2010-07-23 15:55:52 +00:00
parent 15b513fb85
commit cc897745c4
5 changed files with 22 additions and 17 deletions
@@ -73,8 +73,8 @@ void LocalBeRoPostRiver::postRiverRun() {
// } // }
// } // }
// Spieler ermitteln, welche die Karten auf jeden Fall umdrehen müssen // Spieler ermitteln, welche die Karten auf jeden Fall umdrehen müssen
getMyHand()->getBoard()->determinePlayerNeedToShowCards(); getMyHand()->getBoard()->determinePlayerNeedToShowCards();
// Pot-Verteilung // Pot-Verteilung
getMyHand()->getBoard()->distributePot(); getMyHand()->getBoard()->distributePot();
+1 -3
View File
@@ -142,9 +142,7 @@ std::list<unsigned>
ClientBoard::getPlayerNeedToShowCards() const ClientBoard::getPlayerNeedToShowCards() const
{ {
boost::recursive_mutex::scoped_lock lock(m_syncMutex); boost::recursive_mutex::scoped_lock lock(m_syncMutex);
// TODO returns winners for now. return playerNeedToShowCards;
//return playerNeedToShowCards;
return winners;
} }
void void
+3
View File
@@ -2007,6 +2007,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
// End of Hand, show cards. // End of Hand, show cards.
list<unsigned> winnerList; list<unsigned> winnerList;
list<unsigned> showList;
int highestValueOfCards = 0; int highestValueOfCards = 0;
PlayerResult_t **playerResults = showCards->playerResults.list.array; PlayerResult_t **playerResults = showCards->playerResults.list.array;
unsigned numResults = showCards->playerResults.list.count; unsigned numResults = showCards->playerResults.list.count;
@@ -2034,11 +2035,13 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> client,
tmpPlayer->setLastMoneyWon(r->moneyWon); tmpPlayer->setLastMoneyWon(r->moneyWon);
if (r->moneyWon) if (r->moneyWon)
winnerList.push_back(r->playerId); winnerList.push_back(r->playerId);
showList.push_back(r->playerId);
} }
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); curGame->getCurrentHand()->getBoard()->setWinners(winnerList);
curGame->getCurrentHand()->getBoard()->setPlayerNeedToShowCards(showList);
client->GetGui().postRiverRunAnimation1(); client->GetGui().postRiverRunAnimation1();
+11 -7
View File
@@ -883,8 +883,8 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
} }
else else
{ {
// End of Hand - show cards of active players. // End of Hand - show cards.
boost::shared_ptr<PlayerInterface> player = nonFoldPlayers.front(); const PlayerIdList showList(curGame.getCurrentHand()->getBoard()->getPlayerNeedToShowCards());
boost::shared_ptr<NetPacket> endHand(new NetPacket(NetPacket::Alloc)); boost::shared_ptr<NetPacket> endHand(new NetPacket(NetPacket::Alloc));
endHand->GetMsg()->present = PokerTHMessage_PR_endOfHandMessage; endHand->GetMsg()->present = PokerTHMessage_PR_endOfHandMessage;
EndOfHandMessage_t *netEndHand = &endHand->GetMsg()->choice.endOfHandMessage; EndOfHandMessage_t *netEndHand = &endHand->GetMsg()->choice.endOfHandMessage;
@@ -893,15 +893,19 @@ ServerGameStateHand::EngineLoop(boost::shared_ptr<ServerGame> server)
netEndHand->endOfHandType.present = endOfHandType_PR_endOfHandShowCards; netEndHand->endOfHandType.present = endOfHandType_PR_endOfHandShowCards;
EndOfHandShowCards_t *endHandShow = &netEndHand->endOfHandType.choice.endOfHandShowCards; EndOfHandShowCards_t *endHandShow = &netEndHand->endOfHandType.choice.endOfHandShowCards;
PlayerListConstIterator i = nonFoldPlayers.begin(); PlayerIdList::const_iterator i = showList.begin();
PlayerListConstIterator end = nonFoldPlayers.end(); PlayerIdList::const_iterator end = showList.end();
while (i != end) while (i != end)
{ {
PlayerResult_t *playerResult = (PlayerResult_t *)calloc(1, sizeof(PlayerResult_t)); boost::shared_ptr<PlayerInterface> tmpPlayer(curGame.getPlayerByUniqueId(*i));
SetPlayerResult(*playerResult, (*i)); if (tmpPlayer)
{
PlayerResult_t *playerResult = (PlayerResult_t *)calloc(1, sizeof(PlayerResult_t));
SetPlayerResult(*playerResult, tmpPlayer);
ASN_SEQUENCE_ADD(&endHandShow->playerResults.list, playerResult); ASN_SEQUENCE_ADD(&endHandShow->playerResults.list, playerResult);
}
++i; ++i;
} }
server->SendToAllPlayers(endHand, SessionData::Game); server->SendToAllPlayers(endHand, SessionData::Game);
+4 -4
View File
@@ -85,11 +85,11 @@ int main( int argc, char **argv )
curl_global_init(CURL_GLOBAL_NOTHING); curl_global_init(CURL_GLOBAL_NOTHING);
/////// can be removed for non-qt-guis //////////// /////// can be removed for non-qt-guis ////////////
QtSingleApplication a( argc, argv ); QApplication a( argc, argv );
if (a.sendMessage("Wake up!")) { /*if (a.sendMessage("Wake up!")) {
return 0; return 0;
} }*/
#ifdef __APPLE__ #ifdef __APPLE__
// The following needs to be done directly after the application is created. // The following needs to be done directly after the application is created.
@@ -147,7 +147,7 @@ int main( int argc, char **argv )
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
startWindowImpl mainWin(myConfig); startWindowImpl mainWin(myConfig);
a.setActivationWindow(&mainWin, true); //a.setActivationWindow(&mainWin, true);
int retVal = a.exec(); int retVal = a.exec();