More shared_ptr in engine to prevent race conditions when accessing client engine from gui. Still incomplete.
This commit is contained in:
@@ -35,23 +35,27 @@ ClientEngineFactory::~ClientEngineFactory()
|
||||
}
|
||||
|
||||
|
||||
HandInterface* ClientEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, Log *l, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
|
||||
boost::shared_ptr<HandInterface>
|
||||
ClientEngineFactory::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)
|
||||
{
|
||||
return new ClientHand(f, g, b, l, sl, apl, rpl, id, sP, dP, sB, sC);
|
||||
return boost::shared_ptr<HandInterface>(new ClientHand(f, g, b, l, sl, apl, rpl, id, sP, dP, sB, sC));
|
||||
}
|
||||
|
||||
BoardInterface* ClientEngineFactory::createBoard(unsigned dp)
|
||||
boost::shared_ptr<BoardInterface>
|
||||
ClientEngineFactory::createBoard(unsigned dp)
|
||||
{
|
||||
return new ClientBoard(dp);
|
||||
return boost::shared_ptr<BoardInterface>(new ClientBoard(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)
|
||||
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)
|
||||
{
|
||||
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, b, id, uniqueId, type, name, avatar, sC, aS, mB));
|
||||
}
|
||||
|
||||
std::vector<boost::shared_ptr<BeRoInterface> > ClientEngineFactory::createBeRo(HandInterface* hi, int id, unsigned dP, int sB) {
|
||||
|
||||
std::vector<boost::shared_ptr<BeRoInterface> >
|
||||
ClientEngineFactory::createBeRo(HandInterface *hi, int id, unsigned dP, int sB)
|
||||
{
|
||||
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
|
||||
|
||||
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new ClientBeRo(hi, id, dP, sB, GAME_STATE_PREFLOP)));
|
||||
|
||||
Reference in New Issue
Block a user