Use unix linefeeds for all files. Finally. It's about time.

This commit is contained in:
lotodore
2007-11-16 15:24:25 +00:00
parent f428fb7904
commit a24a93caba
83 changed files with 18044 additions and 18044 deletions
+37 -37
View File
@@ -1,37 +1,37 @@
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* 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 _ENGINE_MSG_H_
#define _ENGINE_MSG_H_
// Engine errors -> LocalExceptions
#define ERR_SEAT_NOT_FOUND 10001
#define ERR_ACTIVE_PLAYER_NOT_FOUND 10002
#define ERR_RUNNING_PLAYER_NOT_FOUND 10003
#define ERR_DEALER_NOT_FOUND 10004
#define ERR_CURRENT_PLAYER_NOT_FOUND 10005
#define ERR_NEXT_DEALER_NOT_FOUND 10010
#define ERR_NEXT_ACTIVE_PLAYER_NOT_FOUND 10011
#define ERR_FORMER_RUNNING_PLAYER_NOT_FOUND 10012
#define ERR_NO_WINNER 10020
#endif
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* 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 _ENGINE_MSG_H_
#define _ENGINE_MSG_H_
// Engine errors -> LocalExceptions
#define ERR_SEAT_NOT_FOUND 10001
#define ERR_ACTIVE_PLAYER_NOT_FOUND 10002
#define ERR_RUNNING_PLAYER_NOT_FOUND 10003
#define ERR_DEALER_NOT_FOUND 10004
#define ERR_CURRENT_PLAYER_NOT_FOUND 10005
#define ERR_NEXT_DEALER_NOT_FOUND 10010
#define ERR_NEXT_ACTIVE_PLAYER_NOT_FOUND 10011
#define ERR_FORMER_RUNNING_PLAYER_NOT_FOUND 10012
#define ERR_NO_WINNER 10020
#endif
+134 -134
View File
@@ -1,134 +1,134 @@
/***************************************************************************
* 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 "clientboard.h"
#include <handinterface.h>
#include <game_defs.h>
using namespace std;
ClientBoard::ClientBoard()
: currentHand(0), pot(0), sets(0)
{
}
ClientBoard::~ClientBoard()
{
}
void
ClientBoard::setPlayerLists(PlayerList sl, PlayerList apl, PlayerList rpl)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
seatsList = sl;
activePlayerList = apl;
runningPlayerList = rpl;
}
void
ClientBoard::setHand(HandInterface* br)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
currentHand = br;
}
void
ClientBoard::setMyCards(int* theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
for (int i = 0; i < 5; i++)
myCards[i] = theValue[i];
}
void
ClientBoard::getMyCards(int* theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
for (int i = 0; i < 5; i++)
theValue[i] = myCards[i];
}
int
ClientBoard::getPot() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return pot;
}
void
ClientBoard::setPot(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
pot = theValue;
}
int
ClientBoard::getSets() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return sets;
}
void
ClientBoard::setSets(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
sets = theValue;
}
void
ClientBoard::collectSets()
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
sets = 0;
PlayerListConstIterator it_c;
for (it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++)
sets += (*it_c)->getMySet();
}
void
ClientBoard::collectPot()
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
pot += sets;
sets = 0;
}
void
ClientBoard::distributePot()
{
}
std::list<unsigned>
ClientBoard::getWinners() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return winners;
}
void
ClientBoard::setWinners(const std::list<unsigned> &w)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
winners = w;
}
/***************************************************************************
* 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 "clientboard.h"
#include <handinterface.h>
#include <game_defs.h>
using namespace std;
ClientBoard::ClientBoard()
: currentHand(0), pot(0), sets(0)
{
}
ClientBoard::~ClientBoard()
{
}
void
ClientBoard::setPlayerLists(PlayerList sl, PlayerList apl, PlayerList rpl)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
seatsList = sl;
activePlayerList = apl;
runningPlayerList = rpl;
}
void
ClientBoard::setHand(HandInterface* br)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
currentHand = br;
}
void
ClientBoard::setMyCards(int* theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
for (int i = 0; i < 5; i++)
myCards[i] = theValue[i];
}
void
ClientBoard::getMyCards(int* theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
for (int i = 0; i < 5; i++)
theValue[i] = myCards[i];
}
int
ClientBoard::getPot() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return pot;
}
void
ClientBoard::setPot(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
pot = theValue;
}
int
ClientBoard::getSets() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return sets;
}
void
ClientBoard::setSets(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
sets = theValue;
}
void
ClientBoard::collectSets()
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
sets = 0;
PlayerListConstIterator it_c;
for (it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++)
sets += (*it_c)->getMySet();
}
void
ClientBoard::collectPot()
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
pot += sets;
sets = 0;
}
void
ClientBoard::distributePot()
{
}
std::list<unsigned>
ClientBoard::getWinners() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return winners;
}
void
ClientBoard::setWinners(const std::list<unsigned> &w)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
winners = w;
}
+72 -72
View File
@@ -1,72 +1,72 @@
/***************************************************************************
* 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 CLIENTBOARD_H
#define CLIENTBOARD_H
#include <boardinterface.h>
#include <boost/thread.hpp>
#include <vector>
class PlayerInterface;
class HandInterface;
class ClientBoard : public BoardInterface
{
public:
ClientBoard();
~ClientBoard();
void setPlayerLists(PlayerList, PlayerList, PlayerList);
void setHand(HandInterface*);
void setMyCards(int* theValue);
void getMyCards(int* theValue);
int getPot() const;
void setPot(int theValue);
int getSets() const;
void setSets(int theValue);
void collectSets();
void collectPot();
void distributePot();
std::list<unsigned> getWinners() const;
void setWinners(const std::list<unsigned> &winners);
private:
mutable boost::recursive_mutex m_syncMutex;
PlayerList seatsList;
PlayerList activePlayerList;
PlayerList runningPlayerList;
HandInterface *currentHand;
std::list<unsigned> winners;
int myCards[5];
int pot;
int sets;
};
#endif
/***************************************************************************
* 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 CLIENTBOARD_H
#define CLIENTBOARD_H
#include <boardinterface.h>
#include <boost/thread.hpp>
#include <vector>
class PlayerInterface;
class HandInterface;
class ClientBoard : public BoardInterface
{
public:
ClientBoard();
~ClientBoard();
void setPlayerLists(PlayerList, PlayerList, PlayerList);
void setHand(HandInterface*);
void setMyCards(int* theValue);
void getMyCards(int* theValue);
int getPot() const;
void setPot(int theValue);
int getSets() const;
void setSets(int theValue);
void collectSets();
void collectPot();
void distributePot();
std::list<unsigned> getWinners() const;
void setWinners(const std::list<unsigned> &winners);
private:
mutable boost::recursive_mutex m_syncMutex;
PlayerList seatsList;
PlayerList activePlayerList;
PlayerList runningPlayerList;
HandInterface *currentHand;
std::list<unsigned> winners;
int myCards[5];
int pot;
int sets;
};
#endif
@@ -1,66 +1,66 @@
/***************************************************************************
* 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 "clientenginefactory.h"
#include "clienthand.h"
#include "clientboard.h"
#include "clientplayer.h"
#include "clientbero.h"
ClientEngineFactory::ClientEngineFactory()
{
}
ClientEngineFactory::~ClientEngineFactory()
{
}
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
{
return new ClientHand(f, g, b, sl, apl, rpl, id, sP, dP, sB, sC);
}
BoardInterface* ClientEngineFactory::createBoard()
{
return new ClientBoard;
}
boost::shared_ptr<PlayerInterface> 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<PlayerInterface> (new ClientPlayer(NULL, b, id, uniqueId, type, name, avatar, sC, aS, mB));
}
std::vector<boost::shared_ptr<BeRoInterface> > ClientEngineFactory::createBeRo(HandInterface* hi, int id, unsigned dP, int sB) {
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, dP, sB, GAME_STATE_PREFLOP)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, dP, sB, GAME_STATE_FLOP)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, dP, sB, GAME_STATE_TURN)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, dP, sB, GAME_STATE_RIVER)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, dP, sB, GAME_STATE_POST_RIVER)));
return myBeRo;
}
/***************************************************************************
* 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 "clientenginefactory.h"
#include "clienthand.h"
#include "clientboard.h"
#include "clientplayer.h"
#include "clientbero.h"
ClientEngineFactory::ClientEngineFactory()
{
}
ClientEngineFactory::~ClientEngineFactory()
{
}
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
{
return new ClientHand(f, g, b, sl, apl, rpl, id, sP, dP, sB, sC);
}
BoardInterface* ClientEngineFactory::createBoard()
{
return new ClientBoard;
}
boost::shared_ptr<PlayerInterface> 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<PlayerInterface> (new ClientPlayer(NULL, b, id, uniqueId, type, name, avatar, sC, aS, mB));
}
std::vector<boost::shared_ptr<BeRoInterface> > ClientEngineFactory::createBeRo(HandInterface* hi, int id, unsigned dP, int sB) {
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, dP, sB, GAME_STATE_PREFLOP)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, dP, sB, GAME_STATE_FLOP)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, dP, sB, GAME_STATE_TURN)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, dP, sB, GAME_STATE_RIVER)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, dP, sB, GAME_STATE_POST_RIVER)));
return myBeRo;
}
+47 -47
View File
@@ -1,47 +1,47 @@
/***************************************************************************
* 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 CLIENTENGINEFACTORY_H
#define CLIENTENGINEFACTORY_H
#include <enginefactory.h>
#include <handinterface.h>
#include <boardinterface.h>
#include <playerinterface.h>
#include <boost/shared_ptr.hpp>
#include <vector>
class ConfigFile;
class ClientEngineFactory : public EngineFactory
{
public:
ClientEngineFactory();
~ClientEngineFactory();
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
BoardInterface* createBoard();
boost::shared_ptr<PlayerInterface> createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, unsigned dP, int sB);
};
#endif
/***************************************************************************
* 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 CLIENTENGINEFACTORY_H
#define CLIENTENGINEFACTORY_H
#include <enginefactory.h>
#include <handinterface.h>
#include <boardinterface.h>
#include <playerinterface.h>
#include <boost/shared_ptr.hpp>
#include <vector>
class ConfigFile;
class ClientEngineFactory : public EngineFactory
{
public:
ClientEngineFactory();
~ClientEngineFactory();
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
BoardInterface* createBoard();
boost::shared_ptr<PlayerInterface> createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, unsigned dP, int sB);
};
#endif
+337 -337
View File
@@ -1,337 +1,337 @@
/***************************************************************************
* 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 "clienthand.h"
#include <game_defs.h>
using namespace std;
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
: myFactory(f), myGui(g), myBoard(b), 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)
{
PlayerListIterator it;
myBoard->setHand(this);
for(it=seatsList->begin(); it!=seatsList->end(); it++) {
(*it)->setHand(this);
// myFlipCards auf 0 setzen
(*it)->setMyCardsFlip(0, 0);
}
// roundStartCashArray fuellen
// cardsvalue zuruecksetzen
// remove all buttons
for(it=activePlayerList->begin(); it!=activePlayerList->end(); it++) {
boost::shared_ptr<PlayerInterface> tmpPlayer = *it;
tmpPlayer->setMyRoundStartCash(tmpPlayer->getMyCash());
tmpPlayer->setMyCardsValueInt(0);
tmpPlayer->setMyButton(0);
if (tmpPlayer->getMyUniqueID() == dealerPosition)
tmpPlayer->setMyButton(1);
}
// the rest of the buttons are assigned later as received from the server.
// Preflop, Flop, Turn und River erstellen
myBeRo = myFactory->createBeRo(this, myID, dealerPosition, smallBlind);
}
ClientHand::~ClientHand()
{
}
void
ClientHand::start()
{
}
PlayerList
ClientHand::getSeatsList() const
{
return seatsList;
}
PlayerList
ClientHand::getActivePlayerList() const
{
return activePlayerList;
}
PlayerList
ClientHand::getRunningPlayerList() const
{
return runningPlayerList;
}
PlayerListIterator
ClientHand::getSeatIt(unsigned uniqueId) const
{
PlayerListIterator it;
for(it=seatsList->begin(); it!=seatsList->end(); it++) {
if((*it)->getMyUniqueID() == uniqueId) {
break;
}
}
return it;
}
PlayerListIterator
ClientHand::getActivePlayerIt(unsigned uniqueId) const
{
PlayerListIterator it;
for(it=activePlayerList->begin(); it!=activePlayerList->end(); it++) {
if((*it)->getMyUniqueID() == uniqueId) {
break;
}
}
return it;
}
PlayerListIterator
ClientHand::getRunningPlayerIt(unsigned uniqueId) const
{
PlayerListIterator it;
for(it=runningPlayerList->begin(); it!=runningPlayerList->end(); it++) {
if((*it)->getMyUniqueID() == uniqueId) {
break;
}
}
return it;
}
BoardInterface*
ClientHand::getBoard() const
{
return myBoard;
}
boost::shared_ptr<BeRoInterface>
ClientHand::getPreflop() const
{
return myBeRo[GAME_STATE_PREFLOP];
}
boost::shared_ptr<BeRoInterface>
ClientHand::getFlop() const
{
return myBeRo[GAME_STATE_FLOP];
}
boost::shared_ptr<BeRoInterface>
ClientHand::getTurn() const
{
return myBeRo[GAME_STATE_TURN];
}
boost::shared_ptr<BeRoInterface>
ClientHand::getRiver() const
{
return myBeRo[GAME_STATE_RIVER];
}
boost::shared_ptr<BeRoInterface>
ClientHand::getCurrentBeRo() const
{
return myBeRo[currentRound];
}
GuiInterface*
ClientHand::getGuiInterface() const
{
return myGui;
}
void
ClientHand::setMyID(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
myID = theValue;
}
int
ClientHand::getMyID() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return myID;
}
void
ClientHand::setStartQuantityPlayers(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
startQuantityPlayers = theValue;
}
int
ClientHand::getStartQuantityPlayers() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return startQuantityPlayers;
}
void
ClientHand::setCurrentRound(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
currentRound = theValue;
}
int
ClientHand::getCurrentRound() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return currentRound;
}
void
ClientHand::setDealerPosition(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
dealerPosition = theValue;
}
int
ClientHand::getDealerPosition() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return dealerPosition;
}
void
ClientHand::setSmallBlind(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
smallBlind = theValue;
}
int
ClientHand::getSmallBlind() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return smallBlind;
}
void
ClientHand::setAllInCondition(bool theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
allInCondition = theValue;
}
bool
ClientHand::getAllInCondition() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return allInCondition;
}
void
ClientHand::setStartCash(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
startCash = theValue;
}
int
ClientHand::getStartCash() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return startCash;
}
void
ClientHand::setBettingRoundsPlayed(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
bettingRoundsPlayed = theValue;
}
int
ClientHand::getBettingRoundsPlayed() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return bettingRoundsPlayed;
}
void
ClientHand::setLastPlayersTurn(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
lastPlayersTurn = theValue;
}
int
ClientHand::getLastPlayersTurn() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return lastPlayersTurn;
}
void
ClientHand::setCardsShown(bool theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
cardsShown = theValue;
}
bool
ClientHand::getCardsShown() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return cardsShown;
}
void
ClientHand::switchRounds()
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
PlayerListIterator it, it_1;
// refresh runningPlayerList
for(it=runningPlayerList->begin(); it!=runningPlayerList->end(); ) {
if((*it)->getMyAction() == PLAYER_ACTION_FOLD || (*it)->getMyAction() == PLAYER_ACTION_ALLIN) {
it = runningPlayerList->erase(it);
if(!(runningPlayerList->empty())) {
it_1 = it;
if(it_1 == runningPlayerList->begin()) it_1 = runningPlayerList->end();
it_1--;
getCurrentBeRo()->setCurrentPlayersTurnId((*it_1)->getMyUniqueID());
}
} else {
it++;
}
}
}
/***************************************************************************
* 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 "clienthand.h"
#include <game_defs.h>
using namespace std;
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
: myFactory(f), myGui(g), myBoard(b), 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)
{
PlayerListIterator it;
myBoard->setHand(this);
for(it=seatsList->begin(); it!=seatsList->end(); it++) {
(*it)->setHand(this);
// myFlipCards auf 0 setzen
(*it)->setMyCardsFlip(0, 0);
}
// roundStartCashArray fuellen
// cardsvalue zuruecksetzen
// remove all buttons
for(it=activePlayerList->begin(); it!=activePlayerList->end(); it++) {
boost::shared_ptr<PlayerInterface> tmpPlayer = *it;
tmpPlayer->setMyRoundStartCash(tmpPlayer->getMyCash());
tmpPlayer->setMyCardsValueInt(0);
tmpPlayer->setMyButton(0);
if (tmpPlayer->getMyUniqueID() == dealerPosition)
tmpPlayer->setMyButton(1);
}
// the rest of the buttons are assigned later as received from the server.
// Preflop, Flop, Turn und River erstellen
myBeRo = myFactory->createBeRo(this, myID, dealerPosition, smallBlind);
}
ClientHand::~ClientHand()
{
}
void
ClientHand::start()
{
}
PlayerList
ClientHand::getSeatsList() const
{
return seatsList;
}
PlayerList
ClientHand::getActivePlayerList() const
{
return activePlayerList;
}
PlayerList
ClientHand::getRunningPlayerList() const
{
return runningPlayerList;
}
PlayerListIterator
ClientHand::getSeatIt(unsigned uniqueId) const
{
PlayerListIterator it;
for(it=seatsList->begin(); it!=seatsList->end(); it++) {
if((*it)->getMyUniqueID() == uniqueId) {
break;
}
}
return it;
}
PlayerListIterator
ClientHand::getActivePlayerIt(unsigned uniqueId) const
{
PlayerListIterator it;
for(it=activePlayerList->begin(); it!=activePlayerList->end(); it++) {
if((*it)->getMyUniqueID() == uniqueId) {
break;
}
}
return it;
}
PlayerListIterator
ClientHand::getRunningPlayerIt(unsigned uniqueId) const
{
PlayerListIterator it;
for(it=runningPlayerList->begin(); it!=runningPlayerList->end(); it++) {
if((*it)->getMyUniqueID() == uniqueId) {
break;
}
}
return it;
}
BoardInterface*
ClientHand::getBoard() const
{
return myBoard;
}
boost::shared_ptr<BeRoInterface>
ClientHand::getPreflop() const
{
return myBeRo[GAME_STATE_PREFLOP];
}
boost::shared_ptr<BeRoInterface>
ClientHand::getFlop() const
{
return myBeRo[GAME_STATE_FLOP];
}
boost::shared_ptr<BeRoInterface>
ClientHand::getTurn() const
{
return myBeRo[GAME_STATE_TURN];
}
boost::shared_ptr<BeRoInterface>
ClientHand::getRiver() const
{
return myBeRo[GAME_STATE_RIVER];
}
boost::shared_ptr<BeRoInterface>
ClientHand::getCurrentBeRo() const
{
return myBeRo[currentRound];
}
GuiInterface*
ClientHand::getGuiInterface() const
{
return myGui;
}
void
ClientHand::setMyID(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
myID = theValue;
}
int
ClientHand::getMyID() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return myID;
}
void
ClientHand::setStartQuantityPlayers(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
startQuantityPlayers = theValue;
}
int
ClientHand::getStartQuantityPlayers() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return startQuantityPlayers;
}
void
ClientHand::setCurrentRound(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
currentRound = theValue;
}
int
ClientHand::getCurrentRound() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return currentRound;
}
void
ClientHand::setDealerPosition(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
dealerPosition = theValue;
}
int
ClientHand::getDealerPosition() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return dealerPosition;
}
void
ClientHand::setSmallBlind(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
smallBlind = theValue;
}
int
ClientHand::getSmallBlind() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return smallBlind;
}
void
ClientHand::setAllInCondition(bool theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
allInCondition = theValue;
}
bool
ClientHand::getAllInCondition() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return allInCondition;
}
void
ClientHand::setStartCash(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
startCash = theValue;
}
int
ClientHand::getStartCash() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return startCash;
}
void
ClientHand::setBettingRoundsPlayed(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
bettingRoundsPlayed = theValue;
}
int
ClientHand::getBettingRoundsPlayed() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return bettingRoundsPlayed;
}
void
ClientHand::setLastPlayersTurn(int theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
lastPlayersTurn = theValue;
}
int
ClientHand::getLastPlayersTurn() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return lastPlayersTurn;
}
void
ClientHand::setCardsShown(bool theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
cardsShown = theValue;
}
bool
ClientHand::getCardsShown() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return cardsShown;
}
void
ClientHand::switchRounds()
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
PlayerListIterator it, it_1;
// refresh runningPlayerList
for(it=runningPlayerList->begin(); it!=runningPlayerList->end(); ) {
if((*it)->getMyAction() == PLAYER_ACTION_FOLD || (*it)->getMyAction() == PLAYER_ACTION_ALLIN) {
it = runningPlayerList->erase(it);
if(!(runningPlayerList->empty())) {
it_1 = it;
if(it_1 == runningPlayerList->begin()) it_1 = runningPlayerList->end();
it_1--;
getCurrentBeRo()->setCurrentPlayersTurnId((*it_1)->getMyUniqueID());
}
} else {
it++;
}
}
}
+123 -123
View File
@@ -1,123 +1,123 @@
/***************************************************************************
* 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 CLIENTHAND_H
#define CLIENTHAND_H
#include <enginefactory.h>
#include <guiinterface.h>
#include <boardinterface.h>
#include <playerinterface.h>
#include <handinterface.h>
#include <berointerface.h>
#include <boost/thread.hpp>
#include <vector>
class ClientHand : public HandInterface
{
public:
ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, PlayerList, PlayerList, PlayerList , int, int, int, int, int );
~ClientHand();
void start();
PlayerList getSeatsList() const;
PlayerList getActivePlayerList() const;
PlayerList getRunningPlayerList() const;
PlayerListIterator getSeatIt(unsigned) const;
PlayerListIterator getActivePlayerIt(unsigned) const;
PlayerListIterator getRunningPlayerIt(unsigned) const;
BoardInterface* getBoard() const;
boost::shared_ptr<BeRoInterface> getPreflop() const;
boost::shared_ptr<BeRoInterface> getFlop() const;
boost::shared_ptr<BeRoInterface> getTurn() const;
boost::shared_ptr<BeRoInterface> getRiver() const;
GuiInterface* getGuiInterface() const;
boost::shared_ptr<BeRoInterface> getCurrentBeRo() const;
void setMyID ( int theValue );
int getMyID() const;
void setCurrentQuantityPlayers ( int theValue );
int getCurrentQuantityPlayers() const;
void setStartQuantityPlayers ( int theValue );
int getStartQuantityPlayers() const;
void setCurrentRound ( int theValue );
int getCurrentRound() const;
void setDealerPosition ( int theValue );
int getDealerPosition() const;
void setSmallBlind ( int theValue );
int getSmallBlind() const;
void setAllInCondition ( bool theValue );
bool getAllInCondition() const;
void setStartCash ( int theValue );
int getStartCash() const;
void setBettingRoundsPlayed ( int theValue );
int getBettingRoundsPlayed() const;
void setLastPlayersTurn ( int theValue );
int getLastPlayersTurn() const;
void setCardsShown ( bool theValue );
bool getCardsShown() const;
void switchRounds();
private:
mutable boost::recursive_mutex m_syncMutex;
boost::shared_ptr<EngineFactory> myFactory;
GuiInterface *myGui;
BoardInterface *myBoard;
PlayerList seatsList;
PlayerList activePlayerList;
PlayerList runningPlayerList;
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
int myID;
int startQuantityPlayers;
unsigned dealerPosition;
int currentRound; //0 = preflop, 1 = flop, 2 = turn, 3 = river
int smallBlind;
int startCash;
int lastPlayersTurn;
bool allInCondition;
bool cardsShown;
// hier steht bis zu welcher bettingRound der human player gespielt hat: 0 - nur Preflop, 1 - bis Flop, ...
int bettingRoundsPlayed;
};
#endif
/***************************************************************************
* 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 CLIENTHAND_H
#define CLIENTHAND_H
#include <enginefactory.h>
#include <guiinterface.h>
#include <boardinterface.h>
#include <playerinterface.h>
#include <handinterface.h>
#include <berointerface.h>
#include <boost/thread.hpp>
#include <vector>
class ClientHand : public HandInterface
{
public:
ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, PlayerList, PlayerList, PlayerList , int, int, int, int, int );
~ClientHand();
void start();
PlayerList getSeatsList() const;
PlayerList getActivePlayerList() const;
PlayerList getRunningPlayerList() const;
PlayerListIterator getSeatIt(unsigned) const;
PlayerListIterator getActivePlayerIt(unsigned) const;
PlayerListIterator getRunningPlayerIt(unsigned) const;
BoardInterface* getBoard() const;
boost::shared_ptr<BeRoInterface> getPreflop() const;
boost::shared_ptr<BeRoInterface> getFlop() const;
boost::shared_ptr<BeRoInterface> getTurn() const;
boost::shared_ptr<BeRoInterface> getRiver() const;
GuiInterface* getGuiInterface() const;
boost::shared_ptr<BeRoInterface> getCurrentBeRo() const;
void setMyID ( int theValue );
int getMyID() const;
void setCurrentQuantityPlayers ( int theValue );
int getCurrentQuantityPlayers() const;
void setStartQuantityPlayers ( int theValue );
int getStartQuantityPlayers() const;
void setCurrentRound ( int theValue );
int getCurrentRound() const;
void setDealerPosition ( int theValue );
int getDealerPosition() const;
void setSmallBlind ( int theValue );
int getSmallBlind() const;
void setAllInCondition ( bool theValue );
bool getAllInCondition() const;
void setStartCash ( int theValue );
int getStartCash() const;
void setBettingRoundsPlayed ( int theValue );
int getBettingRoundsPlayed() const;
void setLastPlayersTurn ( int theValue );
int getLastPlayersTurn() const;
void setCardsShown ( bool theValue );
bool getCardsShown() const;
void switchRounds();
private:
mutable boost::recursive_mutex m_syncMutex;
boost::shared_ptr<EngineFactory> myFactory;
GuiInterface *myGui;
BoardInterface *myBoard;
PlayerList seatsList;
PlayerList activePlayerList;
PlayerList runningPlayerList;
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
int myID;
int startQuantityPlayers;
unsigned dealerPosition;
int currentRound; //0 = preflop, 1 = flop, 2 = turn, 3 = river
int smallBlind;
int startCash;
int lastPlayersTurn;
bool allInCondition;
bool cardsShown;
// hier steht bis zu welcher bettingRound der human player gespielt hat: 0 - nur Preflop, 1 - bis Flop, ...
int bettingRoundsPlayed;
};
#endif
File diff suppressed because it is too large Load Diff
+182 -182
View File
@@ -1,182 +1,182 @@
/***************************************************************************
* 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 CLIENTPLAYER_H
#define CLIENTPLAYER_H
#include <playerinterface.h>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include <string>
class CardsValue;
class ConfigFile;
class HandInterface;
class BoardInterface;
class ClientPlayer : public PlayerInterface{
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*);
int getMyID() const;
unsigned getMyUniqueID() const;
PlayerType getMyType() const;
void setMyDude(int theValue);
int getMyDude() const;
void setMyDude4(int theValue);
int getMyDude4() const;
void setMyName(const std::string& theValue);
std::string getMyName() const;
void setMyAvatar(const std::string& theValue);
std::string getMyAvatar() const;
void setMyCash(int theValue);
int getMyCash() const;
void setMySet(int theValue);
void setMySetAbsolute(int theValue);
void setMySetNull();
int getMySet() const;
int getMyLastRelativeSet() const;
void setMyAction(int theValue, bool blind);
int getMyAction() const;
void setMyButton(int theValue);
int getMyButton() const;
void setMyActiveStatus(bool theValue);
bool getMyActiveStatus() const;
void setMyCards(int* theValue);
void getMyCards(int* theValue) const;
void setMyTurn(bool theValue);
bool getMyTurn() const;
void setMyCardsFlip(bool theValue, int state);
bool getMyCardsFlip() const;
void setMyCardsValueInt(int theValue);
int getMyCardsValueInt() const;
void setMyBestHandPosition(int* theValue);
void getMyBestHandPosition(int* theValue) const;
void setMyRoundStartCash(int theValue);
int getMyRoundStartCash() const;
void setLastMoneyWon ( int theValue );
int getLastMoneyWon() const;
void setMyAverageSets(int theValue);
int getMyAverageSets() const;
void setMyAggressive(bool theValue);
int getMyAggressive() const;
void setSBluff (int theValue);
int getSBluff() const;
void setSBluffStatus (bool theValue);
bool getSBluffStatus() const;
void setMyWinnerState (bool theValue, int pot);
bool getMyWinnerState() const;
void action();
int checkMyAction(int targetAction, int targetBet, int highestSet, int minimumRaise, int smallBlind);
void preflopEngine();
void flopEngine();
void turnEngine();
void riverEngine();
void preflopEngine3();
void flopEngine3();
void turnEngine3();
void riverEngine3();
int preflopCardsValue(int*);
int flopCardsValue(int*);
int turnCardsValue(int*);
void readFile();
void evaluation(int, int);
void setNetSessionData(boost::shared_ptr<SessionData> session);
boost::shared_ptr<SessionData> getNetSessionData();
private:
mutable boost::recursive_mutex m_syncMutex;
ConfigFile *myConfig;
HandInterface *currentHand;
BoardInterface *currentBoard;
CardsValue *myCardsValue;
// Konstanten
const int myID;
const unsigned myUniqueID;
const PlayerType myType;
std::string myName;
std::string myAvatar;
int myDude;
int myDude4;
// Laufvariablen
int myCardsValueInt;
int myBestHandPosition[5];
double myOdds;
int myNiveau[3];
int myCards[2];
int myCash;
int mySet;
int myLastRelativeSet;
int myAction; // 0 = none, 1 = fold, 2 = check, 3 = call, 4 = bet, 5 = raise, 6 = allin
int myButton; // 0 = none, 1 = dealer, 2 =small, 3 = big
bool myActiveStatus; // 0 = inactive, 1 = active
bool myTurn; // 0 = no, 1 = yes
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
int myRoundStartCash;
int lastMoneyWon;
int myAverageSets[4];
bool myAggressive[7];
int sBluff;
bool sBluffStatus;
bool myWinnerState;
boost::shared_ptr<SessionData> myNetSessionData;
};
#endif
/***************************************************************************
* 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 CLIENTPLAYER_H
#define CLIENTPLAYER_H
#include <playerinterface.h>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include <string>
class CardsValue;
class ConfigFile;
class HandInterface;
class BoardInterface;
class ClientPlayer : public PlayerInterface{
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*);
int getMyID() const;
unsigned getMyUniqueID() const;
PlayerType getMyType() const;
void setMyDude(int theValue);
int getMyDude() const;
void setMyDude4(int theValue);
int getMyDude4() const;
void setMyName(const std::string& theValue);
std::string getMyName() const;
void setMyAvatar(const std::string& theValue);
std::string getMyAvatar() const;
void setMyCash(int theValue);
int getMyCash() const;
void setMySet(int theValue);
void setMySetAbsolute(int theValue);
void setMySetNull();
int getMySet() const;
int getMyLastRelativeSet() const;
void setMyAction(int theValue, bool blind);
int getMyAction() const;
void setMyButton(int theValue);
int getMyButton() const;
void setMyActiveStatus(bool theValue);
bool getMyActiveStatus() const;
void setMyCards(int* theValue);
void getMyCards(int* theValue) const;
void setMyTurn(bool theValue);
bool getMyTurn() const;
void setMyCardsFlip(bool theValue, int state);
bool getMyCardsFlip() const;
void setMyCardsValueInt(int theValue);
int getMyCardsValueInt() const;
void setMyBestHandPosition(int* theValue);
void getMyBestHandPosition(int* theValue) const;
void setMyRoundStartCash(int theValue);
int getMyRoundStartCash() const;
void setLastMoneyWon ( int theValue );
int getLastMoneyWon() const;
void setMyAverageSets(int theValue);
int getMyAverageSets() const;
void setMyAggressive(bool theValue);
int getMyAggressive() const;
void setSBluff (int theValue);
int getSBluff() const;
void setSBluffStatus (bool theValue);
bool getSBluffStatus() const;
void setMyWinnerState (bool theValue, int pot);
bool getMyWinnerState() const;
void action();
int checkMyAction(int targetAction, int targetBet, int highestSet, int minimumRaise, int smallBlind);
void preflopEngine();
void flopEngine();
void turnEngine();
void riverEngine();
void preflopEngine3();
void flopEngine3();
void turnEngine3();
void riverEngine3();
int preflopCardsValue(int*);
int flopCardsValue(int*);
int turnCardsValue(int*);
void readFile();
void evaluation(int, int);
void setNetSessionData(boost::shared_ptr<SessionData> session);
boost::shared_ptr<SessionData> getNetSessionData();
private:
mutable boost::recursive_mutex m_syncMutex;
ConfigFile *myConfig;
HandInterface *currentHand;
BoardInterface *currentBoard;
CardsValue *myCardsValue;
// Konstanten
const int myID;
const unsigned myUniqueID;
const PlayerType myType;
std::string myName;
std::string myAvatar;
int myDude;
int myDude4;
// Laufvariablen
int myCardsValueInt;
int myBestHandPosition[5];
double myOdds;
int myNiveau[3];
int myCards[2];
int myCash;
int mySet;
int myLastRelativeSet;
int myAction; // 0 = none, 1 = fold, 2 = check, 3 = call, 4 = bet, 5 = raise, 6 = allin
int myButton; // 0 = none, 1 = dealer, 2 =small, 3 = big
bool myActiveStatus; // 0 = inactive, 1 = active
bool myTurn; // 0 = no, 1 = yes
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
int myRoundStartCash;
int lastMoneyWon;
int myAverageSets[4];
bool myAggressive[7];
int sBluff;
bool sBluffStatus;
bool myWinnerState;
boost::shared_ptr<SessionData> myNetSessionData;
};
#endif