1 /***************************************************************************** 2 * PokerTH - The open source texas holdem engine * 3 * Copyright (C) 2006-2012 Felix Hammer, Florian Thauer, Lothar May * 4 * * 5 * This program is free software: you can redistribute it and/or modify * 6 * it under the terms of the GNU Affero General Public License as * 7 * published by the Free Software Foundation, either version 3 of the * 8 * License, or (at your option) any later version. * 9 * * 10 * This program is distributed in the hope that it will be useful, * 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 * GNU Affero General Public License for more details. * 14 * * 15 * You should have received a copy of the GNU Affero General Public License * 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 17 * * 18 * * 19 * Additional permission under GNU AGPL version 3 section 7 * 20 * * 21 * If you modify this program, or any covered work, by linking or * 22 * combining it with the OpenSSL project's OpenSSL library (or a * 23 * modified version of that library), containing parts covered by the * 24 * terms of the OpenSSL or SSLeay licenses, the authors of PokerTH * 25 * (Felix Hammer, Florian Thauer, Lothar May) grant you additional * 26 * permission to convey the resulting work. * 27 * Corresponding Source for a non-source form of such a combination * 28 * shall include the source code for the parts of OpenSSL used as well * 29 * as that of the covered work. * 30 *****************************************************************************/ 31 32 #ifndef CLIENTHAND_H 33 #define CLIENTHAND_H 34 35 #include <enginefactory.h> 36 #include <guiinterface.h> 37 #include <boardinterface.h> 38 #include <playerinterface.h> 39 #include <handinterface.h> 40 #include <berointerface.h> 41 #include <log.h> 42 #include <boost/thread.hpp> 43 44 #include <vector> 45 46 class ClientHand : public HandInterface 47 { 48 public: 49 ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, boost::shared_ptr<BoardInterface>, Log*, PlayerList, PlayerList, PlayerList , int, int, int, int, int ); 50 ~ClientHand(); 51 52 void start(); 53 54 PlayerList getSeatsList() const; 55 PlayerList getActivePlayerList() const; 56 PlayerList getRunningPlayerList() const; 57 58 boost::shared_ptr<BoardInterface> getBoard() const; 59 boost::shared_ptr<BeRoInterface> getPreflop() const; 60 boost::shared_ptr<BeRoInterface> getFlop() const; 61 boost::shared_ptr<BeRoInterface> getTurn() const; 62 boost::shared_ptr<BeRoInterface> getRiver() const; 63 GuiInterface* getGuiInterface() const; 64 boost::shared_ptr<BeRoInterface> getCurrentBeRo() const; 65 getLog()66 Log* getLog() const 67 { 68 return myLog; 69 } 70 71 void setMyID ( int theValue ); 72 int getMyID() const; 73 74 void setCurrentQuantityPlayers ( int theValue ); 75 int getCurrentQuantityPlayers() const; 76 77 void setStartQuantityPlayers ( int theValue ); 78 int getStartQuantityPlayers() const; 79 80 void setCurrentRound ( GameState theValue ); 81 GameState getCurrentRound() const; 82 GameState getRoundBeforePostRiver() const; 83 84 void setDealerPosition ( int theValue ); 85 int getDealerPosition() const; 86 87 void setSmallBlind ( int theValue ); 88 int getSmallBlind() const; 89 90 void setAllInCondition ( bool theValue ); 91 bool getAllInCondition() const; 92 93 void setStartCash ( int theValue ); 94 int getStartCash() const; 95 96 void setBettingRoundsPlayed ( int theValue ); 97 int getBettingRoundsPlayed() const; 98 99 void setPreviousPlayerID ( int theValue ); 100 int getPreviousPlayerID() const; 101 102 void setLastActionPlayerID ( unsigned theValue ); 103 unsigned getLastActionPlayerID() const; 104 105 void setCardsShown ( bool theValue ); 106 bool getCardsShown() const; 107 108 void switchRounds(); 109 110 protected: 111 PlayerListIterator getSeatIt(unsigned) const; 112 PlayerListIterator getActivePlayerIt(unsigned) const; 113 PlayerListIterator getRunningPlayerIt(unsigned) const; 114 115 116 private: 117 mutable boost::recursive_mutex m_syncMutex; 118 119 boost::shared_ptr<EngineFactory> myFactory; 120 GuiInterface *myGui; 121 boost::shared_ptr<BoardInterface> myBoard; 122 Log *myLog; 123 124 PlayerList seatsList; 125 PlayerList activePlayerList; 126 PlayerList runningPlayerList; 127 128 std::vector<boost::shared_ptr<BeRoInterface> > myBeRo; 129 130 int myID; 131 int startQuantityPlayers; 132 unsigned dealerPosition; 133 GameState currentRound; 134 GameState roundBeforePostRiver; 135 int smallBlind; 136 int startCash; 137 138 int previousPlayerID; 139 unsigned lastActionPlayerID; 140 141 bool allInCondition; 142 bool cardsShown; 143 }; 144 145 #endif 146 147 148