From 2437407ffc03c8dfa5fffe5e802c5aa5b61db208 Mon Sep 17 00:00:00 2001 From: floty Date: Sun, 13 Nov 2011 01:05:28 +0000 Subject: [PATCH] optimizing local sqlite-logging; implementing second steps network client sqlite-logging --- src/engine/game.cpp | 2 +- .../local_engine/localberopostriver.cpp | 50 +----- src/engine/local_engine/localplayer.cpp | 21 +-- src/engine/local_engine/localplayer.h | 9 + src/engine/log.cpp | 156 +++++++++++++----- src/engine/log.h | 5 +- src/engine/network_engine/clientplayer.cpp | 16 +- src/engine/network_engine/clientplayer.h | 4 + src/engine/playerinterface.h | 3 + src/gui/qt/gametable/gametableimpl.cpp | 2 +- src/gui/qt/gametable/log/guilog.cpp | 2 +- src/net/common/clientstate.cpp | 22 ++- 12 files changed, 181 insertions(+), 111 deletions(-) diff --git a/src/engine/game.cpp b/src/engine/game.cpp index 3de5bbf3..61579434 100755 --- a/src/engine/game.cpp +++ b/src/engine/game.cpp @@ -111,7 +111,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr factory, currentBoard->setPlayerLists(seatsList, activePlayerList, runningPlayerList); // log game data - myLog->logNewGameMsg(myGameID, startCash, startSmallBlind, dealerPosition, seatsList); + myLog->logNewGameMsg(myGameID, startCash, startSmallBlind, getPlayerByUniqueId(dealerPosition)->getMyID()+1, seatsList); //start timer blindsTimer.reset(); diff --git a/src/engine/local_engine/localberopostriver.cpp b/src/engine/local_engine/localberopostriver.cpp index 42cdcff0..e118f05b 100644 --- a/src/engine/local_engine/localberopostriver.cpp +++ b/src/engine/local_engine/localberopostriver.cpp @@ -83,7 +83,7 @@ void LocalBeRoPostRiver::postRiverRun() //Pot auf 0 setzen getMyHand()->getBoard()->setPot(0); - // logging hole Cards / Hands + // logging int nonfoldPlayersCounter = 0; for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) { if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonfoldPlayersCounter++; @@ -91,53 +91,11 @@ void LocalBeRoPostRiver::postRiverRun() if(nonfoldPlayersCounter>1) { getMyHand()->getLog()->logHoleCardsHandName(GAME_STATE_POST_RIVER,getMyHand()->getActivePlayerList()); } - - // logging winner of the hand - for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) { - if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() == highestCardsValue) { - getMyHand()->getLog()->logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN,(*it_c)->getLastMoneyWon()); - } - } - - // log side pot winners - list winners = getMyHand()->getBoard()->getWinners(); - list::iterator it_int; - for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) { - if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() != highestCardsValue ) { - - for(it_int = winners.begin(); it_int != winners.end(); ++it_int) { - if((*it_int) == (*it_c)->getMyUniqueID()) { - getMyHand()->getLog()->logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN_SIDE_POT,(*it_c)->getLastMoneyWon()); - } - } - } - } - - // log player sits out - for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) { - if((*it_c)->getMyCash() == 0) { - getMyHand()->getLog()->logPlayerAction(GAME_STATE_POST_RIVER, (*it_c)->getMyID()+1, LOG_ACTION_SIT_OUT); - } - } - - // for log after every hand + getMyHand()->getLog()->logHandWinner(getMyHand()->getActivePlayerList(), highestCardsValue, getMyHand()->getBoard()->getWinners()); + getMyHand()->getLog()->logPlayerSitsOut(getMyHand()->getActivePlayerList()); + getMyHand()->getLog()->logGameWinner(getMyHand()->getActivePlayerList()); getMyHand()->getLog()->logAfterHand(); - // log winner of the game if only one player is left - int playersPositiveCashCounter = 0; - for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) { - if ((*it_c)->getMyCash() > 0) playersPositiveCashCounter++; - } - if (playersPositiveCashCounter==1) { - for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) { - if ((*it_c)->getMyCash() > 0) { - getMyHand()->getLog()->logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN_GAME); - } - } - // for log after every game - getMyHand()->getLog()->logAfterGame(); - } - //starte die Animaionsreihe getMyHand()->getGuiInterface()->postRiverRunAnimation1(); } diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index cffd1361..43a6a160 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -847,7 +847,7 @@ static const RoundData FlopValues[] = { LocalPlayer::LocalPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) : PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), - myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(PLAYER_ACTION_NONE), + myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), logHoleCardsDone(false), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(PLAYER_ACTION_NONE), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(1), myTurn(0), myCardsFlip(0), myRoundStartCash(0), lastMoneyWon(0), sBluff(0), sBluffStatus(false), m_actionTimeoutCounter(0), m_isConnected(false) { @@ -3211,10 +3211,8 @@ void LocalPlayer::riverEngine() void LocalPlayer::evaluation(int bet, int raise) { - int highestSet = currentHand->getCurrentBeRo()->getHighestSet(); - // cout << "myAction(evaluation): " << myAction << endl; switch(myAction) { // none case 0: @@ -3222,30 +3220,24 @@ void LocalPlayer::evaluation(int bet, int raise) break; // fold case 1: { -// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_FOLD); } break; // check case 2: { -// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_CHECK); } break; // call case 3: { - // cout << "evaluation(call) - highestSet = " << highestSet << endl; // all in if(highestSet >= myCash + mySet) { mySet += myCash; myCash = 0; myAction = PLAYER_ACTION_ALLIN; -// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet); - // cout << "evaluation(call) - mySet: " << mySet << endl; } // sonst else { myCash = myCash - highestSet + mySet; mySet = highestSet; -// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_CALL,mySet); } } break; @@ -3262,7 +3254,6 @@ void LocalPlayer::evaluation(int bet, int raise) myCash = 0; myAction = PLAYER_ACTION_ALLIN; highestSet = mySet; -// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet); } // sonst else { @@ -3270,7 +3261,6 @@ void LocalPlayer::evaluation(int bet, int raise) myCash = myCash - bet; mySet = bet; highestSet = mySet; -// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_BET,mySet); } // lastPlayerAction für Karten umblättern reihenfolge setzrn @@ -3285,14 +3275,12 @@ void LocalPlayer::evaluation(int bet, int raise) mySet += myCash; myCash = 0; myAction = PLAYER_ACTION_ALLIN; -// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet); } // sonst else { myCash = myCash - highestSet + mySet; mySet = highestSet; myAction = PLAYER_ACTION_CALL; -// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_CALL,mySet); } } else { if(raise < currentHand->getCurrentBeRo()->getMinimumRaise()) { @@ -3329,7 +3317,6 @@ void LocalPlayer::evaluation(int bet, int raise) myAction = PLAYER_ACTION_ALLIN; highestSet = mySet; } -// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet); } // sonst else { @@ -3339,26 +3326,20 @@ void LocalPlayer::evaluation(int bet, int raise) highestSet = mySet; // lastPlayerAction für Karten umblättern reihenfolge setzrn currentHand->setLastActionPlayerID(myUniqueID); -// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_BET,mySet); } } } break; // all in case 6: { -// currentHand->getLog()->logPlayerAction(currentHand->getCurrentRound(),myID+1,LOG_ACTION_ALL_IN,mySet); } break; default: {} } - // cout << "highestSet(ende evaluation): " << highestSet << endl; - currentHand->getCurrentBeRo()->setHighestSet(highestSet); -// cout << "lAP: " << currentHand->getLastActionPlayer() << endl; - } diff --git a/src/engine/local_engine/localplayer.h b/src/engine/local_engine/localplayer.h index d0d95443..4166ea7c 100755 --- a/src/engine/local_engine/localplayer.h +++ b/src/engine/local_engine/localplayer.h @@ -189,6 +189,14 @@ public: return myCardsValueInt; } + void setLogHoleCardsDone(bool theValue) { + logHoleCardsDone = theValue; + } + + bool getLogHoleCardsDone() const { + return logHoleCardsDone; + } + void setMyBestHandPosition(int* theValue) { for (int i = 0; i < 5; i++) myBestHandPosition[i] = theValue[i]; @@ -302,6 +310,7 @@ private: int myBestHandPosition[5]; double myOdds; int myNiveau[3]; + bool logHoleCardsDone; int myCards[2]; int myCash; diff --git a/src/engine/log.cpp b/src/engine/log.cpp index 092fc518..4f2a72a6 100644 --- a/src/engine/log.cpp +++ b/src/engine/log.cpp @@ -28,7 +28,7 @@ using namespace std; -Log::Log(ConfigFile *c) : mySqliteLogDb(0), myConfig(c), curGameID(0), curHandID(0), sql(""), logHoleCardsDone(false) +Log::Log(ConfigFile *c) : mySqliteLogDb(0), myConfig(c), curGameID(0), curHandID(0), sql("") { if(SQLITE_LOG) { @@ -187,15 +187,16 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned { curHandID = handID; - logHoleCardsDone = false; + PlayerListConstIterator it_c; + for(it_c = seatsList->begin(); it_c!=seatsList->end(); it_c++) { + (*it_c)->setLogHoleCardsDone(false); + } if(SQLITE_LOG) { if(myConfig->readConfigInt("LogOnOff")) { //if write logfiles is enabled - PlayerListConstIterator it_c; - if( mySqliteLogDb != 0 ) { // sqlite-db is open int i; @@ -249,17 +250,20 @@ Log::logNewHandMsg(int handID, unsigned dealerPosition, int smallBlind, unsigned logPlayerAction(GAME_STATE_PREFLOP,dealerPosition,LOG_ACTION_DEALER); } } - // !! TODO !! Hack // log blinds for(it_c = seatsList->begin(); it_c!=seatsList->end(); it_c++) { if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND) { logPlayerAction(GAME_STATE_PREFLOP,smallBlindPosition,LOG_ACTION_SMALL_BLIND,(*it_c)->getMySet()); } + } + for(it_c = seatsList->begin(); it_c!=seatsList->end(); it_c++) { if((*it_c)->getMyButton() == BUTTON_BIG_BLIND) { logPlayerAction(GAME_STATE_PREFLOP,bigBlindPosition,LOG_ACTION_BIG_BLIND,(*it_c)->getMySet()); } } + // !! TODO !! Hack + } } } @@ -432,54 +436,128 @@ Log::logBoardCards(GameState bero, int boardCards[5]) void Log::logHoleCardsHandName(GameState bero, PlayerList activePlayerList) { + PlayerListConstIterator it_c; + + for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) { + + if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && ( ((*it_c)->checkIfINeedToShowCards() && bero==GAME_STATE_POST_RIVER ) || ( bero!=GAME_STATE_POST_RIVER && !(*it_c)->getLogHoleCardsDone()) ) ) { + + logHoleCardsHandName(bero, activePlayerList, *it_c); + + } + } +} + +void +Log::logHoleCardsHandName(GameState bero, PlayerList activePlayerList, boost::shared_ptr player, bool forceExecLog) +{ + if(SQLITE_LOG) { if(myConfig->readConfigInt("LogOnOff")) { //if write logfiles is enabled - if( mySqliteLogDb != 0 && (bero==GAME_STATE_POST_RIVER || !logHoleCardsDone)) { - // sqlite-db is open and we are in postriver or before postriver doesn't log hole cards til now + if( mySqliteLogDb != 0) { - PlayerListConstIterator it_c; int myCards[2]; - - for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) { - if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) { - (*it_c)->getMyCards(myCards); - sql += "UPDATE Hand SET "; - if(bero==GAME_STATE_POST_RIVER) { - sql += "Seat_" + boost::lexical_cast((*it_c)->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName((*it_c)->getMyCardsValueInt(),activePlayerList) + "\""; - sql += ",Seat_" + boost::lexical_cast((*it_c)->getMyID()+1) + "_Hand_int=" + boost::lexical_cast((*it_c)->getMyCardsValueInt()); - } - if(bero==GAME_STATE_POST_RIVER && !logHoleCardsDone) { - sql+= ","; - } - if(!logHoleCardsDone) { - sql += "Seat_" + boost::lexical_cast((*it_c)->getMyID()+1) + "_Card_1=" + boost::lexical_cast(myCards[0]); - sql += ",Seat_" + boost::lexical_cast((*it_c)->getMyID()+1) + "_Card_2=" + boost::lexical_cast(myCards[1]); - } - sql += " WHERE "; - sql += "GameID=" + boost::lexical_cast(curGameID) + " AND "; - sql += "HandID=" + boost::lexical_cast(curHandID); - sql += ";"; - if(myConfig->readConfigInt("LogInterval") == 0) { - exec_transaction(); - } - - if(!logHoleCardsDone) { - logPlayerAction(bero,(*it_c)->getMyID()+1,LOG_ACTION_SHOW); - } else { - logPlayerAction(bero,(*it_c)->getMyID()+1,LOG_ACTION_HAS); - } - } + player->getMyCards(myCards); + sql += "UPDATE Hand SET "; + if(bero==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0) { + sql += "Seat_" + boost::lexical_cast(player->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName(player->getMyCardsValueInt(),activePlayerList) + "\""; + sql += ",Seat_" + boost::lexical_cast(player->getMyID()+1) + "_Hand_int=" + boost::lexical_cast(player->getMyCardsValueInt()); + } + if(bero==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0 && !player->getLogHoleCardsDone()) { + sql+= ","; + } + if(!player->getLogHoleCardsDone()) { + sql += "Seat_" + boost::lexical_cast(player->getMyID()+1) + "_Card_1=" + boost::lexical_cast(myCards[0]); + sql += ",Seat_" + boost::lexical_cast(player->getMyID()+1) + "_Card_2=" + boost::lexical_cast(myCards[1]); + } + sql += " WHERE "; + sql += "GameID=" + boost::lexical_cast(curGameID) + " AND "; + sql += "HandID=" + boost::lexical_cast(curHandID); + sql += ";"; + if(myConfig->readConfigInt("LogInterval") == 0 || forceExecLog) { + exec_transaction(); } - logHoleCardsDone = true; + if(!player->getLogHoleCardsDone()) { + logPlayerAction(bero,player->getMyID()+1,LOG_ACTION_SHOW); + } else { + logPlayerAction(bero,player->getMyID()+1,LOG_ACTION_HAS); + } + + player->setLogHoleCardsDone(true); + } } } } +void +Log::logHandWinner(PlayerList activePlayerList, int highestCardsValue, std::list winners) +{ + + + PlayerListConstIterator it_c; + list::iterator it_int; + + // log winner + for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) { + if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() == highestCardsValue) { + logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN,(*it_c)->getLastMoneyWon()); + } + } + + // log side pot winner + for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) { + if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() != highestCardsValue ) { + + for(it_int = winners.begin(); it_int != winners.end(); ++it_int) { + if((*it_int) == (*it_c)->getMyUniqueID()) { + logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN_SIDE_POT,(*it_c)->getLastMoneyWon()); + } + } + } + } + +} + +void +Log::logGameWinner(PlayerList activePlayerList) +{ + + int playersPositiveCashCounter = 0; + PlayerListConstIterator it_c; + for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) { + if ((*it_c)->getMyCash() > 0) playersPositiveCashCounter++; + } + if (playersPositiveCashCounter==1) { + for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) { + if ((*it_c)->getMyCash() > 0) { + logPlayerAction(GAME_STATE_POST_RIVER,(*it_c)->getMyID()+1,LOG_ACTION_WIN_GAME); + } + } + // for log after every game + logAfterGame(); + } +} + +void +Log::logPlayerSitsOut(PlayerList activePlayerList) +{ + + PlayerListConstIterator it_c; + + for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); ++it_c) { + + if((*it_c)->getMyCash() == 0) { + logPlayerAction(GAME_STATE_POST_RIVER, (*it_c)->getMyID()+1, LOG_ACTION_SIT_OUT); + } + } + +} + void Log::logAfterHand() { diff --git a/src/engine/log.h b/src/engine/log.h index d2c1280e..08dbb030 100644 --- a/src/engine/log.h +++ b/src/engine/log.h @@ -40,6 +40,10 @@ public: PlayerActionLog transformPlayerActionLog(PlayerAction action); void logBoardCards(GameState bero, int boardCards[5]); void logHoleCardsHandName(GameState bero, PlayerList activePlayerList); + void logHoleCardsHandName(GameState bero, PlayerList activePlayerList, boost::shared_ptr player, bool forceExecLog = 0); + void logHandWinner(PlayerList activePlayerList, int highestCardsValue, std::list winners); + void logGameWinner(PlayerList activePlayerList); + void logPlayerSitsOut(PlayerList activePlayerList); void logAfterHand(); void logAfterGame(); void exec_transaction(); @@ -52,7 +56,6 @@ private: int curGameID; int curHandID; std::string sql; - bool logHoleCardsDone; }; #endif // LOG_H diff --git a/src/engine/network_engine/clientplayer.cpp b/src/engine/network_engine/clientplayer.cpp index bf3734ce..faf88ad5 100644 --- a/src/engine/network_engine/clientplayer.cpp +++ b/src/engine/network_engine/clientplayer.cpp @@ -24,7 +24,7 @@ using namespace std; ClientPlayer::ClientPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) : PlayerInterface(), myConfig(c), currentHand(0), myID(id), myUniqueID(uniqueId), myType(type), - myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), + myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), logHoleCardsDone(false), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(PLAYER_ACTION_NONE), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(true), myTurn(false), myCardsFlip(false), myRoundStartCash(0), lastMoneyWon(0), sBluff(0), sBluffStatus(false), m_isConnected(false) { @@ -324,6 +324,20 @@ ClientPlayer::getMyCardsValueInt() const return myCardsValueInt; } +void +ClientPlayer::setLogHoleCardsDone(bool theValue) +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + logHoleCardsDone = theValue; +} + +bool +ClientPlayer::getLogHoleCardsDone() const +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + return logHoleCardsDone; +} + void ClientPlayer::setMyBestHandPosition(int* theValue) { diff --git a/src/engine/network_engine/clientplayer.h b/src/engine/network_engine/clientplayer.h index 9a585343..d7f8938c 100644 --- a/src/engine/network_engine/clientplayer.h +++ b/src/engine/network_engine/clientplayer.h @@ -88,6 +88,9 @@ public: void setMyCardsValueInt(int theValue); int getMyCardsValueInt() const; + void setLogHoleCardsDone(bool theValue); + bool getLogHoleCardsDone() const; + void setMyBestHandPosition(int* theValue); void getMyBestHandPosition(int* theValue) const; @@ -157,6 +160,7 @@ private: int myBestHandPosition[5]; double myOdds; int myNiveau[3]; + bool logHoleCardsDone; int myCards[2]; int myCash; diff --git a/src/engine/playerinterface.h b/src/engine/playerinterface.h index 986d8397..ec22acaf 100644 --- a/src/engine/playerinterface.h +++ b/src/engine/playerinterface.h @@ -86,6 +86,9 @@ public: virtual void setMyCardsValueInt(int theValue) =0; virtual int getMyCardsValueInt() const =0; + virtual void setLogHoleCardsDone(bool theValue) =0; + virtual bool getLogHoleCardsDone() const =0; + virtual void setMyBestHandPosition(int* theValue) =0; virtual void getMyBestHandPosition(int* theValue) const =0; diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index 642cf56d..5a3e28d6 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -2501,7 +2501,7 @@ void gameTableImpl::postRiverRunAnimation3() } } - textBrowser_Log->append(""); +// textBrowser_Log->append(""); postRiverRunAnimation3Timer->start(postRiverRunAnimationSpeed/2); } diff --git a/src/gui/qt/gametable/log/guilog.cpp b/src/gui/qt/gametable/log/guilog.cpp index 49455073..7ab720ff 100644 --- a/src/gui/qt/gametable/log/guilog.cpp +++ b/src/gui/qt/gametable/log/guilog.cpp @@ -363,7 +363,7 @@ void guiLog::logFlipHoleCardsMsg(QString playerName, int card1, int card2, int c tempHandName = CardsValue::determineHandName(cardsValueInt,myW->getSession()->getCurrentGame()->getActivePlayerList()).c_str(); - myW->textBrowser_Log->append("getChatLogTextColor()+";\">"+playerName+" "+showHas+" \""+tempHandName+"\""); + myW->textBrowser_Log->append("getChatLogTextColor()+";\">"+playerName+" "+showHas+" ["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"] - \""+tempHandName+"\""); } else { diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index f0f75912..baefc18d 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -1682,6 +1682,7 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr client tmpPlayer->setLastMoneyWon(r->moneyWon); client->GetCallback().SignalNetClientPostRiverShowCards(r->playerId); + client->GetClientLog()->logHoleCardsHandName(GAME_STATE_POST_RIVER, client->GetGame()->getActivePlayerList(), tmpPlayer, true); } else if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_playerIdChangedMessage) { boost::shared_ptr curGame = client->GetGame(); if (curGame) { @@ -1782,7 +1783,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr client, client->GetGui().flushLogAtHand(); client->GetClientLog()->logNewHandMsg( curGame->getCurrentHandID(), - curGame->getDealerPosition(), + curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getDealerPosition())->getMyID()+1, curGame->getCurrentHand()->getSmallBlind(), curGame->getPlayerByUniqueId(curGame->getCurrentHand()->getCurrentBeRo()->getSmallBlindPositionId())->getMyID()+1, curGame->getCurrentHand()->getSmallBlind()*2, @@ -1911,6 +1912,12 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr client, tmpPlayer->setMyCards(tmpCards); } client->GetGui().flipHolecardsAllIn(); + if(curGame->getCurrentHand()->getCurrentRound()GetClientLog()->logHoleCardsHandName( + curGame->getCurrentHand()->getCurrentRound(), + curGame->getActivePlayerList() + ); + } } else if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_endOfHandMessage) { EndOfHandMessage_t *netEndHand = &tmpPacket->GetMsg()->choice.endOfHandMessage; @@ -1937,6 +1944,9 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr client, curGame->getCurrentHand()->getBoard()->setPot(0); curGame->getCurrentHand()->getBoard()->setWinners(winnerList); + // logging + client->GetClientLog()->logHandWinner(curGame->getActivePlayerList(), tmpPlayer->getMyCardsValueInt(), winnerList); + client->GetGui().postRiverRunAnimation1(); // Wait for next Hand. @@ -1991,12 +2001,22 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr client, curGame->getCurrentHand()->getBoard()->setWinners(winnerList); curGame->getCurrentHand()->getBoard()->setPlayerNeedToShowCards(showList); + // logging + client->GetClientLog()->logHoleCardsHandName(GAME_STATE_POST_RIVER,curGame->getActivePlayerList()); + client->GetClientLog()->logHandWinner(curGame->getActivePlayerList(), highestValueOfCards, winnerList); + client->GetGui().postRiverRunAnimation1(); // Wait for next Hand. client->GetCallback().SignalNetClientGameInfo(MSG_NET_GAME_CLIENT_HAND_END); client->SetState(ClientStateWaitHand::Instance()); } + + // logging + client->GetClientLog()->logPlayerSitsOut(curGame->getActivePlayerList()); + client->GetClientLog()->logGameWinner(curGame->getActivePlayerList()); + client->GetClientLog()->logAfterHand(); + } // Synchronize with GUI. client->GetGui().waitForGuiUpdateDone();