adds activePlayerList and runningPlayerList (XVII) - !!! network-BROKEN !!!

This commit is contained in:
doitux
2007-09-27 00:37:01 +00:00
parent 3c7aa802db
commit aab3ac6b2c
17 changed files with 272 additions and 78 deletions
+3 -2
View File
@@ -34,10 +34,11 @@ ClientBoard::~ClientBoard()
}
void
ClientBoard::setPlayerLists(std::vector<boost::shared_ptr<PlayerInterface> > sl, PlayerList apl, PlayerList rpl)
ClientBoard::setPlayerLists(std::vector<boost::shared_ptr<PlayerInterface> > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
playerArray = sl;
playerArray = sl_old; // delete
seatsList = sl;
activePlayerList = apl;
runningPlayerList = rpl;
}
+3 -2
View File
@@ -34,7 +34,7 @@ public:
ClientBoard();
~ClientBoard();
void setPlayerLists(std::vector<boost::shared_ptr<PlayerInterface> >, PlayerList, PlayerList);
void setPlayerLists(std::vector<boost::shared_ptr<PlayerInterface> >, PlayerList, PlayerList, PlayerList);
void setHand(HandInterface*);
void setMyCards(int* theValue);
@@ -53,7 +53,8 @@ public:
private:
mutable boost::recursive_mutex m_syncMutex;
std::vector<boost::shared_ptr<PlayerInterface> > playerArray;
std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
PlayerList seatsList;
PlayerList activePlayerList;
PlayerList runningPlayerList;
@@ -35,9 +35,9 @@ ClientEngineFactory::~ClientEngineFactory()
}
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl_old, 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);
return new ClientHand(f, g, b, sl_old, sl, apl, rpl, id, sP, dP, sB, sC);
}
BoardInterface* ClientEngineFactory::createBoard()
@@ -37,7 +37,7 @@ public:
ClientEngineFactory();
~ClientEngineFactory();
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl_old, 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);
+16 -2
View File
@@ -21,8 +21,8 @@
using namespace std;
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
: myFactory(f), myGui(g), myBoard(b), playerArray(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0),
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, std::vector<boost::shared_ptr<PlayerInterface> > sl_old, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
: myFactory(f), myGui(g), myBoard(b), playerArray(sl_old), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0),
smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(0),
cardsShown(false), bettingRoundsPlayed(0)
{
@@ -76,6 +76,20 @@ ClientHand::getPlayerArray() const
return playerArray;
}
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
{
+4 -2
View File
@@ -32,7 +32,7 @@
class ClientHand : public HandInterface
{
public:
ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, std::vector<boost::shared_ptr<PlayerInterface> >, PlayerList, PlayerList , int, int, int, int, int );
ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, std::vector<boost::shared_ptr<PlayerInterface> >, PlayerList, PlayerList, PlayerList , int, int, int, int, int );
~ClientHand();
void start();
@@ -41,6 +41,7 @@ class ClientHand : public HandInterface
PlayerList getActivePlayerList() const {return activePlayerList;}
PlayerList getRunningPlayerList() const {return runningPlayerList;}
PlayerListIterator getSeatIt(unsigned) const;
PlayerListIterator getActivePlayerIt(unsigned) const;
PlayerListIterator getRunningPlayerIt(unsigned) const;
@@ -95,7 +96,8 @@ class ClientHand : public HandInterface
GuiInterface *myGui;
BoardInterface *myBoard;
std::vector<boost::shared_ptr<PlayerInterface> > playerArray;
std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
PlayerList seatsList;
PlayerList activePlayerList;
PlayerList runningPlayerList;