From 3974e7cac531d88b3fdcc0333b86f939c8168065 Mon Sep 17 00:00:00 2001 From: lotodore Date: Sun, 9 Jan 2011 14:16:20 +0000 Subject: [PATCH] More shared_ptr in engine to prevent race conditions when accessing client engine from gui. Still incomplete. --- src/engine/enginefactory.h | 6 +-- src/engine/handinterface.h | 6 +-- .../local_engine/localenginefactory.cpp | 23 +++++--- src/engine/local_engine/localenginefactory.h | 8 +-- src/engine/local_engine/localhand.cpp | 2 +- src/engine/local_engine/localhand.h | 10 ++-- src/engine/local_engine/localplayer.h | 6 +-- .../network_engine/clientenginefactory.cpp | 20 ++++--- .../network_engine/clientenginefactory.h | 9 ++-- src/engine/network_engine/clienthand.cpp | 4 +- src/engine/network_engine/clienthand.h | 6 +-- src/engine/network_engine/clientplayer.h | 2 +- src/engine/playerinterface.h | 2 +- src/game.cpp | 19 ++----- src/game.h | 8 +-- src/gui/qt/gametable/gametableimpl.cpp | 52 +++++++++---------- src/gui/qt/gametable/log/guilog.cpp | 6 +-- 17 files changed, 95 insertions(+), 94 deletions(-) diff --git a/src/engine/enginefactory.h b/src/engine/enginefactory.h index 0a7ee866..9f1c4d4c 100644 --- a/src/engine/enginefactory.h +++ b/src/engine/enginefactory.h @@ -31,10 +31,10 @@ public: virtual ~EngineFactory(); - virtual HandInterface* createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) =0; - virtual BoardInterface* createBoard(unsigned dp) =0; + virtual boost::shared_ptr createHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) =0; + virtual boost::shared_ptr createBoard(unsigned dp) =0; virtual boost::shared_ptr createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) =0; - virtual std::vector > createBeRo(HandInterface* hi, int id, unsigned dP, int sB) =0; + virtual std::vector > createBeRo(HandInterface *hi, int id, unsigned dP, int sB) =0; }; #endif diff --git a/src/engine/handinterface.h b/src/engine/handinterface.h index 27ae1226..cb2b7cce 100644 --- a/src/engine/handinterface.h +++ b/src/engine/handinterface.h @@ -40,7 +40,7 @@ public: virtual PlayerListIterator getActivePlayerIt(unsigned) const =0; virtual PlayerListIterator getRunningPlayerIt(unsigned) const =0; - virtual BoardInterface* getBoard() const =0; + virtual boost::shared_ptr getBoard() const =0; virtual boost::shared_ptr getPreflop() const =0; virtual boost::shared_ptr getFlop() const =0; virtual boost::shared_ptr getTurn() const =0; @@ -75,8 +75,8 @@ public: virtual void setLastPlayersTurn(int theValue) =0; virtual int getLastPlayersTurn() const =0; - virtual void setLastActionPlayer( unsigned theValue ) =0; - virtual unsigned getLastActionPlayer() const =0; + virtual void setLastActionPlayer( unsigned theValue ) =0; + virtual unsigned getLastActionPlayer() const =0; virtual void setCardsShown(bool theValue) =0; virtual bool getCardsShown() const =0; diff --git a/src/engine/local_engine/localenginefactory.cpp b/src/engine/local_engine/localenginefactory.cpp index e78575fd..239e8fda 100644 --- a/src/engine/local_engine/localenginefactory.cpp +++ b/src/engine/local_engine/localenginefactory.cpp @@ -42,18 +42,27 @@ LocalEngineFactory::~LocalEngineFactory() } -HandInterface* -LocalEngineFactory::createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) +boost::shared_ptr +LocalEngineFactory::createHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) { - return new LocalHand(f, g, b, l, sl, apl, rpl, id, sP, dP, sB, sC); + return boost::shared_ptr(new LocalHand(f, g, b, l, sl, apl, rpl, id, sP, dP, sB, sC)); } -BoardInterface* LocalEngineFactory::createBoard(unsigned dp) { return new LocalBoard(dp); } +boost::shared_ptr +LocalEngineFactory::createBoard(unsigned dp) +{ + return boost::shared_ptr(new LocalBoard(dp)); +} -boost::shared_ptr LocalEngineFactory::createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) { return boost::shared_ptr (new LocalPlayer(myConfig, b, id, uniqueId, type, name, avatar, sC, aS, mB)); } - -std::vector > LocalEngineFactory::createBeRo(HandInterface* hi, int id, unsigned dP, int sB) { +boost::shared_ptr +LocalEngineFactory::createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) +{ + return boost::shared_ptr (new LocalPlayer(myConfig, b, id, uniqueId, type, name, avatar, sC, aS, mB)); +} +std::vector > +LocalEngineFactory::createBeRo(HandInterface *hi, int id, unsigned dP, int sB) +{ std::vector > myBeRo; myBeRo.push_back(boost::shared_ptr(new LocalBeRoPreflop(hi, id, dP, sB))); diff --git a/src/engine/local_engine/localenginefactory.h b/src/engine/local_engine/localenginefactory.h index fc94194b..63989ff0 100644 --- a/src/engine/local_engine/localenginefactory.h +++ b/src/engine/local_engine/localenginefactory.h @@ -37,10 +37,10 @@ public: LocalEngineFactory(ConfigFile*); ~LocalEngineFactory(); - HandInterface* createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); - BoardInterface* createBoard(unsigned dp); - boost::shared_ptr createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB); - std::vector > createBeRo(HandInterface* hi, int id, unsigned dP, int sB); + virtual boost::shared_ptr createHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); + virtual boost::shared_ptr createBoard(unsigned dp); + virtual boost::shared_ptr createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB); + virtual std::vector > createBeRo(HandInterface *hi, int id, unsigned dP, int sB); private: ConfigFile *myConfig; diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index 6ad8d215..a7bdb837 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -30,7 +30,7 @@ using namespace std; -LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, unsigned dP, int sB,int sC) +LocalHand::LocalHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, unsigned dP, int sB,int sC) : myFactory(f), myGui(g), myBoard(b), myLog(l), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), smallBlindPosition(dP), bigBlindPosition(dP), currentRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(-1), lastActionPlayer(0), allInCondition(false), cardsShown(false), bettingRoundsPlayed(0) { diff --git a/src/engine/local_engine/localhand.h b/src/engine/local_engine/localhand.h index 4d1fc4b2..48f78c31 100755 --- a/src/engine/local_engine/localhand.h +++ b/src/engine/local_engine/localhand.h @@ -33,7 +33,7 @@ class Log; class LocalHand : public HandInterface{ public: - LocalHand(boost::shared_ptr f, GuiInterface*, BoardInterface*, Log*, PlayerList, PlayerList, PlayerList, int, int, unsigned, int, int); + LocalHand(boost::shared_ptr f, GuiInterface*, boost::shared_ptr, Log*, PlayerList, PlayerList, PlayerList, int, int, unsigned, int, int); ~LocalHand(); void start(); @@ -46,7 +46,7 @@ public: PlayerListIterator getActivePlayerIt(unsigned) const; PlayerListIterator getRunningPlayerIt(unsigned) const; - BoardInterface* getBoard() const { return myBoard; } + boost::shared_ptr getBoard() const { return myBoard; } boost::shared_ptr getPreflop() const { return myBeRo[GAME_STATE_PREFLOP]; } boost::shared_ptr getFlop() const { return myBeRo[GAME_STATE_FLOP]; } boost::shared_ptr getTurn() const { return myBeRo[GAME_STATE_TURN]; } @@ -81,8 +81,8 @@ public: void setLastPlayersTurn(int theValue) { lastPlayersTurn = theValue; } int getLastPlayersTurn() const { return lastPlayersTurn; } - void setLastActionPlayer ( unsigned theValue ); - unsigned getLastActionPlayer() const { return lastActionPlayer; } + void setLastActionPlayer ( unsigned theValue ); + unsigned getLastActionPlayer() const { return lastActionPlayer; } void setCardsShown(bool theValue) { cardsShown = theValue; } bool getCardsShown() const { return cardsShown; } @@ -96,7 +96,7 @@ private: boost::shared_ptr myFactory; GuiInterface *myGui; - BoardInterface *myBoard; + boost::shared_ptr myBoard; Log *myLog; PlayerList seatsList; // all player diff --git a/src/engine/local_engine/localplayer.h b/src/engine/local_engine/localplayer.h index 26688686..258a4443 100755 --- a/src/engine/local_engine/localplayer.h +++ b/src/engine/local_engine/localplayer.h @@ -37,7 +37,7 @@ public: ~LocalPlayer(); - void setHand(HandInterface*); + void setHand(HandInterface *); int getMyID() const { return myID; } unsigned getMyUniqueID() const { return myUniqueID; } @@ -77,8 +77,8 @@ public: void setMyActiveStatus(bool theValue) { myActiveStatus = theValue; } bool getMyActiveStatus() const { return myActiveStatus; } - void setMyStayOnTableStatus(bool theValue) { myStayOnTableStatus = theValue; } - bool getMyStayOnTableStatus() const { return myStayOnTableStatus; } + void setMyStayOnTableStatus(bool theValue) { myStayOnTableStatus = theValue; } + bool getMyStayOnTableStatus() const { return myStayOnTableStatus; } void setMyCards(int* theValue) { int i; for(i=0; i<2; i++) myCards[i] = theValue[i]; } void getMyCards(int* theValue) const { int i; for(i=0; i<2; i++) theValue[i] = myCards[i]; } diff --git a/src/engine/network_engine/clientenginefactory.cpp b/src/engine/network_engine/clientenginefactory.cpp index 2d3dee28..3abd9ac7 100644 --- a/src/engine/network_engine/clientenginefactory.cpp +++ b/src/engine/network_engine/clientenginefactory.cpp @@ -35,23 +35,27 @@ ClientEngineFactory::~ClientEngineFactory() } -HandInterface* ClientEngineFactory::createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) +boost::shared_ptr +ClientEngineFactory::createHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) { - return new ClientHand(f, g, b, l, sl, apl, rpl, id, sP, dP, sB, sC); + return boost::shared_ptr(new ClientHand(f, g, b, l, sl, apl, rpl, id, sP, dP, sB, sC)); } -BoardInterface* ClientEngineFactory::createBoard(unsigned dp) +boost::shared_ptr +ClientEngineFactory::createBoard(unsigned dp) { - return new ClientBoard(dp); + return boost::shared_ptr(new ClientBoard(dp)); } -boost::shared_ptr ClientEngineFactory::createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) +boost::shared_ptr +ClientEngineFactory::createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) { - return boost::shared_ptr (new ClientPlayer(NULL, b, id, uniqueId, type, name, avatar, sC, aS, mB)); + return boost::shared_ptr(new ClientPlayer(NULL, b, id, uniqueId, type, name, avatar, sC, aS, mB)); } -std::vector > ClientEngineFactory::createBeRo(HandInterface* hi, int id, unsigned dP, int sB) { - +std::vector > +ClientEngineFactory::createBeRo(HandInterface *hi, int id, unsigned dP, int sB) +{ std::vector > myBeRo; myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, id, dP, sB, GAME_STATE_PREFLOP))); diff --git a/src/engine/network_engine/clientenginefactory.h b/src/engine/network_engine/clientenginefactory.h index 82617ff3..38e936cc 100644 --- a/src/engine/network_engine/clientenginefactory.h +++ b/src/engine/network_engine/clientenginefactory.h @@ -38,11 +38,10 @@ public: ClientEngineFactory(); ~ClientEngineFactory(); - HandInterface* createHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); - BoardInterface* createBoard(unsigned dp); - boost::shared_ptr createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB); - std::vector > createBeRo(HandInterface* hi, int id, unsigned dP, int sB); - + virtual boost::shared_ptr createHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC); + virtual boost::shared_ptr createBoard(unsigned dp); + virtual boost::shared_ptr createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB); + virtual std::vector > createBeRo(HandInterface *hi, int id, unsigned dP, int sB); }; #endif diff --git a/src/engine/network_engine/clienthand.cpp b/src/engine/network_engine/clienthand.cpp index aff57f87..0036dff4 100644 --- a/src/engine/network_engine/clienthand.cpp +++ b/src/engine/network_engine/clienthand.cpp @@ -21,7 +21,7 @@ using namespace std; -ClientHand::ClientHand(boost::shared_ptr f, GuiInterface *g, BoardInterface *b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) +ClientHand::ClientHand(boost::shared_ptr f, GuiInterface *g, boost::shared_ptr b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) : myFactory(f), myGui(g), myBoard(b), myLog(l), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(-1), allInCondition(0), cardsShown(false), bettingRoundsPlayed(0) @@ -125,7 +125,7 @@ ClientHand::getRunningPlayerIt(unsigned uniqueId) const return it; } -BoardInterface* +boost::shared_ptr ClientHand::getBoard() const { return myBoard; diff --git a/src/engine/network_engine/clienthand.h b/src/engine/network_engine/clienthand.h index b17ea5e5..cbc5e867 100644 --- a/src/engine/network_engine/clienthand.h +++ b/src/engine/network_engine/clienthand.h @@ -33,7 +33,7 @@ class ClientHand : public HandInterface { public: - ClientHand ( boost::shared_ptr f, GuiInterface*, BoardInterface*, Log*, PlayerList, PlayerList, PlayerList , int, int, int, int, int ); + ClientHand ( boost::shared_ptr f, GuiInterface*, boost::shared_ptr, Log*, PlayerList, PlayerList, PlayerList , int, int, int, int, int ); ~ClientHand(); void start(); @@ -46,7 +46,7 @@ class ClientHand : public HandInterface PlayerListIterator getActivePlayerIt(unsigned) const; PlayerListIterator getRunningPlayerIt(unsigned) const; - BoardInterface* getBoard() const; + boost::shared_ptr getBoard() const; boost::shared_ptr getPreflop() const; boost::shared_ptr getFlop() const; boost::shared_ptr getTurn() const; @@ -98,7 +98,7 @@ class ClientHand : public HandInterface boost::shared_ptr myFactory; GuiInterface *myGui; - BoardInterface *myBoard; + boost::shared_ptr myBoard; Log *myLog; PlayerList seatsList; diff --git a/src/engine/network_engine/clientplayer.h b/src/engine/network_engine/clientplayer.h index 4db11832..9d1369ae 100644 --- a/src/engine/network_engine/clientplayer.h +++ b/src/engine/network_engine/clientplayer.h @@ -35,7 +35,7 @@ public: ClientPlayer(ConfigFile*, BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB); ~ClientPlayer(); - void setHand(HandInterface*); + void setHand(HandInterface *); int getMyID() const; unsigned getMyUniqueID() const; diff --git a/src/engine/playerinterface.h b/src/engine/playerinterface.h index 2d000b78..84802353 100644 --- a/src/engine/playerinterface.h +++ b/src/engine/playerinterface.h @@ -30,7 +30,7 @@ public: virtual ~PlayerInterface() =0; - virtual void setHand(HandInterface*) =0; + virtual void setHand(HandInterface *) =0; virtual int getMyID() const =0; virtual unsigned getMyUniqueID() const =0; diff --git a/src/game.cpp b/src/game.cpp index 6923c643..5d57a858 100755 --- a/src/game.cpp +++ b/src/game.cpp @@ -33,8 +33,7 @@ using namespace std; Game::Game(GuiInterface* gui, boost::shared_ptr factory, const PlayerDataList &playerDataList, const GameData &gameData, const StartData &startData, int gameId, Log* log) -: myFactory(factory), myGui(gui), myLog(log), currentHand(0), currentBoard(0), - startQuantityPlayers(startData.numberOfPlayers), +: myFactory(factory), myGui(gui), myLog(log), startQuantityPlayers(startData.numberOfPlayers), startCash(gameData.startMoney), startSmallBlind(gameData.firstSmallBlind), myGameID(gameId), currentSmallBlind(gameData.firstSmallBlind), currentHandID(0), dealerPosition(0), lastHandBlindsRaised(1), lastTimeBlindsRaised(0), myGameData(gameData) { @@ -94,7 +93,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr factory, } // create player objects - boost::shared_ptr tmpPlayer = myFactory->createPlayer(currentBoard, i, uniqueId, type, myName, myAvatarFile, startCash, startQuantityPlayers > i, 0); + boost::shared_ptr tmpPlayer = myFactory->createPlayer(currentBoard.get(), i, uniqueId, type, myName, myAvatarFile, startCash, startQuantityPlayers > i, 0); tmpPlayer->setNetSessionData(myNetSession); @@ -119,18 +118,14 @@ Game::Game(GuiInterface* gui, boost::shared_ptr factory, Game::~Game() { - delete currentBoard; - currentBoard = 0; - delete currentHand; - currentHand = 0; } -HandInterface *Game::getCurrentHand() +boost::shared_ptr Game::getCurrentHand() { return currentHand; } -const HandInterface *Game::getCurrentHand() const +const boost::shared_ptr Game::getCurrentHand() const { return currentHand; } @@ -164,12 +159,6 @@ void Game::initHand() } } - // delete possible existing hands - if(currentHand) { - delete currentHand; - currentHand = 0; - } - runningPlayerList->clear(); (*runningPlayerList) = (*activePlayerList); diff --git a/src/game.h b/src/game.h index b9e2fbe7..5d1f5dbe 100755 --- a/src/game.h +++ b/src/game.h @@ -47,8 +47,8 @@ public: void initHand(); void startHand(); - HandInterface *getCurrentHand(); - const HandInterface *getCurrentHand() const; + boost::shared_ptr getCurrentHand(); + const boost::shared_ptr getCurrentHand() const; PlayerList getSeatsList() const {return seatsList;} PlayerList getActivePlayerList() const {return activePlayerList;} @@ -83,8 +83,8 @@ private: GuiInterface *myGui; Log *myLog; - HandInterface *currentHand; - BoardInterface *currentBoard; + boost::shared_ptr currentHand; + boost::shared_ptr currentBoard; PlayerList seatsList; PlayerList activePlayerList; // used seats diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index eb010cfd..d8d3afb2 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -779,7 +779,7 @@ void gameTableImpl::refreshButton() { void gameTableImpl::refreshPlayerName() { if(myStartWindow->getSession()->getCurrentGame()) { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); PlayerListConstIterator it_c; for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) { @@ -821,7 +821,7 @@ void gameTableImpl::refreshPlayerAvatar() { QPixmap onePix = QPixmap::fromImage(QImage(myAppDataPath +"gfx/gui/misc/1px.png")); - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); int seatPlace; PlayerListConstIterator it_c; for (it_c=currentHand->getSeatsList()->begin(), seatPlace=0; it_c!=currentHand->getSeatsList()->end(); it_c++, seatPlace++) { @@ -889,7 +889,7 @@ void gameTableImpl::refreshAction(int playerID, int playerAction) { QStringList actionArray; actionArray << "" << "fold" << "check" << "call" << "bet" << "raise" << "allin"; - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); if(playerID == -1 || playerAction == -1) { @@ -945,7 +945,7 @@ void gameTableImpl::refreshAction(int playerID, int playerAction) { void gameTableImpl::refreshCash() { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); PlayerListConstIterator it_c; for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) { @@ -965,7 +965,7 @@ void gameTableImpl::refreshGroupbox(int playerID, int status) { if(playerID == -1 || status == -1) { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); PlayerListConstIterator it_c; for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) { @@ -1075,7 +1075,7 @@ void gameTableImpl::refreshAll() { refreshSet(); refreshButton(); - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); PlayerListConstIterator it_c; for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) { refreshAction( (*it_c)->getMyID(), (*it_c)->getMyAction()); @@ -1091,7 +1091,7 @@ void gameTableImpl::refreshChangePlayer() { refreshSet(); - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); PlayerListConstIterator it_c; for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) { refreshAction( (*it_c)->getMyID(), (*it_c)->getMyAction()); @@ -1101,7 +1101,7 @@ void gameTableImpl::refreshChangePlayer() { } void gameTableImpl::refreshPot() { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); textLabel_Sets->setText("$"+QString("%L1").arg(currentHand->getBoard()->getSets())); textLabel_Pot->setText("$"+QString("%L1").arg(currentHand->getBoard()->getPot())); @@ -1371,7 +1371,7 @@ void gameTableImpl::provideMyActions(int mode) { Game *currentGame = myStartWindow->getSession()->getCurrentGame(); - HandInterface *currentHand = currentGame->getCurrentHand(); + boost::shared_ptr currentHand = currentGame->getCurrentHand(); //really disabled buttons if human player is fold/all-in or ... and not called from dealberocards if(/*pushButton_BetRaise->isCheckable() && */mode != 0 && (currentHand->getSeatsList()->front()->getMyAction() == PLAYER_ACTION_ALLIN || currentHand->getSeatsList()->front()->getMyAction() == PLAYER_ACTION_FOLD || (currentGame->getSeatsList()->front()->getMySet() == currentHand->getCurrentBeRo()->getHighestSet() && (currentGame->getSeatsList()->front()->getMyAction() != PLAYER_ACTION_NONE)))) { @@ -1610,7 +1610,7 @@ void gameTableImpl::stopTimeoutAnimation(int playerId) { void gameTableImpl::disableMyButtons() { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); clearMyButtons(); @@ -1641,7 +1641,7 @@ void gameTableImpl::myFold(){ if(pushButton_Fold->text() == FoldString) { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); currentHand->getSeatsList()->front()->setMyAction(1); currentHand->getSeatsList()->front()->setMyTurn(0); @@ -1656,7 +1656,7 @@ void gameTableImpl::myFold(){ } void gameTableImpl::myCheck() { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); currentHand->getSeatsList()->front()->setMyTurn(0); currentHand->getSeatsList()->front()->setMyAction(2); @@ -1672,7 +1672,7 @@ void gameTableImpl::myCheck() { int gameTableImpl::getMyCallAmount() { int tempHighestSet = 0; - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); tempHighestSet = currentHand->getCurrentBeRo()->getHighestSet(); @@ -1693,7 +1693,7 @@ int gameTableImpl::getBetRaisePushButtonValue() { int gameTableImpl::getMyBetAmount() { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); int betValue = getBetRaisePushButtonValue(); int minimum; @@ -1711,7 +1711,7 @@ int gameTableImpl::getMyBetAmount() { void gameTableImpl::myCall(){ int tempHighestSet = 0; - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); tempHighestSet = currentHand->getCurrentBeRo()->getHighestSet(); @@ -1743,7 +1743,7 @@ void gameTableImpl::mySet(){ if(pushButton_BetRaise->text() != "") { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); int tempCash = currentHand->getSeatsList()->front()->getMyCash(); // cout << "Set-Value " << getBetRaisePushButtonValue() << endl; @@ -1805,7 +1805,7 @@ void gameTableImpl::myAllIn(){ if(pushButton_AllIn->text() == AllInString) { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); currentHand->getSeatsList()->front()->setMySet(currentHand->getSeatsList()->front()->getMyCash()); currentHand->getSeatsList()->front()->setMyCash(0); @@ -1967,7 +1967,7 @@ void gameTableImpl::myActionDone() { void gameTableImpl::nextPlayerAnimation() { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); //refresh Change Player refreshSet(); @@ -2045,7 +2045,7 @@ void gameTableImpl::postRiverRunAnimation2() { horizontalSlider_bet->setDisabled(TRUE); spinBox_betValue->setDisabled(TRUE); - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); bool internetOrNetworkGame = (myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK); @@ -2101,7 +2101,7 @@ void gameTableImpl::postRiverRunAnimation2() { void gameTableImpl::postRiverRunAnimation3() { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); int nonfoldPlayerCounter = 0; PlayerListConstIterator it_c; @@ -2229,7 +2229,7 @@ void gameTableImpl::postRiverRunAnimation4() { void gameTableImpl::postRiverRunAnimation5() { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); PlayerListConstIterator it_c; @@ -2273,7 +2273,7 @@ void gameTableImpl::postRiverRunAnimation6() { playerNameLabelArray[i]->show(); } - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); refreshCash(); refreshPot(); @@ -2325,7 +2325,7 @@ void gameTableImpl::postRiverRunAnimation6() { void gameTableImpl::showHoleCards(unsigned playerId, bool allIn) { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); //TempArrays QPixmap tempCardsPixmapArray[2]; int tempCardsIntArray[2]; @@ -2359,7 +2359,7 @@ void gameTableImpl::showHoleCards(unsigned playerId, bool allIn) void gameTableImpl::flipHolecardsAllIn() { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); if(!flipHolecardsAllInAlreadyDone) { //Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen @@ -2876,7 +2876,7 @@ void gameTableImpl::mouseOverFlipCards(bool front) { void gameTableImpl::updateMyButtonsState(int mode) { - HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); if(currentHand->getLastPlayersTurn() == 0) { myButtonsCheckable(FALSE); @@ -2920,7 +2920,7 @@ void gameTableImpl::clearMyButtons() { void gameTableImpl::myButtonsCheckable(bool state) { Game *currentGame = myStartWindow->getSession()->getCurrentGame(); - HandInterface *currentHand = currentGame->getCurrentHand(); + boost::shared_ptr currentHand = currentGame->getCurrentHand(); if(state) { //checkable diff --git a/src/gui/qt/gametable/log/guilog.cpp b/src/gui/qt/gametable/log/guilog.cpp index 94093de2..a915214f 100644 --- a/src/gui/qt/gametable/log/guilog.cpp +++ b/src/gui/qt/gametable/log/guilog.cpp @@ -201,7 +201,7 @@ void guiLog::logPlayerActionMsg(QString msg, int playerID, int action, int setVa void guiLog::logNewGameHandMsg(int gameID, int handID) { PlayerListConstIterator it_c; - HandInterface *currentHand = myW->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myW->getSession()->getCurrentGame()->getCurrentHand(); myW->textBrowser_Log->append("getChatLogTextColor()+"; font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##"); @@ -391,7 +391,7 @@ void guiLog::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString b logFileStreamString += bbName+" ($"+QString::number(bbSet,10)+")"; PlayerListConstIterator it_c; - HandInterface *currentHand = myW->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myW->getSession()->getCurrentGame()->getCurrentHand(); for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) { if(currentHand->getActivePlayerList()->size() > 2) { if((*it_c)->getMyButton() == BUTTON_DEALER) { @@ -1537,7 +1537,7 @@ QString guiLog::determineHandName(int myCardsValueInt) { list sameHandCardsValueInt; bool different = false; bool equal = false; - HandInterface *currentHand = myW->getSession()->getCurrentGame()->getCurrentHand(); + boost::shared_ptr currentHand = myW->getSession()->getCurrentGame()->getCurrentHand(); PlayerListConstIterator it_c; // collect cardsValueInt of all players who will show their cards