remove board-pointer from player

This commit is contained in:
floty
2011-01-12 22:33:03 +00:00
parent 0fffc9476e
commit a2d0272ed3
10 changed files with 26 additions and 30 deletions
@@ -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);
};
+3 -3
View File
@@ -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;
+1 -3
View File
@@ -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;