More shared_ptr in engine to prevent race conditions when accessing client engine from gui. Still incomplete.

This commit is contained in:
lotodore
2011-01-09 14:16:20 +00:00
parent 54bc7aaa8d
commit 3974e7cac5
17 changed files with 95 additions and 94 deletions
+16 -7
View File
@@ -42,18 +42,27 @@ LocalEngineFactory::~LocalEngineFactory()
}
HandInterface*
LocalEngineFactory::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>
LocalEngineFactory::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 LocalHand(f, g, b, l, sl, apl, rpl, id, sP, dP, sB, sC);
return boost::shared_ptr<HandInterface>(new LocalHand(f, g, b, l, sl, apl, rpl, id, sP, dP, sB, sC));
}
BoardInterface* LocalEngineFactory::createBoard(unsigned dp) { return new LocalBoard(dp); }
boost::shared_ptr<BoardInterface>
LocalEngineFactory::createBoard(unsigned dp)
{
return boost::shared_ptr<BoardInterface>(new LocalBoard(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) { return boost::shared_ptr<PlayerInterface> (new LocalPlayer(myConfig, b, id, uniqueId, type, name, avatar, sC, aS, mB)); }
std::vector<boost::shared_ptr<BeRoInterface> > LocalEngineFactory::createBeRo(HandInterface* hi, int id, unsigned dP, int sB) {
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)
{
return boost::shared_ptr<PlayerInterface> (new LocalPlayer(myConfig, b, id, uniqueId, type, name, avatar, sC, aS, mB));
}
std::vector<boost::shared_ptr<BeRoInterface> >
LocalEngineFactory::createBeRo(HandInterface *hi, int id, unsigned dP, int sB)
{
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoPreflop(hi, id, dP, sB)));