Removed client code which is no longer needed now. Networking still somewhat broken.

This commit is contained in:
lotodore
2007-08-07 20:37:34 +00:00
parent c34f683c41
commit 03ecc5b9cb
18 changed files with 177 additions and 895 deletions
+8 -14
View File
@@ -1,7 +1,7 @@
//
// C++ Interface: berointerface
//
// Description:
// Description: Betting rounds interface
//
//
// Author: FThauer FHammer <webmaster@pokerth.net>, (C) 2007
@@ -12,15 +12,17 @@
#ifndef BEROINTERFACE_H
#define BEROINTERFACE_H
#include "game_defs.h"
/**
@author FThauer FHammer <webmaster@pokerth.net>
*/
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
+2 -1
View File
@@ -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;
+6 -15
View File
@@ -15,7 +15,6 @@
#include <iostream>
#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;
+111 -1
View File
@@ -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()
{
}
+39 -10
View File
@@ -12,30 +12,59 @@
#ifndef CLIENTBERO_H
#define CLIENTBERO_H
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include "berointerface.h"
class HandInterface;
/**
@author FThauer FHammer <webmaster@pokerth.net>
*/
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
@@ -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<boost::shared_ptr<BeRoInterface> > ClientEngineFactory::createBeRo(H
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoPreflop(hi, id, aP, dP, sB)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoFlop(hi, id, aP, dP, sB)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoTurn(hi, id, aP, dP, sB)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoRiver(hi, id, aP, dP, sB)));
// myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRoPostRiver(hi, id, aP, dP, sB)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, aP, dP, sB, GAME_STATE_PREFLOP)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, aP, dP, sB, GAME_STATE_FLOP)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, aP, dP, sB, GAME_STATE_TURN)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, aP, dP, sB, GAME_STATE_RIVER)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, aP, dP, sB, GAME_STATE_POST_RIVER)));
return myBeRo;
-122
View File
@@ -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 <game_defs.h>
#include <handinterface.h>
//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()
{
}
-84
View File
@@ -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 <boost/thread.hpp>
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
@@ -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 <handinterface.h>
#include <game_defs.h>
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()
{
}
-75
View File
@@ -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 <berointerface.h>
#include <boost/thread.hpp>
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
-140
View File
@@ -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 <game_defs.h>
//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()
{
}
-89
View File
@@ -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 <berointerface.h>
#include <boost/thread.hpp>
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
-121
View File
@@ -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 <game_defs.h>
#include <handinterface.h>
//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()
{
}
-83
View File
@@ -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 <berointerface.h>
#include <boost/thread.hpp>
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
+3 -30
View File
@@ -340,7 +340,7 @@ ServerRecvStateInit::InternalProcess(ServerRecvThread &server, SessionWrapper se
}
else if (packet->ToNetPacketStartEvent())
{
boost::shared_ptr<PlayerData> tmpPlayerData(
/*boost::shared_ptr<PlayerData> 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<NetPacketPlayerJoined *>(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<PlayerInterface *>
ServerRecvStateStartRound::GetActivePlayers(Game &curGame)
{
-1
View File
@@ -184,7 +184,6 @@ protected:
// Protected constructor - this is a singleton.
ServerRecvStateStartRound();
static void GameRun(Game &curGame);
static std::list<PlayerInterface *> GetActivePlayers(Game &curGame);
};