Files
pokerth/src/engine/local_engine/localberofactory.cpp
T

96 lines
2.6 KiB
C++
Raw Normal View History

2007-08-04 12:08:10 +00:00
//
// C++ Implementation: localberofactory
//
// Description:
2007-08-04 12:08:10 +00:00
//
//
// Author: FThauer FHammer <webmaster@pokerth.net>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "localberofactory.h"
2007-08-05 13:07:23 +00:00
using namespace std;
LocalBeRoFactory::LocalBeRoFactory (HandInterface* hi, int id, int aP, int dP, int sB)
: BeRoFactoryInterface() , myHand(hi), myID(id), actualQuantityPlayers(aP), dealerPosition(dP), smallBlind(sB)
{}
2007-08-04 12:08:10 +00:00
LocalBeRoFactory::~LocalBeRoFactory()
{}
std::vector<boost::shared_ptr<BeRoInterface> > LocalBeRoFactory::createBeRo() {
std::vector<boost::shared_ptr<BeRoInterface> > myBeRo;
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoPreflop(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoFlop(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoTurn(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoRiver(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
myBeRo.push_back(boost::shared_ptr<BeRoInterface>(new LocalBeRoPostRiver(myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind)));
return myBeRo;
}
BeRoInterface* LocalBeRoFactory::createBeRoPreflop() {
BeRoInterface* preflopBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
return preflopBeRo;
}
BeRoInterface* LocalBeRoFactory::switchRounds(BeRoInterface* currentBeRo, int currentRound)
2007-08-04 12:08:10 +00:00
{
if(currentRound != currentBeRo->getMyBeRoID()) {
delete currentBeRo;
currentBeRo = NULL;
switch(currentRound) {
case GAME_STATE_PREFLOP: {
2007-08-05 13:07:23 +00:00
currentBeRo = new LocalBeRoPreflop ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
2007-08-05 13:07:23 +00:00
}
break;
case GAME_STATE_FLOP: {
currentBeRo = new LocalBeRoFlop( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
2007-08-05 13:07:23 +00:00
}
break;
case GAME_STATE_TURN: {
currentBeRo = new LocalBeRoTurn( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
2007-08-05 13:07:23 +00:00
}
break;
case GAME_STATE_RIVER: {
currentBeRo = new LocalBeRoRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
2007-08-05 13:07:23 +00:00
}
break;
case GAME_STATE_POST_RIVER: {
currentBeRo = new LocalBeRoPostRiver ( myHand, myID, actualQuantityPlayers, dealerPosition, smallBlind );
2007-08-05 13:07:23 +00:00
}
break;
default: { cout << "BeRoFactory-ERROR" << endl; }
2007-08-05 13:07:23 +00:00
}
2007-08-05 13:07:23 +00:00
}
return currentBeRo;
2007-08-04 12:08:10 +00:00
}