optimizing local sqlite-logging; implementing second steps network client sqlite-logging
This commit is contained in:
+1
-1
@@ -111,7 +111,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> 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();
|
||||
|
||||
@@ -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<unsigned> winners = getMyHand()->getBoard()->getWinners();
|
||||
list<unsigned>::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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
+117
-39
@@ -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<PlayerInterface> 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<string>((*it_c)->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName((*it_c)->getMyCardsValueInt(),activePlayerList) + "\"";
|
||||
sql += ",Seat_" + boost::lexical_cast<string>((*it_c)->getMyID()+1) + "_Hand_int=" + boost::lexical_cast<string>((*it_c)->getMyCardsValueInt());
|
||||
}
|
||||
if(bero==GAME_STATE_POST_RIVER && !logHoleCardsDone) {
|
||||
sql+= ",";
|
||||
}
|
||||
if(!logHoleCardsDone) {
|
||||
sql += "Seat_" + boost::lexical_cast<string>((*it_c)->getMyID()+1) + "_Card_1=" + boost::lexical_cast<string>(myCards[0]);
|
||||
sql += ",Seat_" + boost::lexical_cast<string>((*it_c)->getMyID()+1) + "_Card_2=" + boost::lexical_cast<string>(myCards[1]);
|
||||
}
|
||||
sql += " WHERE ";
|
||||
sql += "GameID=" + boost::lexical_cast<string>(curGameID) + " AND ";
|
||||
sql += "HandID=" + boost::lexical_cast<string>(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<string>(player->getMyID()+1) + "_Hand_text=\"" + CardsValue::determineHandName(player->getMyCardsValueInt(),activePlayerList) + "\"";
|
||||
sql += ",Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Hand_int=" + boost::lexical_cast<string>(player->getMyCardsValueInt());
|
||||
}
|
||||
if(bero==GAME_STATE_POST_RIVER && player->getMyCardsValueInt()>0 && !player->getLogHoleCardsDone()) {
|
||||
sql+= ",";
|
||||
}
|
||||
if(!player->getLogHoleCardsDone()) {
|
||||
sql += "Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Card_1=" + boost::lexical_cast<string>(myCards[0]);
|
||||
sql += ",Seat_" + boost::lexical_cast<string>(player->getMyID()+1) + "_Card_2=" + boost::lexical_cast<string>(myCards[1]);
|
||||
}
|
||||
sql += " WHERE ";
|
||||
sql += "GameID=" + boost::lexical_cast<string>(curGameID) + " AND ";
|
||||
sql += "HandID=" + boost::lexical_cast<string>(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<unsigned> winners)
|
||||
{
|
||||
|
||||
|
||||
PlayerListConstIterator it_c;
|
||||
list<unsigned>::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()
|
||||
{
|
||||
|
||||
+4
-1
@@ -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<PlayerInterface> player, bool forceExecLog = 0);
|
||||
void logHandWinner(PlayerList activePlayerList, int highestCardsValue, std::list<unsigned> 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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -2501,7 +2501,7 @@ void gameTableImpl::postRiverRunAnimation3()
|
||||
}
|
||||
}
|
||||
|
||||
textBrowser_Log->append("");
|
||||
// textBrowser_Log->append("");
|
||||
|
||||
postRiverRunAnimation3Timer->start(postRiverRunAnimationSpeed/2);
|
||||
}
|
||||
|
||||
@@ -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("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+playerName+" "+showHas+" \""+tempHandName+"\"</span>");
|
||||
myW->textBrowser_Log->append("<span style=\"color:#"+myStyle->getChatLogTextColor()+";\">"+playerName+" "+showHas+" ["+translateCardCode(card1).at(0)+translateCardCode(card1).at(1)+","+translateCardCode(card2).at(0)+translateCardCode(card2).at(1)+"] - \""+tempHandName+"\"</span>");
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@@ -1682,6 +1682,7 @@ ClientStateWaitHand::InternalHandlePacket(boost::shared_ptr<ClientThread> 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<Game> curGame = client->GetGame();
|
||||
if (curGame) {
|
||||
@@ -1782,7 +1783,7 @@ ClientStateRunHand::InternalHandlePacket(boost::shared_ptr<ClientThread> 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<ClientThread> client,
|
||||
tmpPlayer->setMyCards(tmpCards);
|
||||
}
|
||||
client->GetGui().flipHolecardsAllIn();
|
||||
if(curGame->getCurrentHand()->getCurrentRound()<GAME_STATE_RIVER) {
|
||||
client->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<ClientThread> 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<ClientThread> 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();
|
||||
|
||||
Reference in New Issue
Block a user