bugfix for #275: remove dealerPosition from constructor of localBoard and transmit when it's needed

This commit is contained in:
floty
2014-03-02 00:50:28 +01:00
parent 3cbb365c61
commit 7f3c8a8608
14 changed files with 22 additions and 36 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ public:
virtual void collectSets() =0; virtual void collectSets() =0;
virtual void collectPot() =0; virtual void collectPot() =0;
virtual void distributePot() =0; virtual void distributePot(unsigned) =0;
virtual void determinePlayerNeedToShowCards() =0; virtual void determinePlayerNeedToShowCards() =0;
virtual std::list<unsigned> getWinners() const =0; virtual std::list<unsigned> getWinners() const =0;
+1 -1
View File
@@ -45,7 +45,7 @@ public:
virtual ~EngineFactory(); virtual ~EngineFactory();
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<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<BoardInterface> createBoard() =0;
virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, 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, bool sotS, int mB) =0;
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB) =0; virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB) =0;
}; };
+1 -1
View File
@@ -77,7 +77,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
throw LocalException(__FILE__, __LINE__, ERR_DEALER_NOT_FOUND); throw LocalException(__FILE__, __LINE__, ERR_DEALER_NOT_FOUND);
// create board // create board
currentBoard = myFactory->createBoard(dealerPosition); currentBoard = myFactory->createBoard();
// create player lists // create player lists
seatsList.reset(new std::list<boost::shared_ptr<PlayerInterface> >); seatsList.reset(new std::list<boost::shared_ptr<PlayerInterface> >);
+1 -1
View File
@@ -38,7 +38,7 @@
using namespace std; using namespace std;
LocalBeRo::LocalBeRo(HandInterface* hi, unsigned dP, int sB, GameState gS) LocalBeRo::LocalBeRo(HandInterface* hi, unsigned dP, int sB, GameState gS)
: BeRoInterface(), myHand(hi), myBeRoID(gS), dealerPosition(dP), smallBlindPosition(0), dealerPositionId(dP), smallBlindPositionId(0), bigBlindPositionId(0), smallBlind(sB), highestSet(0), minimumRaise(2*sB), fullBetRule(false), firstRun(true), firstRunGui(true), firstRound(true), firstHeadsUpRound(true), currentPlayersTurnId(0), firstRoundLastPlayersTurnId(0), logBoardCardsDone(false) : BeRoInterface(), myHand(hi), myBeRoID(gS), dealerPosition(dP), smallBlindPosition(0), smallBlindPositionId(0), bigBlindPositionId(0), smallBlind(sB), highestSet(0), minimumRaise(2*sB), fullBetRule(false), firstRun(true), firstRunGui(true), firstRound(true), firstHeadsUpRound(true), currentPlayersTurnId(0), firstRoundLastPlayersTurnId(0), logBoardCardsDone(false)
{ {
currentPlayersTurnIt = myHand->getRunningPlayerList()->begin(); currentPlayersTurnIt = myHand->getRunningPlayerList()->begin();
lastPlayersTurnIt = myHand->getRunningPlayerList()->begin(); lastPlayersTurnIt = myHand->getRunningPlayerList()->begin();
+2 -14
View File
@@ -81,12 +81,9 @@ protected:
return myHand; return myHand;
} }
int getDealerPosition() const { unsigned getDealerPosition() const {
return dealerPosition; return dealerPosition;
} }
void setDealerPosition(int theValue) {
dealerPosition = theValue;
}
void setCurrentPlayersTurnId(unsigned theValue) { void setCurrentPlayersTurnId(unsigned theValue) {
currentPlayersTurnId = theValue; currentPlayersTurnId = theValue;
@@ -137,14 +134,6 @@ protected:
return firstRound; return firstRound;
} }
void setDealerPositionId(unsigned theValue) {
dealerPositionId = theValue;
}
unsigned getDealerPositionId() const {
return dealerPositionId;
}
void setSmallBlindPositionId(unsigned theValue) { void setSmallBlindPositionId(unsigned theValue) {
smallBlindPositionId = theValue; smallBlindPositionId = theValue;
} }
@@ -182,10 +171,9 @@ private:
HandInterface* myHand; HandInterface* myHand;
const GameState myBeRoID; const GameState myBeRoID;
int dealerPosition; unsigned dealerPosition;
int smallBlindPosition; int smallBlindPosition;
unsigned dealerPositionId;
unsigned smallBlindPositionId; unsigned smallBlindPositionId;
unsigned bigBlindPositionId; unsigned bigBlindPositionId;
@@ -91,7 +91,7 @@ void LocalBeRoPostRiver::postRiverRun()
getMyHand()->getBoard()->determinePlayerNeedToShowCards(); getMyHand()->getBoard()->determinePlayerNeedToShowCards();
// Pot-Verteilung // Pot-Verteilung
getMyHand()->getBoard()->distributePot(); getMyHand()->getBoard()->distributePot(getDealerPosition());
//Pot auf 0 setzen //Pot auf 0 setzen
getMyHand()->getBoard()->setPot(0); getMyHand()->getBoard()->setPot(0);
+2 -2
View File
@@ -37,7 +37,7 @@
#include "localexception.h" #include "localexception.h"
#include "engine_msg.h" #include "engine_msg.h"
LocalBoard::LocalBoard(unsigned dp) : BoardInterface(), pot(0), sets(0), dealerPosition(dp), allInCondition(false), lastActionPlayerID(0) LocalBoard::LocalBoard() : BoardInterface(), pot(0), sets(0), allInCondition(false), lastActionPlayerID(0)
{ {
myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0; myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0;
} }
@@ -78,7 +78,7 @@ void LocalBoard::collectPot()
} }
void LocalBoard::distributePot() void LocalBoard::distributePot(unsigned dealerPosition)
{ {
winners.clear(); winners.clear();
+2 -3
View File
@@ -45,7 +45,7 @@ class HandInterface;
class LocalBoard : public BoardInterface class LocalBoard : public BoardInterface
{ {
public: public:
LocalBoard(unsigned dealerPosition); LocalBoard();
~LocalBoard(); ~LocalBoard();
void setPlayerLists(PlayerList, PlayerList, PlayerList); void setPlayerLists(PlayerList, PlayerList, PlayerList);
@@ -82,7 +82,7 @@ public:
void collectSets() ; void collectSets() ;
void collectPot() ; void collectPot() ;
void distributePot(); void distributePot(unsigned dealerPosition);
void determinePlayerNeedToShowCards(); void determinePlayerNeedToShowCards();
std::list<unsigned> getWinners() const { std::list<unsigned> getWinners() const {
@@ -111,7 +111,6 @@ private:
int myCards[5]; int myCards[5];
int pot; int pot;
int sets; int sets;
unsigned dealerPosition;
bool allInCondition; bool allInCondition;
unsigned lastActionPlayerID; unsigned lastActionPlayerID;
@@ -61,9 +61,9 @@ LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface
} }
boost::shared_ptr<BoardInterface> boost::shared_ptr<BoardInterface>
LocalEngineFactory::createBoard(unsigned dp) LocalEngineFactory::createBoard()
{ {
return boost::shared_ptr<BoardInterface>(new LocalBoard(dp)); return boost::shared_ptr<BoardInterface>(new LocalBoard());
} }
boost::shared_ptr<PlayerInterface> boost::shared_ptr<PlayerInterface>
+1 -1
View File
@@ -50,7 +50,7 @@ public:
~LocalEngineFactory(); ~LocalEngineFactory();
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<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<BoardInterface> createBoard();
virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB); virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB);
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB); virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB);
+3 -3
View File
@@ -36,8 +36,8 @@
using namespace std; using namespace std;
ClientBoard::ClientBoard(unsigned dp) ClientBoard::ClientBoard()
: pot(0), sets(0), dealerPosition(dp), allInCondition(false), lastActionPlayerID(0) : pot(0), sets(0), allInCondition(false), lastActionPlayerID(0)
{ {
myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0; myCards[0] = myCards[1] = myCards[2] = myCards[3] = myCards[4] = 0;
} }
@@ -134,7 +134,7 @@ ClientBoard::collectPot()
} }
void void
ClientBoard::distributePot() ClientBoard::distributePot(unsigned)
{ {
} }
+2 -3
View File
@@ -44,7 +44,7 @@ class HandInterface;
class ClientBoard : public BoardInterface class ClientBoard : public BoardInterface
{ {
public: public:
ClientBoard(unsigned dealerPosition); ClientBoard();
~ClientBoard(); ~ClientBoard();
void setPlayerLists(PlayerList, PlayerList, PlayerList); void setPlayerLists(PlayerList, PlayerList, PlayerList);
@@ -63,7 +63,7 @@ public:
void collectSets(); void collectSets();
void collectPot(); void collectPot();
void distributePot(); void distributePot(unsigned);
void determinePlayerNeedToShowCards(); void determinePlayerNeedToShowCards();
std::list<unsigned> getWinners() const; std::list<unsigned> getWinners() const;
@@ -85,7 +85,6 @@ private:
int myCards[5]; int myCards[5];
int pot; int pot;
int sets; int sets;
unsigned dealerPosition;
bool allInCondition; bool allInCondition;
unsigned lastActionPlayerID; unsigned lastActionPlayerID;
}; };
@@ -55,9 +55,9 @@ ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface
} }
boost::shared_ptr<BoardInterface> boost::shared_ptr<BoardInterface>
ClientEngineFactory::createBoard(unsigned dp) ClientEngineFactory::createBoard()
{ {
return boost::shared_ptr<BoardInterface>(new ClientBoard(dp)); return boost::shared_ptr<BoardInterface>(new ClientBoard());
} }
boost::shared_ptr<PlayerInterface> boost::shared_ptr<PlayerInterface>
@@ -52,7 +52,7 @@ public:
~ClientEngineFactory(); ~ClientEngineFactory();
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<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<BoardInterface> createBoard();
virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB); virtual boost::shared_ptr<PlayerInterface> createPlayer(int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, bool sotS, int mB);
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB); virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface *hi, unsigned dP, int sB);
}; };