From 8a1e3a4371c91c1e157338262a9cf62dedc9a9df Mon Sep 17 00:00:00 2001 From: floty Date: Tue, 25 Mar 2014 21:33:10 +0100 Subject: [PATCH] bugfix check log-object for debug_mode --- src/engine/game.cpp | 8 +++++--- src/engine/local_engine/localhand.cpp | 4 ++-- src/engine/local_engine/localplayer.cpp | 8 ++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/engine/game.cpp b/src/engine/game.cpp index a3f21d44..427da138 100755 --- a/src/engine/game.cpp +++ b/src/engine/game.cpp @@ -57,8 +57,10 @@ Game::Game(GuiInterface* gui, boost::shared_ptr factory, dealerPosition = startData.startDealerPlayerId; // debug mode - myLog->debugMode_getStartSmallBlind(&startSmallBlind,¤tSmallBlind); - myLog->debugMode_getStartDealerPosition(&dealerPosition); + if(myLog) { + myLog->debugMode_getStartSmallBlind(&startSmallBlind,¤tSmallBlind); + myLog->debugMode_getStartDealerPosition(&dealerPosition); + } int i; @@ -108,7 +110,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr factory, } // debug mode - myLog->debugMode_getPlayerStartCash(&myStartCash, i); + if(myLog) myLog->debugMode_getPlayerStartCash(&myStartCash, i); // create player objects boost::shared_ptr tmpPlayer = myFactory->createPlayer(i, uniqueId, type, myName, myAvatarFile, myStartCash, startQuantityPlayers > i, myStayOnTableStatus, 0); diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index dbe51e15..e90146e3 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -77,7 +77,7 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, boost: for(i=0; i<5; i++) tempBoardArray[i] = cardsArray[i]; // debug mode - myLog->debugMode_getBoardCards(tempBoardArray,myID); + if(myLog) myLog->debugMode_getBoardCards(tempBoardArray,myID); // prepare whole player hand for(i=0; i<5; i++) tempPlayerAndBoardArray[i+2] = tempBoardArray[i]; @@ -92,7 +92,7 @@ LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, boost: for(j=0; j<2; j++) tempPlayerArray[j] = cardsArray[2*k+j+5]; // debug mode - myLog->debugMode_getPlayerCards(tempPlayerArray,myID,k); + if(myLog) myLog->debugMode_getPlayerCards(tempPlayerArray,myID,k); // complete whole player hand for(j=0; j<2; j++) tempPlayerAndBoardArray[j] = tempPlayerArray[j]; diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index ab60b275..046376b1 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -1264,7 +1264,7 @@ void LocalPlayer::preflopEngine() // cout << myID << ": " << myOdds << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << "Bluff: " << sBluffStatus << endl; // debug mode - currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_PREFLOP, currentHand->getMyID(), myUniqueID, mySet); + if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_PREFLOP, currentHand->getMyID(), myUniqueID, mySet); evaluation(bet, raise); } @@ -1526,7 +1526,7 @@ void LocalPlayer::flopEngine() } // debug mode - currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_FLOP, currentHand->getMyID(), myUniqueID, mySet); + if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_FLOP, currentHand->getMyID(), myUniqueID, mySet); evaluation(bet, raise); @@ -1801,7 +1801,7 @@ void LocalPlayer::turnEngine() } // debug mode - currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_TURN, currentHand->getMyID(), myUniqueID, mySet); + if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_TURN, currentHand->getMyID(), myUniqueID, mySet); evaluation(bet, raise); @@ -2062,7 +2062,7 @@ void LocalPlayer::riverEngine() } // debug mode - currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_RIVER, currentHand->getMyID(), myUniqueID, mySet); + if(currentHand->getLog()) currentHand->getLog()->debugMode_getPlayerAction(&myAction, &bet, &raise, GAME_STATE_RIVER, currentHand->getMyID(), myUniqueID, mySet); evaluation(bet, raise);