From 03ecc5b9cb1b837ee7dff5f00b3e632295478649 Mon Sep 17 00:00:00 2001 From: lotodore Date: Tue, 7 Aug 2007 20:37:34 +0000 Subject: [PATCH] Removed client code which is no longer needed now. Networking still somewhat broken. --- pokerth.pro | 8 - pokerth_server.pro | 10 +- src/engine/berointerface.h | 22 +-- src/engine/local_engine/localbero.cpp | 3 +- src/engine/local_engine/localbero.h | 21 +-- src/engine/network_engine/clientbero.cpp | 112 +++++++++++++- src/engine/network_engine/clientbero.h | 49 ++++-- .../network_engine/clientenginefactory.cpp | 19 +-- src/engine/network_engine/clientflop.cpp | 122 --------------- src/engine/network_engine/clientflop.h | 84 ----------- src/engine/network_engine/clientpreflop.cpp | 80 ---------- src/engine/network_engine/clientpreflop.h | 75 ---------- src/engine/network_engine/clientriver.cpp | 140 ------------------ src/engine/network_engine/clientriver.h | 89 ----------- src/engine/network_engine/clientturn.cpp | 121 --------------- src/engine/network_engine/clientturn.h | 83 ----------- src/net/common/serverrecvstate.cpp | 33 +---- src/net/serverrecvstate.h | 1 - 18 files changed, 177 insertions(+), 895 deletions(-) delete mode 100644 src/engine/network_engine/clientflop.cpp delete mode 100644 src/engine/network_engine/clientflop.h delete mode 100644 src/engine/network_engine/clientpreflop.cpp delete mode 100644 src/engine/network_engine/clientpreflop.h delete mode 100644 src/engine/network_engine/clientriver.cpp delete mode 100644 src/engine/network_engine/clientriver.h delete mode 100644 src/engine/network_engine/clientturn.cpp delete mode 100644 src/engine/network_engine/clientturn.h diff --git a/pokerth.pro b/pokerth.pro index 2eb246a1..6d552b52 100755 --- a/pokerth.pro +++ b/pokerth.pro @@ -104,12 +104,8 @@ HEADERS += src/game.h \ src/engine/local_engine/localbero.h \ src/engine/network_engine/clientboard.h \ src/engine/network_engine/clientenginefactory.h \ - src/engine/network_engine/clientflop.h \ src/engine/network_engine/clienthand.h \ src/engine/network_engine/clientplayer.h \ - src/engine/network_engine/clientpreflop.h \ - src/engine/network_engine/clientriver.h \ - src/engine/network_engine/clientturn.h \ src/engine/network_engine/clientbero.h \ src/gui/qt/sound/sdlplayer.h \ src/gui/qt/mainwindow/mainwindowimpl.h \ @@ -177,12 +173,8 @@ SOURCES += src/game.cpp \ src/engine/local_engine/localbero.cpp \ src/engine/network_engine/clientboard.cpp \ src/engine/network_engine/clientenginefactory.cpp \ - src/engine/network_engine/clientflop.cpp \ src/engine/network_engine/clienthand.cpp \ src/engine/network_engine/clientplayer.cpp \ - src/engine/network_engine/clientpreflop.cpp \ - src/engine/network_engine/clientriver.cpp \ - src/engine/network_engine/clientturn.cpp \ src/engine/network_engine/clientbero.cpp \ src/net/common/connectdata.cpp \ src/net/common/clientcallback.cpp \ diff --git a/pokerth_server.pro b/pokerth_server.pro index 84ec9081..4de94c55 100644 --- a/pokerth_server.pro +++ b/pokerth_server.pro @@ -76,12 +76,9 @@ HEADERS += src/game.h \ src/engine/local_engine/tools.h \ src/engine/network_engine/clientboard.h \ src/engine/network_engine/clientenginefactory.h \ - src/engine/network_engine/clientflop.h \ src/engine/network_engine/clienthand.h \ src/engine/network_engine/clientplayer.h \ - src/engine/network_engine/clientpreflop.h \ - src/engine/network_engine/clientriver.h \ - src/engine/network_engine/clientturn.h \ + src/engine/network_engine/clientbero.h \ src/gui/qttoolsinterface.h \ src/gui/qt/qttools/qttoolswrapper.h \ src/gui/qt/qttools/qthelper/qthelper.h \ @@ -117,12 +114,9 @@ SOURCES += src/game.cpp \ src/engine/local_engine/tools.cpp \ src/engine/network_engine/clientboard.cpp \ src/engine/network_engine/clientenginefactory.cpp \ - src/engine/network_engine/clientflop.cpp \ src/engine/network_engine/clienthand.cpp \ src/engine/network_engine/clientplayer.cpp \ - src/engine/network_engine/clientpreflop.cpp \ - src/engine/network_engine/clientriver.cpp \ - src/engine/network_engine/clientturn.cpp \ + src/engine/network_engine/clientbero.cpp \ src/net/common/connectdata.cpp \ src/net/common/clientcallback.cpp \ src/net/common/clientcontext.cpp \ diff --git a/src/engine/berointerface.h b/src/engine/berointerface.h index 98e9699d..2eb8c5e0 100644 --- a/src/engine/berointerface.h +++ b/src/engine/berointerface.h @@ -1,7 +1,7 @@ // // C++ Interface: berointerface // -// Description: +// Description: Betting rounds interface // // // Author: FThauer FHammer , (C) 2007 @@ -12,15 +12,17 @@ #ifndef BEROINTERFACE_H #define BEROINTERFACE_H +#include "game_defs.h" + /** @author FThauer FHammer */ class BeRoInterface{ public: - virtual ~BeRoInterface(); + virtual ~BeRoInterface(); - virtual int getMyBeRoID() const =0; + virtual GameState getMyBeRoID() const =0; virtual void setPlayersTurn(int) =0; virtual int getPlayersTurn() const =0; @@ -29,21 +31,13 @@ public: virtual int getHighestSet() const =0; virtual void setHighestCardsValue(int theValue) =0; - virtual void resetFirstRun() =0; virtual int getHighestCardsValue() const =0; - virtual void run() =0; + virtual void resetFirstRun() =0; - // temporary for network - virtual void preflopRun() =0; - virtual void flopRun() =0; - virtual void turnRun() =0; - virtual void riverRun() =0; - - virtual void postRiverRun() =0; - virtual void nextPlayer() =0; - + virtual void run() =0; + virtual void postRiverRun() =0; }; #endif diff --git a/src/engine/local_engine/localbero.cpp b/src/engine/local_engine/localbero.cpp index 1ef63589..7402c5ce 100644 --- a/src/engine/local_engine/localbero.cpp +++ b/src/engine/local_engine/localbero.cpp @@ -13,7 +13,8 @@ using namespace std; -LocalBeRo::LocalBeRo(HandInterface* hi, int id, int qP, int dP, int sB, GameState gS) : BeRoInterface(), myHand(hi), myBeRoID(gS), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRun(1), firstRound(1), firstHeadsUpRound(1), playersTurn(dP), logBoardCardsDone(0) +LocalBeRo::LocalBeRo(HandInterface* hi, int id, int qP, int dP, int sB, GameState gS) +: BeRoInterface(), myHand(hi), myBeRoID(gS), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRun(1), firstRound(1), firstHeadsUpRound(1), playersTurn(dP), logBoardCardsDone(0) { int i; diff --git a/src/engine/local_engine/localbero.h b/src/engine/local_engine/localbero.h index 31d0a74e..c9c62da1 100644 --- a/src/engine/local_engine/localbero.h +++ b/src/engine/local_engine/localbero.h @@ -15,7 +15,6 @@ #include -#include "game_defs.h" #include "berointerface.h" #include "handinterface.h" @@ -24,16 +23,14 @@ */ class LocalBeRo : public BeRoInterface{ public: - LocalBeRo(HandInterface* hi, int id, int qP, int dP, int sB, GameState gS); + LocalBeRo(HandInterface* hi, int id, int qP, int dP, int sB, GameState gS); + ~LocalBeRo(); - ~LocalBeRo(); - - int getMyBeRoID() const { return myBeRoID; } + GameState getMyBeRoID() const { return myBeRoID; } int getHighestCardsValue() const {return 0;} void setHighestCardsValue(int theValue) {} - void setPlayersTurn(int theValue) { playersTurn = theValue; } int getPlayersTurn() const { return playersTurn; } @@ -53,21 +50,15 @@ public: void nextPlayer(); void run(); - - //only until bero refactoring is over - void preflopRun() {} - void flopRun() {} - void riverRun() {} - void turnRun() {} void postRiverRun() {} - + protected: HandInterface* myHand; - int myBeRoID; + const GameState myBeRoID; int myID; - int actualQuantityPlayers; + int actualQuantityPlayers; int dealerPosition; int smallBlindPosition; diff --git a/src/engine/network_engine/clientbero.cpp b/src/engine/network_engine/clientbero.cpp index cb48465e..1e9b1104 100644 --- a/src/engine/network_engine/clientbero.cpp +++ b/src/engine/network_engine/clientbero.cpp @@ -11,7 +11,8 @@ // #include "clientbero.h" -ClientBeRo::ClientBeRo() : BeRoInterface() +ClientBeRo::ClientBeRo(HandInterface* hi, int id, int qP, int dP, int sB, GameState gS) +: BeRoInterface(), myHand(hi), highestCardsValue(0), myBeRoID(gS), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRound(1), playersTurn(dP) { } @@ -20,4 +21,113 @@ ClientBeRo::~ClientBeRo() { } +GameState +ClientBeRo::getMyBeRoID() const +{ + return myBeRoID; +} + +int +ClientBeRo::getHighestCardsValue() const +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + return highestCardsValue; +} + +void +ClientBeRo::setHighestCardsValue(int theValue) +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + highestCardsValue = theValue; +} + +void +ClientBeRo::setPlayersTurn(int theValue) +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + playersTurn = theValue; +} + +int +ClientBeRo::getPlayersTurn() const +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + return playersTurn; +} + +void +ClientBeRo::setHighestSet(int theValue) +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + highestSet = theValue; +} + +int +ClientBeRo::getHighestSet() const +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + return highestSet; +} + +void +ClientBeRo::setFirstRound(bool theValue) +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + firstRound = theValue; +} + +bool +ClientBeRo::getFirstRound() const +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + return firstRound; +} + +void +ClientBeRo::setSmallBlindPosition(int theValue) +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + smallBlindPosition = theValue; +} + +int +ClientBeRo::getSmallBlindPosition() const +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + return smallBlindPosition; +} + +void +ClientBeRo::setSmallBlind(int theValue) +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + smallBlind = theValue; +} + +int +ClientBeRo::getSmallBlind() const +{ + boost::recursive_mutex::scoped_lock lock(m_syncMutex); + return smallBlind; +} + +void +ClientBeRo::resetFirstRun() +{ +} + +void +ClientBeRo::nextPlayer() +{ +} + +void +ClientBeRo::run() +{ +} + +void +ClientBeRo::postRiverRun() +{ +} diff --git a/src/engine/network_engine/clientbero.h b/src/engine/network_engine/clientbero.h index 49297735..f6814889 100644 --- a/src/engine/network_engine/clientbero.h +++ b/src/engine/network_engine/clientbero.h @@ -12,30 +12,59 @@ #ifndef CLIENTBERO_H #define CLIENTBERO_H -#include - -#include - +#include #include "berointerface.h" +class HandInterface; /** @author FThauer FHammer */ class ClientBeRo : public BeRoInterface{ public: - ClientBeRo(); + ClientBeRo(HandInterface* hi, int id, int qP, int dP, int sB, GameState gS); + ~ClientBeRo(); - ~ClientBeRo(); + GameState getMyBeRoID() const; - int getMyBeRoID() const { return myBeRoID; } + int getHighestCardsValue() const; + void setHighestCardsValue(int theValue); - void run() {} + void setPlayersTurn(int theValue); + int getPlayersTurn() const; + + void setHighestSet(int theValue); + int getHighestSet() const; -protected: + void setFirstRound(bool theValue); + bool getFirstRound() const; - int myBeRoID; + void setSmallBlindPosition(int theValue); + int getSmallBlindPosition() const; + void setSmallBlind(int theValue); + int getSmallBlind() const; + + void resetFirstRun(); + + void nextPlayer(); + void run(); + void postRiverRun(); + +private: + + const GameState myBeRoID; + + mutable boost::recursive_mutex m_syncMutex; + + HandInterface *myHand; + + int highestCardsValue; + int playersTurn; + int highestSet; + bool firstRound; + int smallBlindPosition; + int smallBlind; }; #endif diff --git a/src/engine/network_engine/clientenginefactory.cpp b/src/engine/network_engine/clientenginefactory.cpp index 7f19b2ba..b17025a1 100644 --- a/src/engine/network_engine/clientenginefactory.cpp +++ b/src/engine/network_engine/clientenginefactory.cpp @@ -21,10 +21,7 @@ #include "clienthand.h" #include "clientboard.h" #include "clientplayer.h" -#include "clientpreflop.h" -#include "clientflop.h" -#include "clientturn.h" -#include "clientriver.h" +#include "clientbero.h" @@ -57,15 +54,11 @@ std::vector > ClientEngineFactory::createBeRo(H std::vector > myBeRo; - myBeRo.push_back(boost::shared_ptr(new ClientBeRoPreflop(hi, id, aP, dP, sB))); - - myBeRo.push_back(boost::shared_ptr(new ClientBeRoFlop(hi, id, aP, dP, sB))); - - myBeRo.push_back(boost::shared_ptr(new ClientBeRoTurn(hi, id, aP, dP, sB))); - - myBeRo.push_back(boost::shared_ptr(new ClientBeRoRiver(hi, id, aP, dP, sB))); - -// myBeRo.push_back(boost::shared_ptr(new ClientBeRoPostRiver(hi, id, aP, dP, sB))); + myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, id, aP, dP, sB, GAME_STATE_PREFLOP))); + myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, id, aP, dP, sB, GAME_STATE_FLOP))); + myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, id, aP, dP, sB, GAME_STATE_TURN))); + myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, id, aP, dP, sB, GAME_STATE_RIVER))); + myBeRo.push_back(boost::shared_ptr(new ClientBeRo(hi, id, aP, dP, sB, GAME_STATE_POST_RIVER))); return myBeRo; diff --git a/src/engine/network_engine/clientflop.cpp b/src/engine/network_engine/clientflop.cpp deleted file mode 100644 index 3bd7ec05..00000000 --- a/src/engine/network_engine/clientflop.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Lothar May * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "clientflop.h" -#include -#include - -//using namespace std; - -ClientBeRoFlop::ClientBeRoFlop(HandInterface* bR, int id, int qP, int dP, int sB) -: myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstFlopRun(1), firstFlopRound(1), playersTurn(dP) -{ -} - - -ClientBeRoFlop::~ClientBeRoFlop() -{ -} - -int -ClientBeRoFlop::getMyBeRoID() const -{ - return GAME_STATE_FLOP; -} - -void -ClientBeRoFlop::setPlayersTurn(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - playersTurn = theValue; -} - -int -ClientBeRoFlop::getPlayersTurn() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return playersTurn; -} - -void -ClientBeRoFlop::setHighestSet(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - highestSet = theValue; -} - -int -ClientBeRoFlop::getHighestSet() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return highestSet; -} - -void -ClientBeRoFlop::setFirstFlopRound(bool theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - firstFlopRound = theValue; -} - -bool -ClientBeRoFlop::getFirstFlopRound() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return firstFlopRound; -} - -void -ClientBeRoFlop::setSmallBlindPosition(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - smallBlindPosition = theValue; -} - -int -ClientBeRoFlop::getSmallBlindPosition() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return smallBlindPosition; -} - -void -ClientBeRoFlop::setSmallBlind(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - smallBlind = theValue; -} - -int -ClientBeRoFlop::getSmallBlind() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return smallBlind; -} - -void -ClientBeRoFlop::resetFirstRun() -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - firstFlopRun = false; -} - -void -ClientBeRoFlop::run() -{ -} - diff --git a/src/engine/network_engine/clientflop.h b/src/engine/network_engine/clientflop.h deleted file mode 100644 index e7786cd0..00000000 --- a/src/engine/network_engine/clientflop.h +++ /dev/null @@ -1,84 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Lothar May * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef CLIENTFLOP_H -#define CLIENTFLOP_H - -#include "berointerface.h" -#include - -class HandInterface; - -class ClientBeRoFlop : public BeRoInterface -{ -public: - ClientBeRoFlop(HandInterface*, int, int, int, int); - ~ClientBeRoFlop(); - - int getMyBeRoID() const; - - void setPlayersTurn(int theValue); - int getPlayersTurn() const; - - void setHighestSet(int theValue); - int getHighestSet() const; - - void setFirstFlopRound(bool theValue); - bool getFirstFlopRound() const; - - void setSmallBlindPosition(int theValue); - int getSmallBlindPosition() const; - - void setSmallBlind(int theValue); - int getSmallBlind() const; - - void setHighestCardsValue(int theValue) {} - int getHighestCardsValue() const {return 0;} - - void resetFirstRun(); - - void run(); - - void preflopRun() {} - void flopRun() {} - void turnRun() {} - void riverRun() {} - void postRiverRun() {} - - void nextPlayer() {} - -private: - mutable boost::recursive_mutex m_syncMutex; - - HandInterface *myHand; - - int myID; - int actualQuantityPlayers; - int dealerPosition; - int smallBlindPosition; - - int smallBlind; - int highestSet; - - bool firstFlopRun; - bool firstFlopRound; - int playersTurn; - -}; - -#endif diff --git a/src/engine/network_engine/clientpreflop.cpp b/src/engine/network_engine/clientpreflop.cpp deleted file mode 100644 index 548b28d3..00000000 --- a/src/engine/network_engine/clientpreflop.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Lothar May * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "clientpreflop.h" - -#include -#include - -using namespace std; - -ClientBeRoPreflop::ClientBeRoPreflop(HandInterface* bR, int id, int qP, int dP, int sB) -: myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), bigBlindPosition(0), smallBlind(sB), highestSet(2*sB), preflopFirstRound(1), playersTurn(0) -{ -} - - - -ClientBeRoPreflop::~ClientBeRoPreflop() -{ -} - -int -ClientBeRoPreflop::getMyBeRoID() const -{ - return GAME_STATE_PREFLOP; -} - -void -ClientBeRoPreflop::setPlayersTurn(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - playersTurn = theValue; -} - -int -ClientBeRoPreflop::getPlayersTurn() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return playersTurn; -} - -void -ClientBeRoPreflop::setHighestSet(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - highestSet = theValue; -} - -int -ClientBeRoPreflop::getHighestSet() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return highestSet; -} - -void -ClientBeRoPreflop::resetFirstRun() -{ -} - -void -ClientBeRoPreflop::run() -{ -} - diff --git a/src/engine/network_engine/clientpreflop.h b/src/engine/network_engine/clientpreflop.h deleted file mode 100644 index affbce13..00000000 --- a/src/engine/network_engine/clientpreflop.h +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Lothar May * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef CLIENTPREFLOP_H -#define CLIENTPREFLOP_H - -#include -#include - -class HandInterface; - -class ClientBeRoPreflop : public BeRoInterface{ - -public: - ClientBeRoPreflop(HandInterface*, int, int, int, int); - ~ClientBeRoPreflop(); - - int getMyBeRoID() const; - - void setPlayersTurn(int theValue); - int getPlayersTurn() const; - - void setHighestSet(int theValue); - int getHighestSet() const; - - void setHighestCardsValue(int theValue) {} - int getHighestCardsValue() const {return 0;} - - void resetFirstRun(); - - void run(); - - void preflopRun() {} - void flopRun() {} - void turnRun() {} - void riverRun() {} - void postRiverRun() {} - - void nextPlayer() {} - -private: - mutable boost::recursive_mutex m_syncMutex; - - HandInterface *myHand; - - int myID; - int actualQuantityPlayers; - int dealerPosition; - int bigBlindPosition; - - int smallBlind; - int highestSet; - - bool preflopFirstRound; - int playersTurn; - - -}; - -#endif diff --git a/src/engine/network_engine/clientriver.cpp b/src/engine/network_engine/clientriver.cpp deleted file mode 100644 index d17b8f35..00000000 --- a/src/engine/network_engine/clientriver.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Lothar May * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "clientriver.h" -#include - - -//using namespace std; - -ClientBeRoRiver::ClientBeRoRiver(HandInterface* bR, int id, int qP, int dP, int sB) -: myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstRiverRun(1), firstRiverRound(1), playersTurn(dP), highestCardsValue(0) -{ -} - -ClientBeRoRiver::~ClientBeRoRiver() -{ -} - -int -ClientBeRoRiver::getMyBeRoID() const -{ - return GAME_STATE_RIVER; -} - -void -ClientBeRoRiver::setPlayersTurn(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - playersTurn = theValue; -} - -int -ClientBeRoRiver::getPlayersTurn() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return playersTurn; -} - -void -ClientBeRoRiver::setHighestSet(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - highestSet = theValue; -} - -int -ClientBeRoRiver::getHighestSet() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return highestSet; -} - -void -ClientBeRoRiver::setFirstRiverRound(bool theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - firstRiverRound = theValue; -} - -bool -ClientBeRoRiver::getFirstRiverRound() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return firstRiverRound; -} - -void -ClientBeRoRiver::setSmallBlindPosition(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - smallBlindPosition = theValue; -} - -int -ClientBeRoRiver::getSmallBlindPosition() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return smallBlindPosition; -} - -void -ClientBeRoRiver::setSmallBlind(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - smallBlind = theValue; -} - -int -ClientBeRoRiver::getSmallBlind() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return smallBlind; -} - -void -ClientBeRoRiver::setHighestCardsValue(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - highestCardsValue = theValue; -} - -int -ClientBeRoRiver::getHighestCardsValue() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return highestCardsValue; -} - -void -ClientBeRoRiver::resetFirstRun() -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - firstRiverRun = false; -} - -void -ClientBeRoRiver::distributePot() -{ -} - -void -ClientBeRoRiver::run() -{ -} - diff --git a/src/engine/network_engine/clientriver.h b/src/engine/network_engine/clientriver.h deleted file mode 100644 index 227f12f4..00000000 --- a/src/engine/network_engine/clientriver.h +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Lothar May * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef CLIENTRIVER_H -#define CLIENTRIVER_H - -#include -#include - -class HandInterface; - - -class ClientBeRoRiver : public BeRoInterface{ -public: - ClientBeRoRiver(HandInterface*, int, int, int, int); - ~ClientBeRoRiver(); - - int getMyBeRoID() const; - - void setPlayersTurn(int theValue); - int getPlayersTurn() const; - - void setHighestSet(int theValue); - int getHighestSet() const; - - void setFirstRiverRound(bool theValue); - bool getFirstRiverRound() const; - - void setSmallBlindPosition(int theValue); - int getSmallBlindPosition() const; - - void setSmallBlind(int theValue); - int getSmallBlind() const; - - void setHighestCardsValue(int theValue); - int getHighestCardsValue() const; - - void resetFirstRun(); - - void distributePot(); - - void run(); - - void preflopRun() {} - void flopRun() {} - void turnRun() {} - void riverRun() {} - void postRiverRun() {} - - void nextPlayer() {} - -private: - mutable boost::recursive_mutex m_syncMutex; - - HandInterface *myHand; - - int myID; - int actualQuantityPlayers; - int dealerPosition; - int smallBlindPosition; - - int smallBlind; - int highestSet; - - bool firstRiverRun; - bool firstRiverRound; - int playersTurn; - - int highestCardsValue; - -}; - -#endif - diff --git a/src/engine/network_engine/clientturn.cpp b/src/engine/network_engine/clientturn.cpp deleted file mode 100644 index b1dcb92e..00000000 --- a/src/engine/network_engine/clientturn.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Lothar May * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include "clientturn.h" -#include -#include - -//using namespace std; - -ClientBeRoTurn::ClientBeRoTurn(HandInterface* bR, int id, int qP, int dP, int sB) -: myHand(bR), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), smallBlindPosition(0), smallBlind(sB), highestSet(0), firstTurnRun(1), firstTurnRound(1), playersTurn(dP) -{ -} - -ClientBeRoTurn::~ClientBeRoTurn() -{ -} - -int -ClientBeRoTurn::getMyBeRoID() const -{ - return GAME_STATE_TURN; -} - -void -ClientBeRoTurn::setPlayersTurn(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - playersTurn = theValue; -} - -int -ClientBeRoTurn::getPlayersTurn() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return playersTurn; -} - -void -ClientBeRoTurn::setHighestSet(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - highestSet = theValue; -} - -int -ClientBeRoTurn::getHighestSet() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return highestSet; -} - -void -ClientBeRoTurn::setFirstTurnRound(bool theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - firstTurnRound = theValue; -} - -bool -ClientBeRoTurn::getFirstTurnRound() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return firstTurnRound; -} - -void -ClientBeRoTurn::setSmallBlindPosition(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - smallBlindPosition = theValue; -} - -int -ClientBeRoTurn::getSmallBlindPosition() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return smallBlindPosition; -} - -void -ClientBeRoTurn::setSmallBlind(int theValue) -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - smallBlind = theValue; -} - -int -ClientBeRoTurn::getSmallBlind() const -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - return smallBlind; -} - -void -ClientBeRoTurn::resetFirstRun() -{ - boost::recursive_mutex::scoped_lock lock(m_syncMutex); - firstTurnRun = false; -} - -void -ClientBeRoTurn::run() -{ -} - diff --git a/src/engine/network_engine/clientturn.h b/src/engine/network_engine/clientturn.h deleted file mode 100644 index f34c315c..00000000 --- a/src/engine/network_engine/clientturn.h +++ /dev/null @@ -1,83 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2007 by Lothar May * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef CLIENTTURN_H -#define CLIENTTURN_H - -#include -#include - -class HandInterface; - -class ClientBeRoTurn : public BeRoInterface{ -public: - ClientBeRoTurn(HandInterface*, int, int, int, int); - ~ClientBeRoTurn(); - - int getMyBeRoID() const; - - void setPlayersTurn(int theValue); - int getPlayersTurn() const; - - void setHighestSet(int theValue); - int getHighestSet() const; - - void setFirstTurnRound(bool theValue); - bool getFirstTurnRound() const; - - void setSmallBlindPosition(int theValue); - int getSmallBlindPosition() const; - - void setSmallBlind(int theValue); - int getSmallBlind() const; - - void setHighestCardsValue(int theValue) {} - int getHighestCardsValue() const {return 0;} - - void resetFirstRun(); - - void run(); - - void preflopRun() {} - void flopRun() {} - void turnRun() {} - void riverRun() {} - void postRiverRun() {} - - void nextPlayer() {} - -private: - mutable boost::recursive_mutex m_syncMutex; - - HandInterface *myHand; - - int myID; - int actualQuantityPlayers; - int dealerPosition; - int smallBlindPosition; - - int smallBlind; - int highestSet; - - bool firstTurnRun; - bool firstTurnRound; - int playersTurn; - -}; - -#endif diff --git a/src/net/common/serverrecvstate.cpp b/src/net/common/serverrecvstate.cpp index cd0d469b..7d061e29 100644 --- a/src/net/common/serverrecvstate.cpp +++ b/src/net/common/serverrecvstate.cpp @@ -340,7 +340,7 @@ ServerRecvStateInit::InternalProcess(ServerRecvThread &server, SessionWrapper se } else if (packet->ToNetPacketStartEvent()) { - boost::shared_ptr tmpPlayerData( + /*boost::shared_ptr tmpPlayerData( new PlayerData(m_curUniquePlayerId++, 0, PLAYER_TYPE_COMPUTER, PLAYER_RIGHTS_NORMAL)); tmpPlayerData->SetName("Computer"); @@ -354,7 +354,7 @@ ServerRecvStateInit::InternalProcess(ServerRecvThread &server, SessionWrapper se static_cast(thisPlayerJoined.get())->SetData(thisPlayerJoinedData); server.SendToAllPlayers(thisPlayerJoined); - server.AddComputerPlayer(tmpPlayerData); + server.AddComputerPlayer(tmpPlayerData);*/ server.InternalStartGame(); server.SetState(SERVER_START_GAME_STATE::Instance()); @@ -557,7 +557,7 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server) int curRound = curGame.getCurrentHand()->getActualRound(); curGame.getCurrentHand()->switchRounds(); if (!curGame.getCurrentHand()->getAllInCondition()) - GameRun(curGame); + curGame.getCurrentHand()->getCurrentBeRo()->run(); int newRound = curGame.getCurrentHand()->getActualRound(); // If round changes, deal cards if needed. @@ -714,33 +714,6 @@ ServerRecvStateStartRound::Process(ServerRecvThread &server) return retVal; } -void -ServerRecvStateStartRound::GameRun(Game &curGame) -{ - // TODO: no switch needed here if game states are polymorphic - switch(curGame.getCurrentHand()->getActualRound()) { - case GAME_STATE_PREFLOP: { - // Preflop starten - curGame.getCurrentHand()->getPreflop()->preflopRun(); - } break; - case GAME_STATE_FLOP: { - // Flop starten - curGame.getCurrentHand()->getFlop()->flopRun(); - } break; - case GAME_STATE_TURN: { - // Turn starten - curGame.getCurrentHand()->getTurn()->turnRun(); - } break; - case GAME_STATE_RIVER: { - // River starten - curGame.getCurrentHand()->getRiver()->riverRun(); - } break; - default: { - // - } - } -} - std::list ServerRecvStateStartRound::GetActivePlayers(Game &curGame) { diff --git a/src/net/serverrecvstate.h b/src/net/serverrecvstate.h index 8d064c19..d4391923 100644 --- a/src/net/serverrecvstate.h +++ b/src/net/serverrecvstate.h @@ -184,7 +184,6 @@ protected: // Protected constructor - this is a singleton. ServerRecvStateStartRound(); - static void GameRun(Game &curGame); static std::list GetActivePlayers(Game &curGame); };