remove board-pointer from player
This commit is contained in:
@@ -33,7 +33,7 @@ public:
|
||||
|
||||
virtual boost::shared_ptr<HandInterface> createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost::shared_ptr<BoardInterface> b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) =0;
|
||||
virtual boost::shared_ptr<BoardInterface> createBoard(unsigned dp) =0;
|
||||
virtual 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) =0;
|
||||
virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB) =0;
|
||||
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, int id, unsigned dP, int sB) =0;
|
||||
};
|
||||
|
||||
|
||||
@@ -55,9 +55,9 @@ LocalEngineFactory::createBoard(unsigned dp)
|
||||
}
|
||||
|
||||
boost::shared_ptr<PlayerInterface>
|
||||
LocalEngineFactory::createPlayer(BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
|
||||
LocalEngineFactory::createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
|
||||
{
|
||||
return boost::shared_ptr<PlayerInterface> (new LocalPlayer(myConfig, b, id, uniqueId, type, name, avatar, sC, aS, mB));
|
||||
return boost::shared_ptr<PlayerInterface> (new LocalPlayer(myConfig, id, uniqueId, type, name, avatar, sC, aS, mB));
|
||||
}
|
||||
|
||||
std::vector<boost::shared_ptr<BeRoInterface> >
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
|
||||
virtual boost::shared_ptr<HandInterface> createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost::shared_ptr<BoardInterface> b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
|
||||
virtual boost::shared_ptr<BoardInterface> createBoard(unsigned dp);
|
||||
virtual 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);
|
||||
virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
|
||||
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, int id, unsigned dP, int sB);
|
||||
|
||||
private:
|
||||
|
||||
@@ -849,8 +849,8 @@ static const RoundData FlopValues[] =
|
||||
#define NUM_PREFLOP_VALUES (sizeof(PreflopValues)/sizeof(RoundData))
|
||||
#define NUM_FLOP_VALUES (sizeof(FlopValues)/sizeof(RoundData))
|
||||
|
||||
LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
|
||||
: PlayerInterface(), myConfig(c), currentHand(0), currentBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(0), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(1), myTurn(0), myCardsFlip(0), myRoundStartCash(0), lastMoneyWon(0), sBluff(0), sBluffStatus(0), myWinnerState(false), m_actionTimeoutCounter(0)
|
||||
LocalPlayer::LocalPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
|
||||
: PlayerInterface(), myConfig(c), currentHand(0), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(0), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(1), myTurn(0), myCardsFlip(0), myRoundStartCash(0), lastMoneyWon(0), sBluff(0), sBluffStatus(0), myWinnerState(false), m_actionTimeoutCounter(0)
|
||||
{
|
||||
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!!
|
||||
@@ -1012,7 +1012,7 @@ void LocalPlayer::action() {
|
||||
if(myConfig->readConfigInt("EngineVersion")) preflopEngine3();
|
||||
else preflopEngine();
|
||||
|
||||
currentBoard->collectSets();
|
||||
currentHand->getBoard()->collectSets();
|
||||
currentHand->getGuiInterface()->refreshPot();
|
||||
|
||||
} break;
|
||||
@@ -1021,7 +1021,7 @@ void LocalPlayer::action() {
|
||||
if(myConfig->readConfigInt("EngineVersion")) flopEngine3();
|
||||
else flopEngine();
|
||||
|
||||
currentBoard->collectSets();
|
||||
currentHand->getBoard()->collectSets();
|
||||
currentHand->getGuiInterface()->refreshPot();
|
||||
|
||||
} break;
|
||||
@@ -1030,7 +1030,7 @@ void LocalPlayer::action() {
|
||||
if(myConfig->readConfigInt("EngineVersion")) turnEngine3();
|
||||
else turnEngine();
|
||||
|
||||
currentBoard->collectSets();
|
||||
currentHand->getBoard()->collectSets();
|
||||
currentHand->getGuiInterface()->refreshPot();
|
||||
|
||||
} break;
|
||||
@@ -1039,7 +1039,7 @@ void LocalPlayer::action() {
|
||||
if(myConfig->readConfigInt("EngineVersion")) riverEngine3();
|
||||
else riverEngine();
|
||||
|
||||
currentBoard->collectSets();
|
||||
currentHand->getBoard()->collectSets();
|
||||
currentHand->getGuiInterface()->refreshPot();
|
||||
|
||||
} break;
|
||||
@@ -4010,7 +4010,7 @@ void LocalPlayer::calcMyOdds() {
|
||||
int i;
|
||||
|
||||
for(i=0; i<2; i++) tempArray[i] = myCards[i];
|
||||
currentBoard->getMyCards(boardCards);
|
||||
currentHand->getBoard()->getMyCards(boardCards);
|
||||
for(i=0; i<3; i++) tempArray[2+i] = boardCards[i];
|
||||
|
||||
// cout << myID << ": ";
|
||||
@@ -4055,7 +4055,7 @@ void LocalPlayer::calcMyOdds() {
|
||||
int tempBoardCardsArray[5];
|
||||
int tempMyCardsArray[7];
|
||||
int tempOpponentCardsArray[7];
|
||||
currentBoard->getMyCards(tempBoardCardsArray);
|
||||
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
|
||||
tempMyCardsArray[0] = myCards[0];
|
||||
tempMyCardsArray[1] = myCards[1];
|
||||
@@ -4111,7 +4111,7 @@ void LocalPlayer::calcMyOdds() {
|
||||
int tempBoardCardsArray[5];
|
||||
int tempMyCardsArray[7];
|
||||
int tempOpponentCardsArray[7];
|
||||
currentBoard->getMyCards(tempBoardCardsArray);
|
||||
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
|
||||
tempMyCardsArray[0] = myCards[0];
|
||||
tempMyCardsArray[1] = myCards[1];
|
||||
@@ -4609,7 +4609,7 @@ void LocalPlayer::flopEngine3() {
|
||||
int tempBoardCardsArray[5];
|
||||
int tempMyCardsArray[7];
|
||||
int tempOpponentCardsArray[7];
|
||||
currentBoard->getMyCards(tempBoardCardsArray);
|
||||
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
|
||||
tempMyCardsArray[0] = myCards[0];
|
||||
tempMyCardsArray[1] = myCards[1];
|
||||
@@ -4780,7 +4780,7 @@ void LocalPlayer::turnEngine3() {
|
||||
int tempBoardCardsArray[5];
|
||||
int tempMyCardsArray[7];
|
||||
int tempOpponentCardsArray[7];
|
||||
currentBoard->getMyCards(tempBoardCardsArray);
|
||||
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
|
||||
tempMyCardsArray[0] = myCards[0];
|
||||
tempMyCardsArray[1] = myCards[1];
|
||||
@@ -4946,7 +4946,7 @@ void LocalPlayer::riverEngine3() {
|
||||
int tempBoardCardsArray[5];
|
||||
int tempMyCardsArray[7];
|
||||
int tempOpponentCardsArray[7];
|
||||
currentBoard->getMyCards(tempBoardCardsArray);
|
||||
currentHand->getBoard()->getMyCards(tempBoardCardsArray);
|
||||
|
||||
tempMyCardsArray[0] = myCards[0];
|
||||
tempMyCardsArray[1] = myCards[1];
|
||||
@@ -5130,7 +5130,7 @@ LocalPlayer::resetActionTimeoutCounter()
|
||||
|
||||
bool LocalPlayer::checkIfINeedToShowCards()
|
||||
{
|
||||
std::list<unsigned> playerNeedToShowCardsList = currentBoard->getPlayerNeedToShowCards();
|
||||
std::list<unsigned> playerNeedToShowCardsList = currentHand->getBoard()->getPlayerNeedToShowCards();
|
||||
for(std::list<unsigned>::iterator it = playerNeedToShowCardsList.begin(); it != playerNeedToShowCardsList.end(); it++)
|
||||
{
|
||||
if(*it == myUniqueID) return true;
|
||||
|
||||
@@ -29,11 +29,10 @@
|
||||
class CardsValue;
|
||||
class ConfigFile;
|
||||
class HandInterface;
|
||||
class BoardInterface;
|
||||
|
||||
class LocalPlayer : public PlayerInterface{
|
||||
public:
|
||||
LocalPlayer(ConfigFile*, BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
|
||||
LocalPlayer(ConfigFile*, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
|
||||
|
||||
~LocalPlayer();
|
||||
|
||||
@@ -189,7 +188,6 @@ private:
|
||||
|
||||
ConfigFile *myConfig;
|
||||
HandInterface *currentHand;
|
||||
BoardInterface *currentBoard;
|
||||
|
||||
CardsValue *myCardsValue;
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ ClientEngineFactory::createBoard(unsigned dp)
|
||||
}
|
||||
|
||||
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)
|
||||
ClientEngineFactory::createPlayer(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));
|
||||
return boost::shared_ptr<PlayerInterface>(new ClientPlayer(NULL, id, uniqueId, type, name, avatar, sC, aS, mB));
|
||||
}
|
||||
|
||||
std::vector<boost::shared_ptr<BeRoInterface> >
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
virtual boost::shared_ptr<HandInterface> createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost::shared_ptr<BoardInterface> b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
|
||||
virtual boost::shared_ptr<BoardInterface> createBoard(unsigned dp);
|
||||
virtual 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);
|
||||
virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
|
||||
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, int id, unsigned dP, int sB);
|
||||
};
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
using namespace std;
|
||||
|
||||
|
||||
ClientPlayer::ClientPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
|
||||
: PlayerInterface(), myConfig(c), currentHand(0), currentBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type),
|
||||
ClientPlayer::ClientPlayer(ConfigFile *c, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
|
||||
: PlayerInterface(), myConfig(c), currentHand(0), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type),
|
||||
myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0),
|
||||
myAction(0), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(true), myTurn(false), myCardsFlip(false), myRoundStartCash(0),
|
||||
lastMoneyWon(0), sBluff(0), sBluffStatus(false), myWinnerState(false)
|
||||
@@ -526,7 +526,7 @@ boost::shared_ptr<SessionData> ClientPlayer::getNetSessionData()
|
||||
bool ClientPlayer::checkIfINeedToShowCards()
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||
std::list<unsigned> playerNeedToShowCardsList = currentBoard->getPlayerNeedToShowCards();
|
||||
std::list<unsigned> playerNeedToShowCardsList = currentHand->getBoard()->getPlayerNeedToShowCards();
|
||||
for(std::list<unsigned>::iterator it = playerNeedToShowCardsList.begin(); it != playerNeedToShowCardsList.end(); it++)
|
||||
{
|
||||
if(*it == myUniqueID) return true;
|
||||
|
||||
@@ -28,11 +28,10 @@
|
||||
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(ConfigFile*, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB);
|
||||
~ClientPlayer();
|
||||
|
||||
void setHand(HandInterface *);
|
||||
@@ -146,7 +145,6 @@ private:
|
||||
|
||||
ConfigFile *myConfig;
|
||||
HandInterface *currentHand;
|
||||
BoardInterface *currentBoard;
|
||||
|
||||
CardsValue *myCardsValue;
|
||||
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
||||
}
|
||||
|
||||
// create player objects
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(currentBoard.get(), i, uniqueId, type, myName, myAvatarFile, startCash, startQuantityPlayers > i, 0);
|
||||
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(i, uniqueId, type, myName, myAvatarFile, startCash, startQuantityPlayers > i, 0);
|
||||
|
||||
tmpPlayer->setNetSessionData(myNetSession);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user