From 1f0e256fe6975ae591541d6b5c591e9dc83c4363 Mon Sep 17 00:00:00 2001 From: floty Date: Sun, 23 Mar 2014 23:11:16 +0100 Subject: [PATCH] reorgranize debug_mode --- src/engine/game.cpp | 12 +- src/engine/local_engine/localhand.cpp | 14 +- src/engine/local_engine/localplayer.cpp | 12 +- src/engine/log.cpp | 220 +++++++++++++----------- src/engine/log.h | 17 +- src/game_defs.h | 1 - src/gui/qt/gametable/gametableimpl.cpp | 30 ++-- 7 files changed, 166 insertions(+), 140 deletions(-) diff --git a/src/engine/game.cpp b/src/engine/game.cpp index 615293b5..a3f21d44 100755 --- a/src/engine/game.cpp +++ b/src/engine/game.cpp @@ -56,11 +56,9 @@ Game::Game(GuiInterface* gui, boost::shared_ptr factory, dealerPosition = startData.startDealerPlayerId; - if(DEBUG_MODE) { - startSmallBlind = myLog->debugMode_getStartSmallBlind(); - currentSmallBlind = startSmallBlind; - dealerPosition = myLog->debugMode_getStartDealerPosition(); - } + // debug mode + myLog->debugMode_getStartSmallBlind(&startSmallBlind,¤tSmallBlind); + myLog->debugMode_getStartDealerPosition(&dealerPosition); int i; @@ -109,8 +107,10 @@ Game::Game(GuiInterface* gui, boost::shared_ptr factory, ++player_i; } + // debug mode + myLog->debugMode_getPlayerStartCash(&myStartCash, i); + // create player objects - if(DEBUG_MODE) myStartCash = myLog->debugMode_getPlayerStartCash(i); boost::shared_ptr tmpPlayer = myFactory->createPlayer(i, uniqueId, type, myName, myAvatarFile, myStartCash, startQuantityPlayers > i, myStayOnTableStatus, 0); tmpPlayer->setIsSessionActive(true); tmpPlayer->setMyGuid(myGuid); diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index 98c0b60b..dbe51e15 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -73,8 +73,13 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, boost: int bestHandPos[5]; int sBluff; + // board cards for(i=0; i<5; i++) tempBoardArray[i] = cardsArray[i]; - if(DEBUG_MODE) myLog->debugMode_getBoardCards(tempBoardArray,myID); + + // debug mode + myLog->debugMode_getBoardCards(tempBoardArray,myID); + + // prepare whole player hand for(i=0; i<5; i++) tempPlayerAndBoardArray[i+2] = tempBoardArray[i]; k = 0; @@ -83,8 +88,13 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, boost: (*it)->getMyBestHandPosition(bestHandPos); + // hole cards for(j=0; j<2; j++) tempPlayerArray[j] = cardsArray[2*k+j+5]; - if(DEBUG_MODE) myLog->debugMode_getPlayerCards(tempPlayerArray,myID,k); + + // debug mode + myLog->debugMode_getPlayerCards(tempPlayerArray,myID,k); + + // complete whole player hand for(j=0; j<2; j++) tempPlayerAndBoardArray[j] = tempPlayerArray[j]; (*it)->setMyCards(tempPlayerArray); diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index fbf75fe8..ab60b275 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -1263,7 +1263,8 @@ void LocalPlayer::preflopEngine() // cout << myID << ": " << myOdds << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << "Bluff: " << sBluffStatus << endl; - if(DEBUG_MODE) currentHand->getLog()->debugMode_getPlayerAction(GAME_STATE_PREFLOP, currentHand->getMyID(), myUniqueID, &myAction, &bet, &raise, mySet); + // debug mode + currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_PREFLOP, currentHand->getMyID(), myUniqueID, mySet); evaluation(bet, raise); } @@ -1524,7 +1525,8 @@ void LocalPlayer::flopEngine() } - if(DEBUG_MODE) currentHand->getLog()->debugMode_getPlayerAction(GAME_STATE_FLOP, currentHand->getMyID(), myUniqueID, &myAction, &bet, &raise, mySet); + // debug mode + currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_FLOP, currentHand->getMyID(), myUniqueID, mySet); evaluation(bet, raise); @@ -1798,7 +1800,8 @@ void LocalPlayer::turnEngine() } - if(DEBUG_MODE) currentHand->getLog()->debugMode_getPlayerAction(GAME_STATE_TURN, currentHand->getMyID(), myUniqueID, &myAction, &bet, &raise, mySet); + // debug mode + currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_TURN, currentHand->getMyID(), myUniqueID, mySet); evaluation(bet, raise); @@ -2058,7 +2061,8 @@ void LocalPlayer::riverEngine() } - if(DEBUG_MODE) currentHand->getLog()->debugMode_getPlayerAction(GAME_STATE_RIVER, currentHand->getMyID(), myUniqueID, &myAction, &bet, &raise, mySet); + // debug mode + currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_RIVER, currentHand->getMyID(), myUniqueID, mySet); evaluation(bet, raise); diff --git a/src/engine/log.cpp b/src/engine/log.cpp index 932c49f9..f1625aa0 100644 --- a/src/engine/log.cpp +++ b/src/engine/log.cpp @@ -39,17 +39,87 @@ #include #include +#include + using namespace std; -Log::Log(ConfigFile *c) : mySqliteLogDb(0), mySqliteLogFileName(""), myConfig(c), uniqueGameID(0), currentHandID(0), currentRound(GAME_STATE_PREFLOP), sql("") +unsigned debug_mode_startSmallBlind = 10; +unsigned debug_mode_dealerPosition = 4; +unsigned debug_mode_startCash[MAX_NUMBER_OF_PLAYERS] = { 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000}; +unsigned debug_mode_boardCards[][5] = { + { 4, 19, 20, 43, 49 }, + { 4, 19, 20, 43, 49 } +}; +int debug_mode_playerCards[][MAX_NUMBER_OF_PLAYERS][2] = { + { {18,17}, {-1,-1}, {26,27}, {31,30}, {50,51}, {25,24}, {38,37}, {32,33}, {19,20}, {18,17} }, + { {18,17}, {31, 8}, {26,27}, {31,30}, {50,51}, {25,24}, {38,37}, {32,33}, {19,20}, {18,17} } +}; +const unsigned debug_mode_cntBeRo = 4; +const unsigned debug_mode_cntActions = 4; +const unsigned debug_mode_cntValues = 3; +int playerActionMatrix[][debug_mode_cntBeRo][MAX_NUMBER_OF_PLAYERS][debug_mode_cntActions][debug_mode_cntValues] = { + { /* handID==0 */ + { /* preflop */ + { {-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player0 */ + { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player1 */ + { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player2 */ + { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player3 */ + { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player4 */ + { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player5 */ + { {-1,PLAYER_ACTION_RAISE,100},{50,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player6 */ + { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player7 */ + { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player8 */ + { {-1,PLAYER_ACTION_CALL ,-1},{10,PLAYER_ACTION_RAISE ,100},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} } /* player9 */ + }, + { /* flop */ + { {-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} } + }, + { /* turn */ + { {-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} } + }, + { /* river */ + { {-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, + { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} } + } + } +}; + +Log::Log(ConfigFile *c) : mySqliteLogDb(0), mySqliteLogFileName(""), myConfig(c), uniqueGameID(0), currentHandID(0), currentRound(GAME_STATE_PREFLOP), sql(""), debug_mode(false) { + // check for debug_mode + ifstream debug_mode_test_file("enable_debug_mode"); + if(debug_mode_test_file) debug_mode = true; } Log::~Log() { - if(SQLITE_LOG) { - sqlite3_close(mySqliteLogDb); - } + if(SQLITE_LOG) sqlite3_close(mySqliteLogDb); } void @@ -689,127 +759,71 @@ Log::exec_transaction() // } //} -unsigned -Log::debugMode_getStartSmallBlind() +void +Log::debugMode_getStartSmallBlind(int* startSmallBlind, int* currentSmallBlind) { - return 10; + if(debug_mode) { + *startSmallBlind = debug_mode_startSmallBlind; + *currentSmallBlind = *startSmallBlind; + } } -unsigned -Log::debugMode_getStartDealerPosition() +void +Log::debugMode_getStartDealerPosition(unsigned* dealerPosition) { - return 4; + if(debug_mode) { + *dealerPosition = debug_mode_dealerPosition; + } } void Log::debugMode_getBoardCards(int *tempBoardArray, int handID) { - unsigned boardCards[][5] = { - { 4, 19, 20, 43, 49 }, - { 4, 19, 20, 43, 49 } - }; - - if((unsigned)handID <= sizeof(boardCards)/sizeof(int)/5) { - for(int i=0; i<5; i++) tempBoardArray[i] = boardCards[handID-1][i]; + if(debug_mode) { + if((unsigned)handID <= sizeof(debug_mode_boardCards)/sizeof(unsigned)/5) { + for(int i=0; i<5; i++) tempBoardArray[i] = debug_mode_boardCards[handID-1][i]; + } } } void Log::debugMode_getPlayerCards(int *tempPlayerArray, int handID, int seatID) { - int playerCards[][10][2] = { - { {18,17}, {-1,-1}, {26,27}, {31,30}, {50,51}, {25,24}, {38,37}, {32,33}, {19,20}, {18,17} }, - { {18,17}, {31, 8}, {26,27}, {31,30}, {50,51}, {25,24}, {38,37}, {32,33}, {19,20}, {18,17} } - }; - - if((unsigned)handID <= sizeof(playerCards)/sizeof(int)/10/2) { - for(int i=0; i<2; i++) { - if(playerCards[handID-1][seatID][i]>=0) tempPlayerArray[i] = playerCards[handID-1][seatID][i]; + if(debug_mode) { + if((unsigned)handID <= sizeof(debug_mode_playerCards)/sizeof(int)/MAX_NUMBER_OF_PLAYERS/2) { + for(int i=0; i<2; i++) { + if(debug_mode_playerCards[handID-1][seatID][i]>=0) tempPlayerArray[i] = debug_mode_playerCards[handID-1][seatID][i]; + } } } } -unsigned -Log::debugMode_getPlayerStartCash(int seatID) -{ - unsigned startCashVector[] = { 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000 }; - return startCashVector[seatID]; -} - void -Log::debugMode_getPlayerAction(GameState gameState, int handID, int seatID, PlayerAction *playerAction, int *bet, int *raise, int mySet) +Log::debugMode_getPlayerStartCash(int* startCash, int seatID) { - const unsigned cntBeRo = 4; - const unsigned cntPlayer = 10; - const unsigned cntActions = 4; - const unsigned cntValues = 3; + if(debug_mode) { + *startCash = debug_mode_startCash[seatID]; + } +} - int playerActionMatrix[][cntBeRo][cntPlayer][cntActions][cntValues] = { - { /* handID==0 */ - { /* preflop */ - { {-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player0 */ - { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player1 */ - { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player2 */ - { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player3 */ - { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player4 */ - { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player5 */ - { {-1,PLAYER_ACTION_RAISE,100},{50,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player6 */ - { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player7 */ - { {-1,PLAYER_ACTION_CALL ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, /* player8 */ - { {-1,PLAYER_ACTION_CALL ,-1},{10,PLAYER_ACTION_RAISE ,100},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} } /* player9 */ - }, - { /* flop */ - { {-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} } - }, - { /* turn */ - { {-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} } - }, - { /* river */ - { {-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} }, - { {-1,PLAYER_ACTION_CHECK,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1},{-1,PLAYER_ACTION_NONE ,-1} } - } - } - }; - - if((unsigned)handID <= sizeof(playerActionMatrix)/sizeof(int)/cntBeRo/cntPlayer/cntActions/cntValues) { - int max_thd = 0; - unsigned next_action_idx = 0; - for(unsigned action_idx=0; action_idx playerActionMatrix[handID-1][gameState][seatID][action_idx][0] && playerActionMatrix[handID-1][gameState][seatID][action_idx][0] > max_thd) { - max_thd = playerActionMatrix[handID-1][gameState][seatID][action_idx][0]; - next_action_idx = action_idx; - } - *playerAction = (PlayerAction)playerActionMatrix[handID-1][gameState][seatID][next_action_idx][1]; - if(*playerAction == PLAYER_ACTION_BET) { - *bet = playerActionMatrix[handID-1][gameState][seatID][next_action_idx][2]; - } else if(*playerAction == PLAYER_ACTION_RAISE || *playerAction == PLAYER_ACTION_ALLIN) { - *raise = playerActionMatrix[handID-1][gameState][seatID][next_action_idx][2]; +void +Log::debugMode_getPlayerAction(PlayerAction *playerAction, int *bet, int *raise, GameState gameState, int handID, int seatID, int mySet) +{ + if(debug_mode) { + if((unsigned)handID <= sizeof(playerActionMatrix)/sizeof(int)/debug_mode_cntBeRo/MAX_NUMBER_OF_PLAYERS/debug_mode_cntActions/debug_mode_cntValues) { + int max_thd = 0; + unsigned next_action_idx = 0; + for(unsigned action_idx=0; action_idx playerActionMatrix[handID-1][gameState][seatID][action_idx][0] && playerActionMatrix[handID-1][gameState][seatID][action_idx][0] > max_thd) { + max_thd = playerActionMatrix[handID-1][gameState][seatID][action_idx][0]; + next_action_idx = action_idx; + } + *playerAction = (PlayerAction)playerActionMatrix[handID-1][gameState][seatID][next_action_idx][1]; + if(*playerAction == PLAYER_ACTION_BET) { + *bet = playerActionMatrix[handID-1][gameState][seatID][next_action_idx][2]; + } else if(*playerAction == PLAYER_ACTION_RAISE || *playerAction == PLAYER_ACTION_ALLIN) { + *raise = playerActionMatrix[handID-1][gameState][seatID][next_action_idx][2]; + } } } } diff --git a/src/engine/log.h b/src/engine/log.h index a26df47e..d53d4f5d 100644 --- a/src/engine/log.h +++ b/src/engine/log.h @@ -66,12 +66,15 @@ public: void logAfterGame(); // void closeLogDbAtExit(); - unsigned debugMode_getStartSmallBlind(); - unsigned debugMode_getStartDealerPosition(); - void debugMode_getBoardCards(int *tempBoardArray, int handID); - void debugMode_getPlayerCards(int *tempPlayerArray, int handID, int seatID); - unsigned debugMode_getPlayerStartCash(int seatID); - void debugMode_getPlayerAction(GameState gameState, int handID, int seatID, PlayerAction* playerAction, int* bet, int* raise, int mySet); + void debugMode_getStartSmallBlind(int* startSmallBlind, int* currentSmallBlind); + void debugMode_getStartDealerPosition(unsigned* dealerPosition); + void debugMode_getBoardCards(int* tempBoardArray, int handID); + void debugMode_getPlayerCards(int* tempPlayerArray, int handID, int seatID); + void debugMode_getPlayerStartCash(int* startCash, int seatID); + void debugMode_getPlayerAction(PlayerAction* playerAction, int* bet, int* raise, GameState gameState, int handID, int seatID, int mySet); + bool getDebugMode() { + return debug_mode; + } void setCurrentRound(GameState theValue) { currentRound = theValue; @@ -92,6 +95,8 @@ private: int currentHandID; GameState currentRound; std::string sql; + + bool debug_mode; }; #endif // LOG_H diff --git a/src/game_defs.h b/src/game_defs.h index 41710b0f..7d8679f7 100644 --- a/src/game_defs.h +++ b/src/game_defs.h @@ -37,7 +37,6 @@ #define MIN_GUI_SPEED 1 #define MAX_GUI_SPEED 11 -#define DEBUG_MODE 0 #define SQLITE_LOG 1 #define HTML_LOG 0 diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index bbf558e4..ba84c790 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -1443,7 +1443,7 @@ void gameTableImpl::dealHoleCards() (*it_c)->getMyCards(tempCardsIntArray); for(j=0; j<2; j++) { if((*it_c)->getMyActiveStatus()) { - if (( (*it_c)->getMyID() == 0) || DEBUG_MODE) { + if (( (*it_c)->getMyID() == 0) || (currentGame->getCurrentHand()->getLog() && currentGame->getCurrentHand()->getLog()->getDebugMode()) ) { tempCardsPixmapArray[j].load(myCardDeckStyle->getCurrentDir()+QString::number(tempCardsIntArray[j], 10)+".png"); if(myConfig->readConfigInt("AntiPeekMode")) { holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(flipside, true); @@ -2805,29 +2805,23 @@ void gameTableImpl::postRiverRunAnimation6() } } - if( !DEBUG_MODE ) { - - if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) { - currentGameOver = true; + if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_LOCAL) { + currentGameOver = true; #ifdef GUI_800x480 - tabs.pushButton_break->setDisabled(false); + tabs.pushButton_break->setDisabled(false); #else - pushButton_break->setDisabled(false); + pushButton_break->setDisabled(false); #endif - QFontMetrics tempMetrics = this->fontMetrics(); - int width = tempMetrics.width(tr("Start")); + QFontMetrics tempMetrics = this->fontMetrics(); + int width = tempMetrics.width(tr("Start")); #ifdef GUI_800x480 - tabs.pushButton_break->setMinimumSize(width+10,20); - tabs.pushButton_break->setText(tr("Start")); + tabs.pushButton_break->setMinimumSize(width+10,20); + tabs.pushButton_break->setText(tr("Start")); #else - pushButton_break->setMinimumSize(width+10,20); - pushButton_break->setText(tr("Start")); + pushButton_break->setMinimumSize(width+10,20); + pushButton_break->setText(tr("Start")); #endif - blinkingStartButtonAnimationTimer->start(500); - } - } else { - myStartWindow->callNewGameDialog(); - //Bei Cancel nichts machen!!! + blinkingStartButtonAnimationTimer->start(500); } return; }