cleaning code and hopefully last part of refactoring playerArray to playerLists ;)
This commit is contained in:
@@ -37,7 +37,7 @@ public:
|
|||||||
|
|
||||||
virtual ~BoardInterface();
|
virtual ~BoardInterface();
|
||||||
//
|
//
|
||||||
virtual void setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList) =0;
|
virtual void setPlayerLists(PlayerList, PlayerList, PlayerList) =0;
|
||||||
virtual void setHand(HandInterface*) =0;
|
virtual void setHand(HandInterface*) =0;
|
||||||
//
|
//
|
||||||
virtual void setMyCards(int* theValue) =0;
|
virtual void setMyCards(int* theValue) =0;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public:
|
|||||||
|
|
||||||
virtual ~EngineFactory();
|
virtual ~EngineFactory();
|
||||||
|
|
||||||
virtual 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) =0;
|
virtual HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) =0;
|
||||||
virtual BoardInterface* createBoard() =0;
|
virtual BoardInterface* createBoard() =0;
|
||||||
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) =0;
|
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) =0;
|
||||||
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, unsigned dP, int sB) =0;
|
virtual std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, unsigned dP, int sB) =0;
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ public:
|
|||||||
|
|
||||||
virtual void start() = 0;
|
virtual void start() = 0;
|
||||||
|
|
||||||
// virtual std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const =0; // delete
|
|
||||||
virtual PlayerList getSeatsList() const =0;
|
virtual PlayerList getSeatsList() const =0;
|
||||||
virtual PlayerList getActivePlayerList() const =0;
|
virtual PlayerList getActivePlayerList() const =0;
|
||||||
virtual PlayerList getRunningPlayerList() const =0;
|
virtual PlayerList getRunningPlayerList() const =0;
|
||||||
|
|||||||
@@ -54,23 +54,6 @@ LocalBeRo::LocalBeRo(HandInterface* hi, int id, unsigned dP, int sB, GameState g
|
|||||||
throw LocalException(__FILE__, __LINE__, ERR_ACTIVE_PLAYER_NOT_FOUND);
|
throw LocalException(__FILE__, __LINE__, ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// int i;
|
|
||||||
|
|
||||||
//SmallBlind-Position ermitteln
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -80,11 +63,6 @@ LocalBeRo::~LocalBeRo()
|
|||||||
|
|
||||||
void LocalBeRo::nextPlayer() {
|
void LocalBeRo::nextPlayer() {
|
||||||
|
|
||||||
// myHand->getPlayerArray()[playersTurn]->action();
|
|
||||||
|
|
||||||
|
|
||||||
// cout << "playerID in nextPlayer(): " << (*currentPlayersTurnIt)->getMyID() << endl;
|
|
||||||
|
|
||||||
PlayerListConstIterator currentPlayersTurnConstIt = myHand->getRunningPlayerIt(currentPlayersTurnId);
|
PlayerListConstIterator currentPlayersTurnConstIt = myHand->getRunningPlayerIt(currentPlayersTurnId);
|
||||||
if(currentPlayersTurnConstIt == myHand->getRunningPlayerList()->end()) {
|
if(currentPlayersTurnConstIt == myHand->getRunningPlayerList()->end()) {
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||||
@@ -106,69 +84,8 @@ void LocalBeRo::run() {
|
|||||||
|
|
||||||
firstRun = false;
|
firstRun = false;
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
// determine smallBlindPosition
|
|
||||||
PlayerListIterator smallBlindPositionIt;
|
|
||||||
|
|
||||||
for(smallBlindPositionIt=myHand->getActivePlayerList()->begin(); smallBlindPositionIt!=myHand->getActivePlayerList()->end(); smallBlindPositionIt++) {
|
|
||||||
if((*smallBlindPositionIt)->getMyButton() == BUTTON_SMALL_BLIND) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// determine running player before smallBlind (for heads up: determine dealer/smallblind)
|
|
||||||
PlayerListIterator it_1, it_2;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
// running player before smallBlind
|
|
||||||
if(myHand->getActivePlayerList()->size() > 2) {
|
|
||||||
it_1 = smallBlindPositionIt;
|
|
||||||
for(i=0; i<myHand->getActivePlayerList()->size(); i++) {
|
|
||||||
if(it_1 == myHand->getActivePlayerList()->begin()) it_1 = myHand->getActivePlayerList()->end();
|
|
||||||
it_1--;
|
|
||||||
it_2 = find(myHand->getRunningPlayerList()->begin(), myHand->getRunningPlayerList()->end(), *it_1);
|
|
||||||
// running player found
|
|
||||||
if(it_2 != myHand->getRunningPlayerList()->end()) {
|
|
||||||
lastPlayersTurnIt = it_2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// heads up: bigBlind begins -> dealer/smallBlind is running player before bigBlind
|
|
||||||
else {
|
|
||||||
it_1 = find(myHand->getRunningPlayerList()->begin(), myHand->getRunningPlayerList()->end(), *smallBlindPositionIt);
|
|
||||||
if( it_1 == myHand->getRunningPlayerList()->end() ) {
|
|
||||||
cout << "ERROR - lastPlayersTurnIt-detection in localBeRo" << endl;
|
|
||||||
}
|
|
||||||
// smallBlind found
|
|
||||||
else {
|
|
||||||
lastPlayersTurnIt = it_1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
currentPlayersTurnIt = lastPlayersTurnIt;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(!(myHand->getAllInCondition())) {
|
if(!(myHand->getAllInCondition())) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// determine smallBlindPosition
|
|
||||||
// PlayerListIterator smallBlindPositionIt;
|
|
||||||
|
|
||||||
// for(smallBlindPositionIt=myHand->getActivePlayerList()->begin(); smallBlindPositionIt!=myHand->getActivePlayerList()->end(); smallBlindPositionIt++) {
|
|
||||||
// if((*smallBlindPositionIt)->getMyButton() == BUTTON_SMALL_BLIND) break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// determine running player before smallBlind (for heads up: determine dealer/smallblind)
|
|
||||||
PlayerListIterator it_1, it_2;
|
PlayerListIterator it_1, it_2;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@@ -202,30 +119,10 @@ void LocalBeRo::run() {
|
|||||||
else {
|
else {
|
||||||
firstRoundLastPlayersTurnId = smallBlindPositionId;
|
firstRoundLastPlayersTurnId = smallBlindPositionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentPlayersTurnId = firstRoundLastPlayersTurnId;
|
currentPlayersTurnId = firstRoundLastPlayersTurnId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//log the turned cards
|
//log the turned cards
|
||||||
if(!logBoardCardsDone) {
|
if(!logBoardCardsDone) {
|
||||||
|
|
||||||
@@ -248,18 +145,11 @@ void LocalBeRo::run() {
|
|||||||
|
|
||||||
bool allHighestSet = true;
|
bool allHighestSet = true;
|
||||||
|
|
||||||
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
|
|
||||||
// if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
PlayerListIterator it;
|
PlayerListIterator it;
|
||||||
PlayerListIterator it_c;
|
PlayerListIterator it_c;
|
||||||
|
|
||||||
|
|
||||||
// test if all running players have same sets (else allHighestSet = false)
|
// check if all running players have same sets (else allHighestSet = false)
|
||||||
for( it_c = myHand->getRunningPlayerList()->begin(); it_c != myHand->getRunningPlayerList()->end(); it_c++) {
|
for( it_c = myHand->getRunningPlayerList()->begin(); it_c != myHand->getRunningPlayerList()->end(); it_c++) {
|
||||||
if(highestSet != (*it_c)->getMySet()) {
|
if(highestSet != (*it_c)->getMySet()) {
|
||||||
allHighestSet = false;
|
allHighestSet = false;
|
||||||
@@ -276,11 +166,6 @@ void LocalBeRo::run() {
|
|||||||
//also gehe in naechste bero
|
//also gehe in naechste bero
|
||||||
myHand->setCurrentRound(myBeRoID+1);
|
myHand->setCurrentRound(myBeRoID+1);
|
||||||
|
|
||||||
//Action loeschen und ActionButtons refresh
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0);
|
|
||||||
// }
|
|
||||||
|
|
||||||
//Action loeschen und ActionButtons refresh
|
//Action loeschen und ActionButtons refresh
|
||||||
for(it_c=myHand->getRunningPlayerList()->begin(); it_c!=myHand->getRunningPlayerList()->end(); it_c++) {
|
for(it_c=myHand->getRunningPlayerList()->begin(); it_c!=myHand->getRunningPlayerList()->end(); it_c++) {
|
||||||
(*it_c)->setMyAction(PLAYER_ACTION_NONE);
|
(*it_c)->setMyAction(PLAYER_ACTION_NONE);
|
||||||
@@ -300,11 +185,6 @@ void LocalBeRo::run() {
|
|||||||
else {
|
else {
|
||||||
// aktuelle bero ist wirklich dran
|
// aktuelle bero ist wirklich dran
|
||||||
|
|
||||||
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
|
||||||
// if(myHand->getPlayerArray()[0]->getMyActiveStatus() && myHand->getPlayerArray()[0]->getMyAction() != 1) {
|
|
||||||
// myHand->setBettingRoundsPlayed(myBeRoID);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
// Anzahl der effektiv gespielten Runden (des human player) erhöhen
|
||||||
it_c = myHand->getActivePlayerIt(0);
|
it_c = myHand->getActivePlayerIt(0);
|
||||||
if( it_c != myHand->getActivePlayerList()->end() ) {
|
if( it_c != myHand->getActivePlayerList()->end() ) {
|
||||||
@@ -314,76 +194,21 @@ void LocalBeRo::run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//// !!!!!!!!!!!!!!!!1!!!! very buggy, rule breaking -> TODO !!!!!!!!!!!!11!!!!!!!! //////////////
|
// determine next running player
|
||||||
|
PlayerListConstIterator currentPlayersTurnIt = myHand->getRunningPlayerIt( currentPlayersTurnId );
|
||||||
|
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) {
|
||||||
|
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
//// headsup:
|
currentPlayersTurnIt++;
|
||||||
//// preflop: dealer is small blind and begins
|
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) currentPlayersTurnIt = myHand->getRunningPlayerList()->begin();
|
||||||
//// flop, trun, river: big blind begins
|
|
||||||
|
|
||||||
//// !!!!!!!!! attention: exception if player failed before !!!!!!!!
|
|
||||||
|
|
||||||
// if( !(myHand->getCurrentQuantityPlayers() < 3 && firstHeadsUpRound == 1) || myHand->getPlayerArray()[playersTurn]->getMyActiveStatus() == 0 ) {
|
|
||||||
// not first round in heads up (for headsup dealer is smallblind so it is dealers turn)
|
|
||||||
|
|
||||||
// naechsten Spieler ermitteln
|
|
||||||
// int i;
|
|
||||||
// for(i=0; (i<MAX_NUMBER_OF_PLAYERS && ((myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) == 0 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6)) || i==0; i++) {
|
|
||||||
// playersTurn = (playersTurn+1)%(MAX_NUMBER_OF_PLAYERS);
|
|
||||||
// }
|
|
||||||
// firstHeadsUpRound = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// determine next running player
|
|
||||||
// currentPlayersTurnIt++;
|
|
||||||
// if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) currentPlayersTurnIt = myHand->getRunningPlayerList()->begin();
|
|
||||||
|
|
||||||
|
|
||||||
// determine next running player
|
|
||||||
PlayerListConstIterator currentPlayersTurnIt = myHand->getRunningPlayerIt( currentPlayersTurnId );
|
|
||||||
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) {
|
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
|
||||||
}
|
|
||||||
|
|
||||||
currentPlayersTurnIt++;
|
|
||||||
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) currentPlayersTurnIt = myHand->getRunningPlayerList()->begin();
|
|
||||||
|
|
||||||
currentPlayersTurnId = (*currentPlayersTurnIt)->getMyUniqueID();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
// else { firstHeadsUpRound = 0; }
|
|
||||||
|
|
||||||
////// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ////////////////
|
|
||||||
|
|
||||||
//Spieler-Position vor SmallBlind-Position ermitteln
|
|
||||||
// int activePlayerBeforeSmallBlind = smallBlindPosition;
|
|
||||||
|
|
||||||
// for(i=0; (i<MAX_NUMBER_OF_PLAYERS && !(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6) || i==0; i++) {
|
|
||||||
|
|
||||||
// activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + MAX_NUMBER_OF_PLAYERS - 1 ) % (MAX_NUMBER_OF_PLAYERS);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// myHand->getPlayerArray()[playersTurn]->setMyTurn(1);
|
|
||||||
|
|
||||||
|
currentPlayersTurnId = (*currentPlayersTurnIt)->getMyUniqueID();
|
||||||
|
|
||||||
//highlight active players groupbox and clear action
|
//highlight active players groupbox and clear action
|
||||||
myHand->getGuiInterface()->refreshGroupbox(currentPlayersTurnId,2);
|
myHand->getGuiInterface()->refreshGroupbox(currentPlayersTurnId,2);
|
||||||
myHand->getGuiInterface()->refreshAction(currentPlayersTurnId,0);
|
myHand->getGuiInterface()->refreshAction(currentPlayersTurnId,0);
|
||||||
|
|
||||||
// wenn wir letzter aktiver Spieler vor SmallBlind sind, dann flopFirstRound zuende
|
|
||||||
// ausnahme bei heads up !!! --> TODO
|
|
||||||
// if(myHand->getPlayerArray()[playersTurn]->getMyID() == activePlayerBeforeSmallBlind && myHand->getActivePlayerList()->size() >= 3) { firstRound = 0; }
|
|
||||||
// if(myHand->getActivePlayerList()->size() < 3 && (myHand->getPlayerArray()[playersTurn]->getMyID() == dealerPosition || myHand->getPlayerArray()[playersTurn]->getMyID() == smallBlindPosition)) { firstRound = 0; }
|
|
||||||
|
|
||||||
currentPlayersTurnIt = myHand->getRunningPlayerIt( currentPlayersTurnId );
|
currentPlayersTurnIt = myHand->getRunningPlayerIt( currentPlayersTurnId );
|
||||||
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) {
|
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) {
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||||
@@ -396,11 +221,6 @@ void LocalBeRo::run() {
|
|||||||
firstRound = false;
|
firstRound = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if( currentPlayersTurnId == 0) {
|
if( currentPlayersTurnId == 0) {
|
||||||
// Wir sind dran
|
// Wir sind dran
|
||||||
myHand->getGuiInterface()->meInAction();
|
myHand->getGuiInterface()->meInAction();
|
||||||
@@ -413,5 +233,3 @@ void LocalBeRo::run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,21 +38,11 @@ void LocalBeRoPostRiver::run() {
|
|||||||
|
|
||||||
void LocalBeRoPostRiver::postRiverRun() {
|
void LocalBeRoPostRiver::postRiverRun() {
|
||||||
|
|
||||||
// int i;
|
int i;
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
PlayerListIterator it;
|
PlayerListIterator it;
|
||||||
|
|
||||||
//berechnen welcher Spieler gewonnen hat
|
// who is the winner
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
//
|
|
||||||
// if(getMyHand()->getPlayerArray()[i]->getMyActiveStatus() && getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD && getMyHand()->getPlayerArray()[i]->getMyCardsValueInt() > highestCardsValue ) {
|
|
||||||
// highestCardsValue = getMyHand()->getPlayerArray()[i]->getMyCardsValueInt();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//berechnen welcher Spieler gewonnen hat
|
|
||||||
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); it_c++) {
|
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); it_c++) {
|
||||||
|
|
||||||
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() > highestCardsValue ) {
|
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() > highestCardsValue ) {
|
||||||
@@ -60,22 +50,7 @@ void LocalBeRoPostRiver::postRiverRun() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Durchschnittsets des human player ermitteln
|
|
||||||
// getMyHand()->getPlayerArray()[0]->setMyAverageSets(((getMyHand()->getPlayerArray()[0]->getMyRoundStartCash())-(getMyHand()->getPlayerArray()[0]->getMyCash()))/(getMyHand()->getBettingRoundsPlayed()+1));
|
|
||||||
|
|
||||||
// Aggressivität des human player ermitteln
|
|
||||||
// anzahl der player die möglichkeit haben am pot teilzuhaben
|
|
||||||
int potPlayers = 0;
|
int potPlayers = 0;
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(getMyHand()->getPlayerArray()[i]->getMyActiveStatus() && getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD) {
|
|
||||||
// potPlayers++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); it_c++) {
|
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); it_c++) {
|
||||||
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||||
@@ -83,11 +58,6 @@ void LocalBeRoPostRiver::postRiverRun() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// prüfen ob nur noch der human player an der verteilung teilnimmt und myAggressive für human player setzen
|
|
||||||
// getMyHand()->getPlayerArray()[0]->setMyAggressive(potPlayers == 1 && getMyHand()->getPlayerArray()[0]->getMyActiveStatus() && getMyHand()->getPlayerArray()[0]->getMyAction() != PLAYER_ACTION_FOLD);
|
|
||||||
|
|
||||||
|
|
||||||
// prüfen ob nur noch der human player an der verteilung teilnimmt und myAggressive für human player setzen
|
// prüfen ob nur noch der human player an der verteilung teilnimmt und myAggressive für human player setzen
|
||||||
it = getMyHand()->getActivePlayerIt(0);
|
it = getMyHand()->getActivePlayerIt(0);
|
||||||
if( it != getMyHand()->getActivePlayerList()->end() ) {
|
if( it != getMyHand()->getActivePlayerList()->end() ) {
|
||||||
@@ -96,8 +66,6 @@ void LocalBeRoPostRiver::postRiverRun() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// cout << "myAggressive: " << getMyHand()->getPlayerArray()[0]->getMyAggressive() << endl;
|
|
||||||
|
|
||||||
// Pot-Verteilung
|
// Pot-Verteilung
|
||||||
getMyHand()->getBoard()->distributePot();
|
getMyHand()->getBoard()->distributePot();
|
||||||
|
|
||||||
@@ -107,279 +75,3 @@ void LocalBeRoPostRiver::postRiverRun() {
|
|||||||
//starte die Animaionsreihe
|
//starte die Animaionsreihe
|
||||||
getMyHand()->getGuiInterface()->postRiverRunAnimation1();
|
getMyHand()->getGuiInterface()->postRiverRunAnimation1();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
void LocalBeRoPostRiver::distributePot() {
|
|
||||||
|
|
||||||
// int potCalcAllinArray[5][2]; // 0 -> ID , 1 -> AllInCash
|
|
||||||
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
////////////////////
|
|
||||||
// (1) EINLEITUNG //
|
|
||||||
////////////////////
|
|
||||||
|
|
||||||
// die Potverteilung gliedert sich in mehrere Runden:
|
|
||||||
// in der ersten Runden sucht sich der Winner der BettingRound seinen zustehenden Anteil am Pot raus. das kann alles oder nur ein Teil sein (z.b. wenn er mit wenig allin gegangen ist und der Rest weitergespielt hat)
|
|
||||||
// in den darauffolgenden Verteilungsrunden suchen sich die jeweils nᅵhsten Winner aus dem noch brig gebliebenen Pot ihren zustehenden Anteil raus
|
|
||||||
// die gesamte Potverteilung ist zuende, wenn der Pot leer ist und nichts mehr zu holen ist
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////
|
|
||||||
// (2) HILFSMITTEL //
|
|
||||||
/////////////////////
|
|
||||||
|
|
||||||
// winnersArray erstellen -> hier werden die winner der jeweiligen Potverteilungsrunden eingetragen
|
|
||||||
int *winnersArray = new int[MAX_NUMBER_OF_PLAYERS];
|
|
||||||
|
|
||||||
// Anzahl der winner in einer Potverteilungsrunde
|
|
||||||
int winnersCounter = 0;
|
|
||||||
|
|
||||||
// dieses Array ermittelt wieviel jeder Spieler wᅵrend der gesamten BettingRound gesetzt hat
|
|
||||||
int *roundSetArray = new int[MAX_NUMBER_OF_PLAYERS];
|
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// Standardwert fr nicht mehr aktive
|
|
||||||
roundSetArray[i] = 0;
|
|
||||||
// nur fr die Spieler ermitteln, die noch aktiv sind (inkl. der gefoldeten)
|
|
||||||
if(getMyHand()->getPlayerArray()[i]->getMyActiveStatus()) {
|
|
||||||
roundSetArray[i] = getMyHand()->getPlayerArray()[i]->getMyRoundStartCash()-getMyHand()->getPlayerArray()[i]->getMyCash();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// hier steht der CardsValue der Spieler drin die an der Potverteilung teilnehmen (d.h. aktiv und nicht gefoldet), bei allen anderen steht ne 0
|
|
||||||
int *cardsValueArray = new int[MAX_NUMBER_OF_PLAYERS];
|
|
||||||
int playerWantsPotCounter = 0;
|
|
||||||
|
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// Standardwert
|
|
||||||
cardsValueArray[i] = 0;
|
|
||||||
if(getMyHand()->getPlayerArray()[i]->getMyActiveStatus() && getMyHand()->getPlayerArray()[i]->getMyAction() != 1) {
|
|
||||||
// nur bei den Spielen den Kartenwert eintragen, die an der Potverteilung teilnehmen
|
|
||||||
cardsValueArray[i] = getMyHand()->getPlayerArray()[i]->getMyCardsValueInt();
|
|
||||||
playerWantsPotCounter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int winner;
|
|
||||||
int highestCardsValueTemp;
|
|
||||||
|
|
||||||
// fr SplitPotBerechnung;
|
|
||||||
int winnersSets;
|
|
||||||
int winnersMaxSet;
|
|
||||||
int winnersPot;
|
|
||||||
bool playerIsWinner;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
|
||||||
// (3) DIE SCHLEIFE //
|
|
||||||
//////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
// Potverteilungsrunden -> solange noch was aus dem pot zu vergeben ist
|
|
||||||
while(playerWantsPotCounter != 0 ) {
|
|
||||||
|
|
||||||
// highestCardsValueTemp zu Beginn der aktuellen Potverteilungsrunde auf Null setzen
|
|
||||||
highestCardsValueTemp = 0;
|
|
||||||
|
|
||||||
// aktuellen highestCardsValueTemp berechnen, von denen die noch an der Potverteilung teilnehmen
|
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
if(cardsValueArray[i] > highestCardsValueTemp ) {
|
|
||||||
highestCardsValueTemp = getMyHand()->getPlayerArray()[i]->getMyCardsValueInt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// zu Beginn der Potverteilungsrunde die Anzahl der winner auf 0 setzen
|
|
||||||
winnersCounter = 0;
|
|
||||||
// Siegerposition und -anzahl von denen ermitteln, die noch an der Potverteilung teilnehmen
|
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
if(cardsValueArray[i] == highestCardsValueTemp ) {
|
|
||||||
winnersArray[winnersCounter] = i;
|
|
||||||
winnersCounter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------
|
|
||||||
// A) nur einer hat aktulle Potverteilungsrunde gewonnen gewonnen
|
|
||||||
// --------------------------------------------------------------
|
|
||||||
if(winnersCounter == 1) {
|
|
||||||
|
|
||||||
// winnerID ist an der ersten Stelle im winnersArray
|
|
||||||
winner = winnersArray[0];
|
|
||||||
|
|
||||||
// Winner ist nicht All In gegangen -> bekommt den gesamten Pot
|
|
||||||
// if(getMyHand()->getPlayerArray()[winner]->getMyAction() != 6) {
|
|
||||||
//
|
|
||||||
// getMyHand()->getPlayerArray()[winner]->setMyCash(getMyHand()->getPlayerArray()[winner]->getMyCash()+getMyHand()->getBoard()->getPot());
|
|
||||||
// getMyHand()->getBoard()->setPot(0);
|
|
||||||
// playerWantsPotCounter = 1;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// Winner ist All In gegangen -> von denen die weniger gesetzt oder gefoldet hatten alles nehmen und von denen die mehr gesetzt hatten nur die eigenen Sets nehmen
|
|
||||||
// else {
|
|
||||||
|
|
||||||
// alle Spieler nacheinander durchgehen und prfen von wem man wieviel Geld aus dem Pot bekommt
|
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
|
|
||||||
// zuerst prfen ob ein gefoldeter Spieler was gesetzt hatte
|
|
||||||
if(i != winner && getMyHand()->getPlayerArray()[i]->getMyAction() == 1) {
|
|
||||||
|
|
||||||
// diesen Teil aus dem Pot holen
|
|
||||||
getMyHand()->getPlayerArray()[winner]->setMyCash(getMyHand()->getPlayerArray()[winner]->getMyCash()+roundSetArray[i]);
|
|
||||||
// Pot dementsprechend verkleinern
|
|
||||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - roundSetArray[i]);
|
|
||||||
// deren Sets auf Null seztzen -> in den nᅵhsten Potverteilungsrunden nimmt der Winner dann von diesen Spielern 0 Dollar aus dem Pot
|
|
||||||
roundSetArray[i] = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// nun nur von den Spielern holen, die noch an der Potverteilung teilnehmen und natrlich nicht von einem selber
|
|
||||||
if(i != winner && cardsValueArray[i] != 0) {
|
|
||||||
|
|
||||||
// zuerst alle rauspicken, die weniger oder das gleiche gesetzt hatten
|
|
||||||
if(roundSetArray[winner] >= roundSetArray[i]) {
|
|
||||||
|
|
||||||
// von denen alles holen
|
|
||||||
getMyHand()->getPlayerArray()[winner]->setMyCash(getMyHand()->getPlayerArray()[winner]->getMyCash()+roundSetArray[i]);
|
|
||||||
// Pot dementsprechend verkleinern
|
|
||||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - roundSetArray[i]);
|
|
||||||
// diese Spieler dann von der weiteren Potverteilung ausschlieᅵn
|
|
||||||
cardsValueArray[i] = 0;
|
|
||||||
playerWantsPotCounter--;
|
|
||||||
// deren Sets auf Null seztzen, da sie schon alles abgegeben haben
|
|
||||||
roundSetArray[i] = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
// nun alle Spieler die mehr gesetzt hatten
|
|
||||||
else {
|
|
||||||
|
|
||||||
// den eigenen Setanteil aus dem Pot holen
|
|
||||||
getMyHand()->getPlayerArray()[winner]->setMyCash(getMyHand()->getPlayerArray()[winner]->getMyCash()+roundSetArray[winner]);
|
|
||||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - roundSetArray[winner]);
|
|
||||||
// den Set des Gegners um den bereits abgenommenen Setanteil verkleinern
|
|
||||||
roundSetArray[i] = roundSetArray[i] - roundSetArray[winner];
|
|
||||||
// diese Spieler nehmen an der weiteren Potverteilung teil
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// zum Scluss noch eingenen Set wieder holen
|
|
||||||
getMyHand()->getPlayerArray()[winner]->setMyCash(getMyHand()->getPlayerArray()[winner]->getMyCash()+roundSetArray[winner]);
|
|
||||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - roundSetArray[winner]);
|
|
||||||
// nicht mehr an der weiteren Potverteilung teilnehmen, da man sich alles geholt hat was einem zusteht
|
|
||||||
cardsValueArray[winner] = 0;
|
|
||||||
playerWantsPotCounter--;
|
|
||||||
// eigene Sets auf Null seztzen, da sie eben eingesammelt wurden
|
|
||||||
roundSetArray[winner] = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// B) mehrere haben die aktuelle Potverteilungsrunde gewonnen -> SplitPot
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
else {
|
|
||||||
|
|
||||||
// hierfr wird ein temporᅵer WinnersPot erstellt; dort flieᅵn erstmal alle zustehenden Anteile aus dem Pot rauf; am Ende wird dies auf die Winners verteilt
|
|
||||||
winnersPot = 0;
|
|
||||||
// hᅵhster Set aller Winner
|
|
||||||
winnersMaxSet = 0;
|
|
||||||
|
|
||||||
// den hᅵhsten Set aller Winner ermitteln
|
|
||||||
for(i=0; i<winnersCounter; i++) {
|
|
||||||
if(roundSetArray[winnersArray[i]] > winnersMaxSet) winnersMaxSet = roundSetArray[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// gesamtSet aller Winner
|
|
||||||
winnersSets = 0;
|
|
||||||
for(i=0; i<winnersCounter; i++) {
|
|
||||||
winnersSets += roundSetArray[winnersArray[i]];
|
|
||||||
}
|
|
||||||
|
|
||||||
// alle Spieler nacheinander durchgehen und prfen von wem die Winner wieviel Geld aus dem Pot bekommen
|
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
|
|
||||||
// prfen ob Spieler i zu den Winnern gehᅵt
|
|
||||||
playerIsWinner = 0;
|
|
||||||
for(j=0; j<winnersCounter; j++) {
|
|
||||||
if(winnersArray[j] == i) playerIsWinner = 1; // -> Spieler i gehᅵt zu den Winnern
|
|
||||||
}
|
|
||||||
|
|
||||||
// zuerst prfen ob ein gefoldeter Spieler was gesetzt hatte
|
|
||||||
if(!playerIsWinner && getMyHand()->getPlayerArray()[i]->getMyAction() == 1) {
|
|
||||||
|
|
||||||
// diesen Teil aus dem Pot holen und dem winnersPot geben
|
|
||||||
winnersPot += roundSetArray[i];
|
|
||||||
// Pot dementsprechend verkleinern
|
|
||||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - roundSetArray[i]);
|
|
||||||
// deren Sets auf Null seztzen -> in den nᅵhsten Potverteilungsrunden nehmen die Winner dann von diesen Spielern 0 Dollar aus dem Pot
|
|
||||||
roundSetArray[i] = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// nun nur von den Spielern holen, die noch an der Potverteilung teilnehmen und natrlich nicht zu den Winnern gehᅵen
|
|
||||||
if(!playerIsWinner && cardsValueArray[i] != 0) {
|
|
||||||
|
|
||||||
// zuerst alle rauspicken, die weniger oder das gleiche gesetzt hatten
|
|
||||||
if(winnersMaxSet >= roundSetArray[i]) {
|
|
||||||
|
|
||||||
// von denen alles holen
|
|
||||||
winnersPot += roundSetArray[i];
|
|
||||||
// Pot dementsprechend verkleinern
|
|
||||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - roundSetArray[i]);
|
|
||||||
// diese Spieler dann von der weiteren Potverteilung ausschlieᅵn
|
|
||||||
cardsValueArray[i] = 0;
|
|
||||||
playerWantsPotCounter--;
|
|
||||||
// deren Sets auf Null seztzen, da sie schon alles abgegeben haben
|
|
||||||
roundSetArray[i] = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
// nun alle Spieler die mehr gesetzt hatten
|
|
||||||
else {
|
|
||||||
|
|
||||||
// den eigenen Setanteil aus dem Pot holen
|
|
||||||
winnersPot += winnersMaxSet;
|
|
||||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - winnersMaxSet);
|
|
||||||
// den Set des Gegners um den bereits abgenommenen Setanteil verkleinern
|
|
||||||
roundSetArray[i] = roundSetArray[i] - winnersMaxSet;
|
|
||||||
// diese Spieler nehmen an der weiteren Potverteilung teil
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// zum Schluss noch die eingenen Set aus dem Pot holen
|
|
||||||
winnersPot += winnersSets;
|
|
||||||
getMyHand()->getBoard()->setPot(getMyHand()->getBoard()->getPot() - winnersSets);
|
|
||||||
|
|
||||||
// winnersPot verteilen (anteilmᅵig)
|
|
||||||
for(i=0; i<winnersCounter; i++) {
|
|
||||||
getMyHand()->getPlayerArray()[winnersArray[i]]->setMyCash(getMyHand()->getPlayerArray()[winnersArray[i]]->getMyCash()+((roundSetArray[winnersArray[i]]*winnersPot)/winnersSets));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for(i=0; i<winnersCounter; i++) {
|
|
||||||
// nicht mehr an der weiteren Potverteilung teilnehmen, da man sich alle Winner dieser Verteilungsrunde ihren Anteil geholt haben
|
|
||||||
cardsValueArray[winnersArray[i]] = 0;
|
|
||||||
playerWantsPotCounter--;
|
|
||||||
// Sets auf Null seztzen, da sie eben eingesammelt wurden
|
|
||||||
roundSetArray[winnersArray[i]] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(getMyHand()->getBoard()->getPot() != 0) cout << "!!! Pot: " << getMyHand()->getBoard()->getPot() << endl;
|
|
||||||
|
|
||||||
delete[] winnersArray;
|
|
||||||
delete[] roundSetArray;
|
|
||||||
delete[] cardsValueArray;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|||||||
@@ -29,183 +29,92 @@ using namespace std;
|
|||||||
|
|
||||||
LocalBeRoPreflop::LocalBeRoPreflop(HandInterface* hi, int id, unsigned dP, int sB) : LocalBeRo(hi, id, dP, sB, GAME_STATE_PREFLOP)
|
LocalBeRoPreflop::LocalBeRoPreflop(HandInterface* hi, int id, unsigned dP, int sB) : LocalBeRo(hi, id, dP, sB, GAME_STATE_PREFLOP)
|
||||||
{
|
{
|
||||||
// PlayerListConstIterator it_c;
|
|
||||||
|
|
||||||
setHighestSet(2*getSmallBlind());
|
setHighestSet(2*getSmallBlind());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LocalBeRoPreflop::~LocalBeRoPreflop()
|
LocalBeRoPreflop::~LocalBeRoPreflop()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalBeRoPreflop::run() {
|
void LocalBeRoPreflop::run() {
|
||||||
|
|
||||||
if(getFirstRun()) {
|
if(getFirstRun()) {
|
||||||
|
|
||||||
|
PlayerListIterator it;
|
||||||
|
|
||||||
|
// search bigBlindPosition in runningPlayerList
|
||||||
|
PlayerListIterator bigBlindPositionIt = getMyHand()->getRunningPlayerIt(getBigBlindPositionId());
|
||||||
|
|
||||||
|
// more than 2 players are still active -> runningPlayerList is not empty
|
||||||
|
if(getMyHand()->getActivePlayerList()->size() > 2) {
|
||||||
|
|
||||||
|
// bigBlindPlayer not found in runningPlayerList (he is all in) -> bigBlindPlayer is not the running player before first action player
|
||||||
|
if(bigBlindPositionIt == getMyHand()->getRunningPlayerList()->end()) {
|
||||||
|
|
||||||
|
// search smallBlindPosition in runningPlayerList
|
||||||
|
PlayerListIterator smallBlindPositionIt = getMyHand()->getRunningPlayerIt(getSmallBlindPositionId());
|
||||||
|
|
||||||
|
// smallBlindPlayer not found in runningPlayerList (he is all in) -> next active player before smallBlindPlayer is running player before first action player
|
||||||
|
if(smallBlindPositionIt == getMyHand()->getRunningPlayerList()->end()) {
|
||||||
|
|
||||||
|
it = getMyHand()->getActivePlayerIt(getSmallBlindPositionId());
|
||||||
|
if(it == getMyHand()->getActivePlayerList()->end()) {
|
||||||
|
throw LocalException(__FILE__, __LINE__, ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
// determine bigBlindPosition -> old: delete
|
if(it == getMyHand()->getActivePlayerList()->begin()) it = getMyHand()->getActivePlayerList()->end();
|
||||||
// for(bigBlindPositionIt=getMyHand()->getActivePlayerList()->begin(); bigBlindPositionIt!=getMyHand()->getActivePlayerList()->end(); bigBlindPositionIt++) {
|
it--;
|
||||||
// if((*bigBlindPositionIt)->getMyButton() == BUTTON_BIG_BLIND) break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
setFirstRoundLastPlayersTurnId( (*it)->getMyUniqueID() );
|
||||||
|
|
||||||
// search player in runningPlayerList before first action player -> run() determine next player who will do first action
|
}
|
||||||
// PlayerListIterator it_1, it_2, it_3;
|
// smallBlindPlayer found in runningPlayerList -> running player before first action player
|
||||||
PlayerListIterator it;
|
else {
|
||||||
|
setFirstRoundLastPlayersTurnId( getSmallBlindPositionId() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// bigBlindPlayer found in runningPlayerList -> player before first action player
|
||||||
|
else {
|
||||||
|
setFirstRoundLastPlayersTurnId( getBigBlindPositionId() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// heads up -> dealer/smallBlindPlayer is first action player and bigBlindPlayer is player before
|
||||||
|
else {
|
||||||
|
|
||||||
// search bigBlindPosition in runningPlayerList -> old: delete
|
// bigBlindPlayer not found in runningPlayerList (he is all in) -> only smallBlind has to choose fold or call the bigBlindAmount
|
||||||
// it_1 = find(getMyHand()->getRunningPlayerList()->begin(), getMyHand()->getRunningPlayerList()->end(), *bigBlindPositionIt);
|
if(bigBlindPositionIt == getMyHand()->getRunningPlayerList()->end()) {
|
||||||
|
|
||||||
// search bigBlindPosition in runningPlayerList
|
// search smallBlindPosition in runningPlayerList
|
||||||
PlayerListIterator bigBlindPositionIt = getMyHand()->getRunningPlayerIt(getBigBlindPositionId());
|
PlayerListIterator smallBlindPositionIt = getMyHand()->getRunningPlayerIt(getSmallBlindPositionId());
|
||||||
|
|
||||||
// more than 2 players are still active -> runningPlayerList is not empty
|
// smallBlindPlayer not found in runningPlayerList (he is all in) -> no running player -> showdown and no firstRoundLastPlayersTurnId is used
|
||||||
if(getMyHand()->getActivePlayerList()->size() > 2) {
|
if(smallBlindPositionIt == getMyHand()->getRunningPlayerList()->end()) {
|
||||||
|
|
||||||
// bigBlindPlayer not found in runningPlayerList (he is all in) -> bigBlindPlayer is not the running player before first action player
|
}
|
||||||
if(bigBlindPositionIt == getMyHand()->getRunningPlayerList()->end()) {
|
// smallBlindPlayer found in runningPlayerList -> running player before first action player (himself)
|
||||||
|
else {
|
||||||
// search smallBlindPosition in runningPlayerList
|
setFirstRoundLastPlayersTurnId( getSmallBlindPositionId() );
|
||||||
PlayerListIterator smallBlindPositionIt = getMyHand()->getRunningPlayerIt(getSmallBlindPositionId());
|
|
||||||
// if(smallBlindPositionIt == getMyHand()->getActivePlayerList()->begin()) smallBlindPositionIt = getMyHand()->getActivePlayerList()->end();
|
|
||||||
// smallBlindPositionIt--;
|
|
||||||
// it_2 = find(getMyHand()->getRunningPlayerList()->begin(), getMyHand()->getRunningPlayerList()->end(), *smallBlindPositionIt);
|
|
||||||
|
|
||||||
// smallBlindPlayer not found in runningPlayerList (he is all in) -> next active player before smallBlindPlayer is running player before first action player
|
|
||||||
if(smallBlindPositionIt == getMyHand()->getRunningPlayerList()->end()) {
|
|
||||||
|
|
||||||
it = getMyHand()->getActivePlayerIt(getSmallBlindPositionId());
|
|
||||||
if(it == getMyHand()->getActivePlayerList()->end()) {
|
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_ACTIVE_PLAYER_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(it == getMyHand()->getActivePlayerList()->begin()) it = getMyHand()->getActivePlayerList()->end();
|
|
||||||
it--;
|
|
||||||
|
|
||||||
setFirstRoundLastPlayersTurnId( (*it)->getMyUniqueID() );
|
} else {
|
||||||
|
setFirstRoundLastPlayersTurnId( getBigBlindPositionId() );
|
||||||
|
|
||||||
// it_3 = find(getMyHand()->getRunningPlayerList()->begin(), getMyHand()->getRunningPlayerList()->end(), *it_2);
|
|
||||||
// if(it_3 == getMyHand()->getRunningPlayerList()->end()) {
|
|
||||||
// cout << "ERROR - lastPlayersTurnIt-detection in localBeRoPreflop" << endl;
|
|
||||||
// } else {
|
|
||||||
// setLastPlayersTurnIt(it_3);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
// smallBlindPlayer found in runningPlayerList -> running player before first action player
|
|
||||||
else {
|
|
||||||
setFirstRoundLastPlayersTurnId( getSmallBlindPositionId() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// bigBlindPlayer found in runningPlayerList -> player before first action player
|
|
||||||
else {
|
|
||||||
setFirstRoundLastPlayersTurnId( getBigBlindPositionId() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// heads up -> dealer/smallBlindPlayer is first action player and bigBlindPlayer is player before
|
|
||||||
else {
|
|
||||||
|
|
||||||
// bigBlindPlayer not found in runningPlayerList (he is all in) -> only smallBlind has to choose fold or call the bigBlindAmount
|
|
||||||
if(bigBlindPositionIt == getMyHand()->getRunningPlayerList()->end()) {
|
|
||||||
|
|
||||||
// search smallBlindPosition in runningPlayerList
|
|
||||||
PlayerListIterator smallBlindPositionIt = getMyHand()->getRunningPlayerIt(getSmallBlindPositionId());
|
|
||||||
|
|
||||||
// smallBlindPlayer not found in runningPlayerList (he is all in) -> no running player -> showdown and no firstRoundLastPlayersTurnId is used
|
|
||||||
if(smallBlindPositionIt == getMyHand()->getRunningPlayerList()->end()) {
|
|
||||||
|
|
||||||
}
|
|
||||||
// smallBlindPlayer found in runningPlayerList -> running player before first action player (himself)
|
|
||||||
else {
|
|
||||||
setFirstRoundLastPlayersTurnId( getSmallBlindPositionId() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
setFirstRoundLastPlayersTurnId( getBigBlindPositionId() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setCurrentPlayersTurnId( getFirstRoundLastPlayersTurnId() );
|
|
||||||
|
|
||||||
// cout << "playerID constructor beropreflop: " << (*(getCurrentPlayersTurnIt()))->getMyID() << endl;
|
|
||||||
|
|
||||||
|
|
||||||
/////////////// testing
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// it_1 = find(getMyHand()->getRunningPlayerList()->begin(), getMyHand()->getRunningPlayerList()->end(), *bigBlindPositionIt);
|
|
||||||
|
|
||||||
// bigBlindPosition is not all in
|
|
||||||
// if(it!=getMyHand()->getRunningPlayerList()->end()) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// if(it_1!=getMyHand()->getRunningPlayerList()->end()) {
|
|
||||||
// cout << getMyHand()->getMyID() << ": " << "gefunden!" << endl;
|
|
||||||
// cout << "\t PlayerID: " << (*it_1)->getMyID() << endl;
|
|
||||||
// it_2 = it_1;
|
|
||||||
// if(it_1 == getMyHand()->getRunningPlayerList()->begin()) it_1 = getMyHand()->getRunningPlayerList()->end();
|
|
||||||
// it_1--;
|
|
||||||
// cout << "\t PlayerID vor bigBlind: " << (*it_1)->getMyID() << endl;
|
|
||||||
// cout << "\t PlayerID vor bigBlind: " << (*it_2)->getMyID() << endl;
|
|
||||||
// } else {
|
|
||||||
// cout << getMyHand()->getMyID() << ": " << "nicht gefunden" << endl;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
//////////////// old
|
|
||||||
|
|
||||||
// set first runningPlayer before bigBlindPlayer to playersTurn -> run() determine next one who will do first action
|
|
||||||
// setPlayersTurn((*bigBlindPositionIt)->getMyID());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setCurrentPlayersTurnId( getFirstRoundLastPlayersTurnId() );
|
||||||
|
|
||||||
setFirstRun(false);
|
setFirstRun(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
bool allHighestSet = true;
|
bool allHighestSet = true;
|
||||||
// PlayerListIterator it;
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
|
|
||||||
|
// check if all running players have same sets (else allHighestSet = false)
|
||||||
|
|
||||||
// test if all running players have same sets (else allHighestSet = false)
|
|
||||||
for(it_c=getMyHand()->getRunningPlayerList()->begin(); it_c!=getMyHand()->getRunningPlayerList()->end(); it_c++) {
|
for(it_c=getMyHand()->getRunningPlayerList()->begin(); it_c!=getMyHand()->getRunningPlayerList()->end(); it_c++) {
|
||||||
if(getHighestSet() != (*it_c)->getMySet()) {
|
if(getHighestSet() != (*it_c)->getMySet()) {
|
||||||
allHighestSet = false;
|
allHighestSet = false;
|
||||||
@@ -214,17 +123,6 @@ void LocalBeRoPreflop::run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// determine next player
|
// determine next player
|
||||||
|
|
||||||
// cout << "playerID begin preflopRun(): " << (*(getCurrentPlayersTurnIt()))->getMyID() << endl;
|
|
||||||
|
|
||||||
// it++;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// cout << "size: " << getMyHand()->getRunningPlayerList()->size() << endl;
|
|
||||||
|
|
||||||
// cout << "currentPlayerID: " << getCurrentPlayersTurnId() << endl;
|
|
||||||
|
|
||||||
PlayerListConstIterator currentPlayersTurnIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
|
PlayerListConstIterator currentPlayersTurnIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
|
||||||
if(currentPlayersTurnIt == getMyHand()->getRunningPlayerList()->end()) {
|
if(currentPlayersTurnIt == getMyHand()->getRunningPlayerList()->end()) {
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||||
@@ -235,72 +133,6 @@ void LocalBeRoPreflop::run() {
|
|||||||
|
|
||||||
setCurrentPlayersTurnId( (*currentPlayersTurnIt)->getMyUniqueID() );
|
setCurrentPlayersTurnId( (*currentPlayersTurnIt)->getMyUniqueID() );
|
||||||
|
|
||||||
// setCurrentPlayersTurnIt(++getCurrentPlayersTurnIt());
|
|
||||||
// if(getCurrentPlayersTurnIt() == getMyHand()->getRunningPlayerList()->end()) setCurrentPlayersTurnIt(getMyHand()->getRunningPlayerList()->begin());
|
|
||||||
|
|
||||||
// if(getCurrentPlayersTurnIt() == getMyHand()->getRunningPlayerList()->end()) cout << "!!!" << endl;
|
|
||||||
|
|
||||||
// cout << "playerID middle preflopRun(): " << (*(getCurrentPlayersTurnIt()))->getMyID() << endl;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PlayerListConstIterator currentPlayersTurnConstIt;
|
|
||||||
// exceptions
|
|
||||||
// no.1: if in first Preflop Round next player is small blind and only all-in-big-blind with less than smallblind amount is nonfold too -> preflop is over
|
|
||||||
// if(getFirstRound()) {
|
|
||||||
// PlayerListConstIterator bigBlindPositionIt = getMyHand()->getActivePlayerIt(getBigBlindPositionId());
|
|
||||||
// assert(bigBlindPositionIt != getMyHand()->getActivePlayerList()->end());
|
|
||||||
//
|
|
||||||
// currentPlayersTurnConstIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
|
|
||||||
// assert(currentPlayersTurnConstIt != getMyHand()->getRunningPlayerList()->end());
|
|
||||||
//
|
|
||||||
// int nonFoldPlayerCounter = 0;
|
|
||||||
// for (it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); it_c++) {
|
|
||||||
// if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonFoldPlayerCounter++;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if((*currentPlayersTurnConstIt)->getMyButton() == BUTTON_SMALL_BLIND && (*bigBlindPositionIt)->getMySet() <= getSmallBlind() && nonFoldPlayerCounter == 2) {
|
|
||||||
// setFirstRound(false);
|
|
||||||
// allHighestSet = true;
|
|
||||||
// getMyHand()->setAllInCondition(true);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// determine next player
|
|
||||||
// for(i=0; (i<MAX_NUMBER_OF_PLAYERS && (!(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyActiveStatus()) || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_FOLD || getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyAction() == PLAYER_ACTION_ALLIN)) || i==0; i++) {
|
|
||||||
//
|
|
||||||
// setPlayersTurn((getPlayersTurn()+1)%(MAX_NUMBER_OF_PLAYERS));
|
|
||||||
// // falls BigBlind, dann PreflopFirstRound zuende
|
|
||||||
// if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_BIG_BLIND && (*bigBlindPositionIt)->getMySet() < 2*getSmallBlind()) setFirstRound(false);
|
|
||||||
// // if next player is small blind and only all-in-big-blind with <= 2*smallblind is nonfold too
|
|
||||||
// if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_SMALL_BLIND && (*bigBlindPositionIt)->getMySet() <= getSmallBlind() && getMyHand()->getRunningPlayerList()->size() == 1) {
|
|
||||||
// setFirstRound(false);
|
|
||||||
// allHighestSet = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// cout << "firstRound. " << getFirstRound() << " - allHighestSet: " << allHighestSet << endl;
|
|
||||||
|
|
||||||
// prfen, ob Preflop wirklich dran ist
|
// prfen, ob Preflop wirklich dran ist
|
||||||
if(!getFirstRound() && allHighestSet) {
|
if(!getFirstRound() && allHighestSet) {
|
||||||
|
|
||||||
@@ -308,19 +140,11 @@ void LocalBeRoPreflop::run() {
|
|||||||
//also gehe in Flop
|
//also gehe in Flop
|
||||||
getMyHand()->setCurrentRound(GAME_STATE_FLOP);
|
getMyHand()->setCurrentRound(GAME_STATE_FLOP);
|
||||||
|
|
||||||
// exception no.1 - see above
|
|
||||||
// if(getMyHand()->getAllInCondition()) getMyHand()->setCurrentRound(GAME_STATE_PREFLOP);;
|
|
||||||
|
|
||||||
//Action loeschen und ActionButtons refresh
|
//Action loeschen und ActionButtons refresh
|
||||||
for(it_c=getMyHand()->getRunningPlayerList()->begin(); it_c!=getMyHand()->getRunningPlayerList()->end(); it_c++) {
|
for(it_c=getMyHand()->getRunningPlayerList()->begin(); it_c!=getMyHand()->getRunningPlayerList()->end(); it_c++) {
|
||||||
(*it_c)->setMyAction(PLAYER_ACTION_NONE);
|
(*it_c)->setMyAction(PLAYER_ACTION_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Action loeschen und ActionButtons refresh
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD && getMyHand()->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_ALLIN) getMyHand()->getPlayerArray()[i]->setMyAction(PLAYER_ACTION_NONE);
|
|
||||||
// }
|
|
||||||
|
|
||||||
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
|
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
|
||||||
getMyHand()->getBoard()->collectSets();
|
getMyHand()->getBoard()->collectSets();
|
||||||
getMyHand()->getBoard()->collectPot();
|
getMyHand()->getBoard()->collectPot();
|
||||||
@@ -333,36 +157,17 @@ void LocalBeRoPreflop::run() {
|
|||||||
getMyHand()->switchRounds();
|
getMyHand()->switchRounds();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Preflop ist wirklich dran
|
|
||||||
|
|
||||||
// falls BigBlind, dann PreflopFirstRound zuende
|
|
||||||
// if(getMyHand()->getPlayerArray()[getPlayersTurn()]->getMyButton() == BUTTON_BIG_BLIND) setFirstRound(0);
|
|
||||||
|
|
||||||
// lastPlayersTurn -> PreflopFirstRound is over
|
|
||||||
// if( (*(getCurrentPlayersTurnIt())) == (*(getLastPlayersTurnIt())) ) {
|
|
||||||
// setFirstRound(false);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// lastPlayersTurn -> PreflopFirstRound is over
|
// lastPlayersTurn -> PreflopFirstRound is over
|
||||||
if( getCurrentPlayersTurnId() == getFirstRoundLastPlayersTurnId() ) {
|
if( getCurrentPlayersTurnId() == getFirstRoundLastPlayersTurnId() ) {
|
||||||
setFirstRound(false);
|
setFirstRound(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// getMyHand()->getPlayerArray()[getPlayersTurn()]->setMyTurn(1);
|
|
||||||
|
|
||||||
currentPlayersTurnIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
|
currentPlayersTurnIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
|
||||||
if(currentPlayersTurnIt == getMyHand()->getRunningPlayerList()->end()) {
|
if(currentPlayersTurnIt == getMyHand()->getRunningPlayerList()->end()) {
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||||
}
|
}
|
||||||
(*currentPlayersTurnIt)->setMyTurn(true);
|
(*currentPlayersTurnIt)->setMyTurn(true);
|
||||||
|
|
||||||
// (*(getCurrentPlayersTurnIt()))->setMyTurn(true);
|
|
||||||
|
|
||||||
//highlight active players groupbox and clear action
|
|
||||||
// getMyHand()->getGuiInterface()->refreshGroupbox(getPlayersTurn(),2);
|
|
||||||
// getMyHand()->getGuiInterface()->refreshAction(getPlayersTurn(),PLAYER_ACTION_NONE);
|
|
||||||
|
|
||||||
//highlight active players groupbox and clear action
|
//highlight active players groupbox and clear action
|
||||||
getMyHand()->getGuiInterface()->refreshGroupbox( getCurrentPlayersTurnId() , 2 );
|
getMyHand()->getGuiInterface()->refreshGroupbox( getCurrentPlayersTurnId() , 2 );
|
||||||
getMyHand()->getGuiInterface()->refreshAction( getCurrentPlayersTurnId() , PLAYER_ACTION_NONE );
|
getMyHand()->getGuiInterface()->refreshAction( getCurrentPlayersTurnId() , PLAYER_ACTION_NONE );
|
||||||
@@ -374,7 +179,6 @@ void LocalBeRoPreflop::run() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//Gegner sind dran
|
//Gegner sind dran
|
||||||
// cout << "NextPlayerSpeed3 start" << endl;
|
|
||||||
getMyHand()->getGuiInterface()->beRoAnimation2(getMyBeRoID());
|
getMyHand()->getGuiInterface()->beRoAnimation2(getMyBeRoID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,17 +26,15 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
LocalBoard::LocalBoard() : BoardInterface(), /*playerArray(0),*/ currentHand(0), pot(0), sets(0)
|
LocalBoard::LocalBoard() : BoardInterface(), currentHand(0), pot(0), sets(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LocalBoard::~LocalBoard()
|
LocalBoard::~LocalBoard()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalBoard::setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> > sl_old, */PlayerList sl, PlayerList apl, PlayerList rpl) {
|
void LocalBoard::setPlayerLists(PlayerList sl, PlayerList apl, PlayerList rpl) {
|
||||||
// playerArray = sl_old; // delete
|
|
||||||
seatsList = sl;
|
seatsList = sl;
|
||||||
activePlayerList = apl;
|
activePlayerList = apl;
|
||||||
runningPlayerList = rpl;
|
runningPlayerList = rpl;
|
||||||
@@ -47,22 +45,18 @@ void LocalBoard::setHand(HandInterface* br) { currentHand = br; }
|
|||||||
void LocalBoard::collectSets() {
|
void LocalBoard::collectSets() {
|
||||||
|
|
||||||
sets = 0;
|
sets = 0;
|
||||||
// int i;
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) sets += playerArray[i]->getMySet(); //delete
|
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++) {
|
for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++) {
|
||||||
sets += (*it_c)->getMySet();
|
sets += (*it_c)->getMySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalBoard::collectPot() {
|
void LocalBoard::collectPot() {
|
||||||
// int i;
|
|
||||||
pot += sets;
|
pot += sets;
|
||||||
sets = 0;
|
sets = 0;
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++){ playerArray[i]->setMySetNull(); }
|
|
||||||
|
|
||||||
PlayerListIterator it;
|
PlayerListIterator it;
|
||||||
for(it=seatsList->begin(); it!=seatsList->end(); it++) {
|
for(it=seatsList->begin(); it!=seatsList->end(); it++) {
|
||||||
@@ -79,16 +73,6 @@ void LocalBoard::distributePot() {
|
|||||||
PlayerListIterator it;
|
PlayerListIterator it;
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
|
|
||||||
// filling player sets vector
|
|
||||||
// vector<int> playerSets;
|
|
||||||
// for(i=0; i<(size_t)MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(playerArray[i]->getMyActiveStatus()) {
|
|
||||||
// playerSets.push_back(((playerArray[i]->getMyRoundStartCash())-(playerArray[i]->getMyCash())));
|
|
||||||
// } else {
|
|
||||||
// playerSets.push_back(0);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// filling player sets vector
|
// filling player sets vector
|
||||||
vector<int> playerSets;
|
vector<int> playerSets;
|
||||||
for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++) {
|
for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++) {
|
||||||
@@ -99,7 +83,6 @@ void LocalBoard::distributePot() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// sort player sets asc
|
// sort player sets asc
|
||||||
vector<int> playerSetsSort = playerSets;
|
vector<int> playerSetsSort = playerSets;
|
||||||
sort(playerSetsSort.begin(), playerSetsSort.end());
|
sort(playerSetsSort.begin(), playerSetsSort.end());
|
||||||
@@ -130,30 +113,14 @@ void LocalBoard::distributePot() {
|
|||||||
potLevel.push_back((playerSetsSort.size()-i)*potLevel[0]);
|
potLevel.push_back((playerSetsSort.size()-i)*potLevel[0]);
|
||||||
|
|
||||||
// determine level highestCardsValue
|
// determine level highestCardsValue
|
||||||
// for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
|
for(it_c=seatsList->begin(), j=0; it_c!=seatsList->end(); it_c++,j++) {
|
||||||
// if(playerArray[j]->getMyCardsValueInt() > highestCardsValue && playerArray[j]->getMyActiveStatus() && playerArray[j]->getMyAction() != PLAYER_ACTION_FOLD && playerSets[j] >= potLevel[0]) {
|
|
||||||
// highestCardsValue = playerArray[j]->getMyCardsValueInt();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// determine level highestCardsValue
|
|
||||||
j=0;
|
|
||||||
for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++,j++) {
|
|
||||||
if((*it_c)->getMyActiveStatus() && (*it_c)->getMyCardsValueInt() > highestCardsValue && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && playerSets[j] >= potLevel[0]) {
|
if((*it_c)->getMyActiveStatus() && (*it_c)->getMyCardsValueInt() > highestCardsValue && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && playerSets[j] >= potLevel[0]) {
|
||||||
highestCardsValue = (*it_c)->getMyCardsValueInt();
|
highestCardsValue = (*it_c)->getMyCardsValueInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// level winners
|
// level winners
|
||||||
// for(j=0; j<MAX_NUMBER_OF_PLAYERS; j++) {
|
for(it_c=seatsList->begin(), j=0; it_c!=seatsList->end(); it_c++,j++) {
|
||||||
// if(highestCardsValue == playerArray[j]->getMyCardsValueInt() && playerArray[j]->getMyActiveStatus() && playerArray[j]->getMyAction() != PLAYER_ACTION_FOLD && playerSets[j] >= potLevel[0]) {
|
|
||||||
// potLevel.push_back(playerArray[j]->getMyID());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// level winners
|
|
||||||
j=0;
|
|
||||||
for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++,j++) {
|
|
||||||
if((*it_c)->getMyActiveStatus() && highestCardsValue == (*it_c)->getMyCardsValueInt() && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && playerSets[j] >= potLevel[0]) {
|
if((*it_c)->getMyActiveStatus() && highestCardsValue == (*it_c)->getMyCardsValueInt() && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && playerSets[j] >= potLevel[0]) {
|
||||||
potLevel.push_back((*it_c)->getMyUniqueID());
|
potLevel.push_back((*it_c)->getMyUniqueID());
|
||||||
}
|
}
|
||||||
@@ -169,9 +136,6 @@ void LocalBoard::distributePot() {
|
|||||||
mod = (potLevel[1])%winnerCount;
|
mod = (potLevel[1])%winnerCount;
|
||||||
// pot level sum divisible by winnerCount
|
// pot level sum divisible by winnerCount
|
||||||
if(mod == 0) {
|
if(mod == 0) {
|
||||||
// for(j=2; j<potLevel.size(); j++) {
|
|
||||||
// playerArray[potLevel[j]]->setMyCash(playerArray[potLevel[j]]->getMyCash() + ((potLevel[1])/winnerCount));
|
|
||||||
// }
|
|
||||||
|
|
||||||
for(j=2; j<potLevel.size(); j++) {
|
for(j=2; j<potLevel.size(); j++) {
|
||||||
it = currentHand->getSeatIt(potLevel[j]);
|
it = currentHand->getSeatIt(potLevel[j]);
|
||||||
@@ -207,13 +171,6 @@ void LocalBoard::distributePot() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(j<mod) {
|
|
||||||
// playerArray[winnerPointer]->setMyCash(playerArray[winnerPointer]->getMyCash() + (int)((potLevel[1])/winnerCount) + 1);
|
|
||||||
// } else {
|
|
||||||
// playerArray[winnerPointer]->setMyCash(playerArray[winnerPointer]->getMyCash() + (int)((potLevel[1])/winnerCount));
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
it = currentHand->getSeatIt(winnerPointer);
|
it = currentHand->getSeatIt(winnerPointer);
|
||||||
if(it == seatsList->end()) {
|
if(it == seatsList->end()) {
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||||
@@ -260,18 +217,12 @@ void LocalBoard::distributePot() {
|
|||||||
if(pot!=0) cout << "distributePot-ERROR: Pot = " << pot << endl;
|
if(pot!=0) cout << "distributePot-ERROR: Pot = " << pot << endl;
|
||||||
|
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
// for(i=0; i<(size_t)MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(playerArray[i]->getMyActiveStatus())
|
|
||||||
// sum += playerArray[i]->getMyCash();
|
|
||||||
// }
|
|
||||||
|
|
||||||
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
||||||
sum += (*it_c)->getMyCash();
|
sum += (*it_c)->getMyCash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(sum != (currentHand->getStartQuantityPlayers() * currentHand->getStartCash()))
|
if(sum != (currentHand->getStartQuantityPlayers() * currentHand->getStartCash()))
|
||||||
cout << "distributePot-ERROR: PlayersSumCash = " << sum << endl;
|
cout << "distributePot-ERROR: PlayersSumCash = " << sum << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
LocalBoard();
|
LocalBoard();
|
||||||
~LocalBoard();
|
~LocalBoard();
|
||||||
|
|
||||||
void setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList);
|
void setPlayerLists(PlayerList, PlayerList, PlayerList);
|
||||||
void setHand(HandInterface*);
|
void setHand(HandInterface*);
|
||||||
|
|
||||||
void setMyCards(int* theValue) { int i; for(i=0; i<5; i++) myCards[i] = theValue[i]; }
|
void setMyCards(int* theValue) { int i; for(i=0; i<5; i++) myCards[i] = theValue[i]; }
|
||||||
@@ -55,7 +55,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
|
|
||||||
PlayerList seatsList;
|
PlayerList seatsList;
|
||||||
PlayerList activePlayerList;
|
PlayerList activePlayerList;
|
||||||
PlayerList runningPlayerList;
|
PlayerList runningPlayerList;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ LocalEngineFactory::~LocalEngineFactory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HandInterface* LocalEngineFactory::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 LocalHand(f, g, b, /*sl_old,*/ sl, apl, rpl, id, sP, dP, sB, sC); }
|
HandInterface* LocalEngineFactory::createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC) { return new LocalHand(f, g, b, sl, apl, rpl, id, sP, dP, sB, sC); }
|
||||||
|
|
||||||
BoardInterface* LocalEngineFactory::createBoard() { return new LocalBoard; }
|
BoardInterface* LocalEngineFactory::createBoard() { return new LocalBoard; }
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
LocalEngineFactory(ConfigFile*);
|
LocalEngineFactory(ConfigFile*);
|
||||||
~LocalEngineFactory();
|
~LocalEngineFactory();
|
||||||
|
|
||||||
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);
|
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
|
||||||
BoardInterface* createBoard();
|
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);
|
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);
|
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, unsigned dP, int sB);
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
LocalHand::LocalHand(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, unsigned dP, int sB,int sC)
|
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, unsigned dP, int sB,int sC)
|
||||||
: myFactory(f), myGui(g), myBoard(b), /*playerArray(sl_old),*/ seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(false),
|
: myFactory(f), myGui(g), myBoard(b), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myBeRo(0), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(false),
|
||||||
cardsShown(false), bettingRoundsPlayed(0)
|
cardsShown(false), bettingRoundsPlayed(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -41,25 +41,13 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
|||||||
|
|
||||||
myBoard->setHand(this);
|
myBoard->setHand(this);
|
||||||
|
|
||||||
// for(i=0; i<startQuantityPlayers; i++) {
|
|
||||||
// playerArray[i]->setHand(this);
|
|
||||||
// // myFlipCards auf 0 setzen
|
|
||||||
// playerArray[i]->setMyCardsFlip(0, 0);
|
|
||||||
// }
|
|
||||||
|
|
||||||
for(it=seatsList->begin(); it!=seatsList->end(); it++) {
|
for(it=seatsList->begin(); it!=seatsList->end(); it++) {
|
||||||
(*it)->setHand(this);
|
(*it)->setHand(this);
|
||||||
// myFlipCards auf 0 setzen
|
// set myFlipCards 0
|
||||||
(*it)->setMyCardsFlip(0, 0);
|
(*it)->setMyCardsFlip(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generate cards and assign to board and player
|
||||||
// roundStartCashArray fllen
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// playerArray[i]->setMyRoundStartCash(playerArray[i]->getMyCash());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Karten generieren und Board sowie Player zuweisen
|
|
||||||
int *cardsArray = new int[2*activePlayerList->size()+5];
|
int *cardsArray = new int[2*activePlayerList->size()+5];
|
||||||
Tools::getRandNumber(0, 51, 2*activePlayerList->size()+5, cardsArray, 1);
|
Tools::getRandNumber(0, 51, 2*activePlayerList->size()+5, cardsArray, 1);
|
||||||
int tempBoardArray[5];
|
int tempBoardArray[5];
|
||||||
@@ -88,14 +76,14 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
|||||||
(*it)->setMyBestHandPosition(bestHandPos);
|
(*it)->setMyBestHandPosition(bestHandPos);
|
||||||
(*it)->setMyRoundStartCash((*it)->getMyCash());
|
(*it)->setMyRoundStartCash((*it)->getMyCash());
|
||||||
|
|
||||||
// myBestHandPosition auf Fehler ueberpruefen
|
// error-check
|
||||||
for(j=0; j<5; j++) {
|
for(j=0; j<5; j++) {
|
||||||
if (bestHandPos[j] == -1) {
|
if (bestHandPos[j] == -1) {
|
||||||
cout << "ERROR getMyBestHandPosition in localhand.cpp" << endl;
|
cout << "ERROR getMyBestHandPosition in localhand.cpp" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sBluff für alle aktiver Spieler außer human player setzen --> TODO for ai-player in internet
|
// set sBluff for all players --> TODO for ai-player in internet
|
||||||
if((*it)->getMyID() != 0) {
|
if((*it)->getMyID() != 0) {
|
||||||
Tools::getRandNumber(1,100,1,&sBluff,0);
|
Tools::getRandNumber(1,100,1,&sBluff,0);
|
||||||
(*it)->setSBluff(sBluff);
|
(*it)->setSBluff(sBluff);
|
||||||
@@ -327,7 +315,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
|
|||||||
|
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
// Dealer, SB, BB bestimmen
|
// determine dealer, SB, BB
|
||||||
assignButtons();
|
assignButtons();
|
||||||
|
|
||||||
myBeRo = myFactory->createBeRo(this, myID, dealerPosition, smallBlind);
|
myBeRo = myFactory->createBeRo(this, myID, dealerPosition, smallBlind);
|
||||||
@@ -351,13 +339,13 @@ void LocalHand::start() {
|
|||||||
else { cout << "Log Error: cannot find sBID or bBID" << "\n"; }
|
else { cout << "Log Error: cannot find sBID or bBID" << "\n"; }
|
||||||
myGui->flushLogAtHand();
|
myGui->flushLogAtHand();
|
||||||
|
|
||||||
// Karten austeilen
|
// deal cards
|
||||||
myGui->dealHoleCards();
|
myGui->dealHoleCards();
|
||||||
|
|
||||||
getBoard()->collectSets();
|
getBoard()->collectSets();
|
||||||
getGuiInterface()->refreshPot();
|
getGuiInterface()->refreshPot();
|
||||||
|
|
||||||
//Rundenwechsel | beim ersten Durchlauf --> Preflop starten
|
// change rounds | first start preflop
|
||||||
myGui->nextPlayerAnimation();
|
myGui->nextPlayerAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,18 +355,12 @@ void LocalHand::assignButtons() {
|
|||||||
PlayerListIterator it;
|
PlayerListIterator it;
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
|
|
||||||
// alle Buttons loeschen
|
// delete all buttons
|
||||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { playerArray[i]->setMyButton(0); }
|
|
||||||
|
|
||||||
// alle Buttons loeschen
|
|
||||||
for (it=seatsList->begin(); it!=seatsList->end(); it++) {
|
for (it=seatsList->begin(); it!=seatsList->end(); it++) {
|
||||||
(*it)->setMyButton(BUTTON_NONE);
|
(*it)->setMyButton(BUTTON_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DealerButton zuweisen
|
// assign dealer button
|
||||||
// playerArray[dealerPosition]->setMyButton(1);
|
|
||||||
|
|
||||||
// DealerButton zuweisen
|
|
||||||
it = getSeatIt(dealerPosition);
|
it = getSeatIt(dealerPosition);
|
||||||
if(it == seatsList->end()) {
|
if(it == seatsList->end()) {
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||||
@@ -386,32 +368,6 @@ void LocalHand::assignButtons() {
|
|||||||
(*it)->setMyButton(BUTTON_DEALER);
|
(*it)->setMyButton(BUTTON_DEALER);
|
||||||
|
|
||||||
|
|
||||||
// assign Small Blind next to dealer. ATTENTION: in heads up it is big blind
|
|
||||||
// i = dealerPosition;
|
|
||||||
//
|
|
||||||
// for(j=0; (j<MAX_NUMBER_OF_PLAYERS && !(playerArray[i]->getMyActiveStatus())) || j==0; j++) {
|
|
||||||
//
|
|
||||||
// i = (i+1)%(MAX_NUMBER_OF_PLAYERS);
|
|
||||||
// if(playerArray[i]->getMyActiveStatus()) {
|
|
||||||
// if(activePlayerList->size() > 2) playerArray[i]->setMyButton(2); //small blind normal
|
|
||||||
// else playerArray[i]->setMyButton(3); //big blind in heads up
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// assign big blind next to small blind. ATTENTION: in heads up it is small blind
|
|
||||||
// for(j=0; (j<MAX_NUMBER_OF_PLAYERS && !(playerArray[i]->getMyActiveStatus())) || j==0; j++) {
|
|
||||||
//
|
|
||||||
// i = (i+1)%(MAX_NUMBER_OF_PLAYERS);
|
|
||||||
// if(playerArray[i]->getMyActiveStatus()) {
|
|
||||||
// if(activePlayerList->size() > 2) playerArray[i]->setMyButton(3); //big blind normal
|
|
||||||
// else playerArray[i]->setMyButton(2); //small blind in heads up
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// assign Small Blind next to dealer. ATTENTION: in heads up it is big blind
|
// assign Small Blind next to dealer. ATTENTION: in heads up it is big blind
|
||||||
// assign big blind next to small blind. ATTENTION: in heads up it is small blind
|
// assign big blind next to small blind. ATTENTION: in heads up it is small blind
|
||||||
bool nextActivePlayerFound = false;
|
bool nextActivePlayerFound = false;
|
||||||
@@ -445,24 +401,6 @@ void LocalHand::assignButtons() {
|
|||||||
throw LocalException(__FILE__, __LINE__, ERR_NEXT_ACTIVE_PLAYER_NOT_FOUND);
|
throw LocalException(__FILE__, __LINE__, ERR_NEXT_ACTIVE_PLAYER_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//do sets --> TODO switch?
|
//do sets --> TODO switch?
|
||||||
for (it_c=runningPlayerList->begin(); it_c!=runningPlayerList->end(); it_c++) {
|
for (it_c=runningPlayerList->begin(); it_c!=runningPlayerList->end(); it_c++) {
|
||||||
|
|
||||||
@@ -475,8 +413,6 @@ void LocalHand::assignButtons() {
|
|||||||
(*it_c)->setMySet((*it_c)->getMyCash());
|
(*it_c)->setMySet((*it_c)->getMyCash());
|
||||||
// 1 to do not log this
|
// 1 to do not log this
|
||||||
(*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1);
|
(*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1);
|
||||||
// delete this player from runningPlayerList
|
|
||||||
// it_c = runningPlayerList->erase(it_c);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -493,8 +429,6 @@ void LocalHand::assignButtons() {
|
|||||||
(*it_c)->setMySet((*it_c)->getMyCash());
|
(*it_c)->setMySet((*it_c)->getMyCash());
|
||||||
// 1 to do not log this
|
// 1 to do not log this
|
||||||
(*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1);
|
(*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1);
|
||||||
// delete this player from runningPlayerList
|
|
||||||
// it_c = runningPlayerList->erase(it_c);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -507,8 +441,6 @@ void LocalHand::assignButtons() {
|
|||||||
|
|
||||||
void LocalHand::switchRounds() {
|
void LocalHand::switchRounds() {
|
||||||
|
|
||||||
// cout << "playerID begin switchRounds(): " << getCurrentBeRo()->get
|
|
||||||
|
|
||||||
PlayerListIterator it, it_1;
|
PlayerListIterator it, it_1;
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
|
|
||||||
@@ -530,51 +462,38 @@ void LocalHand::switchRounds() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anzahl der Spieler ermitteln, welche All In sind
|
// determine number of all in players
|
||||||
int allInPlayersCounter = 0;
|
int allInPlayersCounter = 0;
|
||||||
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
||||||
if ((*it_c)->getMyAction() == PLAYER_ACTION_ALLIN) allInPlayersCounter++;
|
if ((*it_c)->getMyAction() == PLAYER_ACTION_ALLIN) allInPlayersCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cout << "allInPlayersCounter: " << allInPlayersCounter << endl;
|
// determine number of non-fold players
|
||||||
|
|
||||||
// TODO -> runningPlayerList.size()
|
|
||||||
int nonFoldPlayerCounter = 0;
|
int nonFoldPlayerCounter = 0;
|
||||||
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
for (it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
||||||
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonFoldPlayerCounter++;
|
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonFoldPlayerCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cout << "nonFoldPlayerCounter: " << nonFoldPlayerCounter << endl;
|
// if only one player non-fold -> distribute pot
|
||||||
|
|
||||||
//wenn nur noch einer nicht-folded dann gleich den Pot verteilen
|
|
||||||
if(nonFoldPlayerCounter==1) {
|
if(nonFoldPlayerCounter==1) {
|
||||||
myBoard->collectPot();
|
myBoard->collectPot();
|
||||||
myGui->refreshPot();
|
myGui->refreshPot();
|
||||||
myGui->refreshSet();
|
myGui->refreshSet();
|
||||||
currentRound = 4;
|
currentRound = 4;
|
||||||
}
|
}
|
||||||
// prfen der All In Kondition
|
|
||||||
// fr All In Prozedur mssen mindestens zwei aktive Player vorhanden sein
|
// check for all in condition
|
||||||
|
// for all in condition at least two active players have to remain
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// 1) wenn alle All In
|
// 1) all players all in
|
||||||
if(allInPlayersCounter == nonFoldPlayerCounter) {
|
if(allInPlayersCounter == nonFoldPlayerCounter) {
|
||||||
allInCondition = true;
|
allInCondition = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2) alle bis auf einen All In und der hat HighestSet
|
// 2) all players but one all in and he has highest set
|
||||||
if(allInPlayersCounter+1 == nonFoldPlayerCounter) {
|
if(allInPlayersCounter+1 == nonFoldPlayerCounter) {
|
||||||
|
|
||||||
// TODO -> runningPlayerList s.u.
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
//
|
|
||||||
// if(playerArray[i]->getMyAction() != 1 && playerArray[i]->getMyAction() != 6 && playerArray[i]->getMyActiveStatus() == 1 && playerArray[i]->getMySet() >= myBeRo[currentRound]->getHighestSet()) {
|
|
||||||
// allInCondition = 1;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
for(it_c=runningPlayerList->begin(); it_c!=runningPlayerList->end(); it_c++) {
|
for(it_c=runningPlayerList->begin(); it_c!=runningPlayerList->end(); it_c++) {
|
||||||
|
|
||||||
if((*it_c)->getMySet() >= myBeRo[currentRound]->getHighestSet()) {
|
if((*it_c)->getMySet() >= myBeRo[currentRound]->getHighestSet()) {
|
||||||
@@ -583,54 +502,34 @@ void LocalHand::switchRounds() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if( (*(runningPlayerList.begin()))->getMySet() >= myBeRo[currentRound]->getHighestSet() ) {
|
|
||||||
// allInCondition = 1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // HeadsUp-Ausnahme -> spieler ermitteln, der all in ist und als bb nur weniger als sb setzen konnte
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
//
|
|
||||||
// if(activePlayerList->size()==2 && playerArray[i]->getMyAction() == 6 && playerArray[i]->getMyActiveStatus() == 1 && playerArray[i]->getMyButton()==3 && playerArray[i]->getMySet()<=smallBlind) {
|
|
||||||
// allInCondition = 1;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// exception
|
// exception
|
||||||
// no.1: if in first Preflop Round next player is small blind and only all-in-big-blind with less than smallblind amount and other all-in players with less than small blind are nonfold too -> preflop is over
|
// no.1: if in first Preflop Round next player is small blind and only all-in-big-blind with less than smallblind amount and other all-in players with less than small blind are nonfold too -> preflop is over
|
||||||
PlayerListConstIterator smallBlindIt_c = getRunningPlayerIt(myBeRo[currentRound]->getSmallBlindPositionId());
|
PlayerListConstIterator smallBlindIt_c = getRunningPlayerIt(myBeRo[currentRound]->getSmallBlindPositionId());
|
||||||
PlayerListConstIterator bigBlindIt_c = getActivePlayerIt(myBeRo[currentRound]->getBigBlindPositionId());
|
PlayerListConstIterator bigBlindIt_c = getActivePlayerIt(myBeRo[currentRound]->getBigBlindPositionId());
|
||||||
if(smallBlindIt_c!=runningPlayerList->end() && bigBlindIt_c!=activePlayerList->end() && currentRound == GAME_STATE_PREFLOP && myBeRo[currentRound]->getFirstRound()) {
|
if(smallBlindIt_c!=runningPlayerList->end() && bigBlindIt_c!=activePlayerList->end() && currentRound == GAME_STATE_PREFLOP && myBeRo[currentRound]->getFirstRound()) {
|
||||||
// determine player who are all in with less than small blind amount
|
// determine player who are all in with less than small blind amount
|
||||||
int tempCounter = 0;
|
int tempCounter = 0;
|
||||||
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
||||||
if((*it_c)->getMyAction() == PLAYER_ACTION_ALLIN && (*it_c)->getMySet() <= smallBlind) {
|
if((*it_c)->getMyAction() == PLAYER_ACTION_ALLIN && (*it_c)->getMySet() <= smallBlind) {
|
||||||
tempCounter++;
|
tempCounter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( (*bigBlindIt_c)->getMySet() <= smallBlind && tempCounter == allInPlayersCounter) {
|
||||||
|
allInCondition = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( (*bigBlindIt_c)->getMySet() <= smallBlind && tempCounter == allInPlayersCounter) {
|
|
||||||
allInCondition = true;
|
// no.2: heads up -> detect player who is all in and bb but could set less than sb
|
||||||
|
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
||||||
|
|
||||||
|
if(activePlayerList->size()==2 && (*it_c)->getMyAction() == PLAYER_ACTION_ALLIN && (*it_c)->getMyButton()==BUTTON_BIG_BLIND && (*it_c)->getMySet()<=smallBlind) {
|
||||||
|
allInCondition = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// HeadsUp-Ausnahme -> spieler ermitteln, der all in ist und als bb nur weniger als sb setzen konnte
|
|
||||||
for(it_c=activePlayerList->begin(); it_c!=activePlayerList->end(); it_c++) {
|
|
||||||
|
|
||||||
if(activePlayerList->size()==2 && (*it_c)->getMyAction() == PLAYER_ACTION_ALLIN && (*it_c)->getMyButton()==BUTTON_BIG_BLIND && (*it_c)->getMySet()<=smallBlind) {
|
|
||||||
allInCondition = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// beim Vorliegen einer All In Kondition -> Ausfhrung einer Sonderprozedur
|
// special routine
|
||||||
if(allInCondition) {
|
if(allInCondition) {
|
||||||
myBoard->collectPot();
|
myBoard->collectPot();
|
||||||
myGui->refreshPot();
|
myGui->refreshPot();
|
||||||
@@ -650,12 +549,6 @@ void LocalHand::switchRounds() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//unhighlight current players groupbox
|
|
||||||
// if(playerArray[lastPlayersTurn]->getMyActiveStatus() == 1) myGui->refreshGroupbox(lastPlayersTurn,1);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//unhighlight current players groupbox
|
//unhighlight current players groupbox
|
||||||
it_c = getActivePlayerIt(lastPlayersTurn);
|
it_c = getActivePlayerIt(lastPlayersTurn);
|
||||||
if( it_c != activePlayerList->end() ) {
|
if( it_c != activePlayerList->end() ) {
|
||||||
@@ -663,34 +556,29 @@ void LocalHand::switchRounds() {
|
|||||||
myGui->refreshGroupbox(lastPlayersTurn,1);
|
myGui->refreshGroupbox(lastPlayersTurn,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
myGui->refreshGameLabels((GameState)getCurrentRound());
|
myGui->refreshGameLabels((GameState)getCurrentRound());
|
||||||
// /*/*/*/*cout <<*/*/*/*/ "NextPlayerSpeed1 stop" << endl;
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
// cout << "NextPlayerSpeed2 start" << endl;
|
|
||||||
switch(currentRound) {
|
switch(currentRound) {
|
||||||
case 0: {
|
case 0: {
|
||||||
// Preflop starten
|
// start preflop
|
||||||
myGui->preflopAnimation1();
|
myGui->preflopAnimation1();
|
||||||
} break;
|
} break;
|
||||||
case 1: {
|
case 1: {
|
||||||
// Flop starten
|
// start flop
|
||||||
myGui->flopAnimation1();
|
myGui->flopAnimation1();
|
||||||
} break;
|
} break;
|
||||||
case 2: {
|
case 2: {
|
||||||
// Turn starten
|
// start turn
|
||||||
myGui->turnAnimation1();
|
myGui->turnAnimation1();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case 3: {
|
case 3: {
|
||||||
// River starten
|
// start river
|
||||||
myGui->riverAnimation1();
|
myGui->riverAnimation1();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case 4: {
|
case 4: {
|
||||||
// PostRiver starten
|
// start post river
|
||||||
myGui->postRiverAnimation1();
|
myGui->postRiverAnimation1();
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
@@ -736,15 +624,11 @@ PlayerListIterator LocalHand::getRunningPlayerIt(unsigned uniqueId) const {
|
|||||||
|
|
||||||
for(it=runningPlayerList->begin(); it!=runningPlayerList->end(); it++) {
|
for(it=runningPlayerList->begin(); it!=runningPlayerList->end(); it++) {
|
||||||
|
|
||||||
// cout << (*it)->getMyUniqueID() << " ";
|
|
||||||
|
|
||||||
if((*it)->getMyUniqueID() == uniqueId) {
|
if((*it)->getMyUniqueID() == uniqueId) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// cout << endl;
|
|
||||||
|
|
||||||
return it;
|
return it;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,12 +34,11 @@
|
|||||||
|
|
||||||
class LocalHand : public HandInterface{
|
class LocalHand : public HandInterface{
|
||||||
public:
|
public:
|
||||||
LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, /*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList, int, int, unsigned, int, int);
|
LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, PlayerList, PlayerList, PlayerList, int, int, unsigned, int, int);
|
||||||
~LocalHand();
|
~LocalHand();
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
// std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const { return playerArray; }
|
|
||||||
PlayerList getSeatsList() const {return seatsList;}
|
PlayerList getSeatsList() const {return seatsList;}
|
||||||
PlayerList getActivePlayerList() const {return activePlayerList;}
|
PlayerList getActivePlayerList() const {return activePlayerList;}
|
||||||
PlayerList getRunningPlayerList() const {return runningPlayerList;}
|
PlayerList getRunningPlayerList() const {return runningPlayerList;}
|
||||||
@@ -97,7 +96,6 @@ private:
|
|||||||
GuiInterface *myGui;
|
GuiInterface *myGui;
|
||||||
BoardInterface *myBoard;
|
BoardInterface *myBoard;
|
||||||
|
|
||||||
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
|
|
||||||
PlayerList seatsList;
|
PlayerList seatsList;
|
||||||
PlayerList activePlayerList;
|
PlayerList activePlayerList;
|
||||||
PlayerList runningPlayerList;
|
PlayerList runningPlayerList;
|
||||||
@@ -106,7 +104,7 @@ private:
|
|||||||
|
|
||||||
int myID;
|
int myID;
|
||||||
int startQuantityPlayers;
|
int startQuantityPlayers;
|
||||||
unsigned dealerPosition; // -1 -> neutral
|
unsigned dealerPosition;
|
||||||
int currentRound; //0 = preflop, 1 = flop, 2 = turn, 3 = river
|
int currentRound; //0 = preflop, 1 = flop, 2 = turn, 3 = river
|
||||||
int smallBlind;
|
int smallBlind;
|
||||||
int startCash;
|
int startCash;
|
||||||
|
|||||||
@@ -1079,16 +1079,6 @@ void LocalPlayer::preflopEngine() {
|
|||||||
|
|
||||||
// cout << myID << ": " << myHoleCardsValue << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << myCards[0] << " " << myCards[1] << endl;
|
// cout << myID << ": " << myHoleCardsValue << " - " << myNiveau[0] << " " << myNiveau[2] << " - " << myCards[0] << " " << myCards[1] << endl;
|
||||||
|
|
||||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
|
||||||
// int aggValue = (int)(((currentHand->getPlayerArray()[0]->getMyAggressive()*1.0)/7.0 - 1.0/currentHand->getActivePlayerList()->size())*21.0);
|
|
||||||
//
|
|
||||||
// if(currentHand->getPlayerArray()[0]->getMyActiveStatus() && currentHand->getPlayerArray()[0]->getMyAction() != 1) {
|
|
||||||
// myNiveau[0] -= aggValue;
|
|
||||||
// myNiveau[2] -= aggValue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
||||||
it_c = currentHand->getActivePlayerIt(0);
|
it_c = currentHand->getActivePlayerIt(0);
|
||||||
if( it_c != currentHand->getActivePlayerList()->end() ) {
|
if( it_c != currentHand->getActivePlayerList()->end() ) {
|
||||||
@@ -1394,15 +1384,6 @@ void LocalPlayer::flopEngine() {
|
|||||||
int individualHighestSet = currentHand->getCurrentBeRo()->getHighestSet();
|
int individualHighestSet = currentHand->getCurrentBeRo()->getHighestSet();
|
||||||
if(individualHighestSet > myCash) individualHighestSet = myCash;
|
if(individualHighestSet > myCash) individualHighestSet = myCash;
|
||||||
|
|
||||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist
|
|
||||||
// int aggValue = (int)(((currentHand->getPlayerArray()[0]->getMyAggressive()*1.0)/7.0 - 1.0/currentHand->getActivePlayerList()->size())*21.0);
|
|
||||||
//
|
|
||||||
// if(currentHand->getPlayerArray()[0]->getMyActiveStatus() && currentHand->getPlayerArray()[0]->getMyAction() != 1) {
|
|
||||||
// for(i=0; i<3; i++) {
|
|
||||||
// myNiveau[i] -= aggValue;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
||||||
it_c = currentHand->getActivePlayerIt(0);
|
it_c = currentHand->getActivePlayerIt(0);
|
||||||
if( it_c != currentHand->getActivePlayerList()->end() ) {
|
if( it_c != currentHand->getActivePlayerList()->end() ) {
|
||||||
@@ -2032,17 +2013,6 @@ void LocalPlayer::turnEngine() {
|
|||||||
// 3. Call -- Raise
|
// 3. Call -- Raise
|
||||||
myNiveau[2] = 69 + myDude4/* - 6*(currentHand->getActivePlayerList().size() - 2)*/;
|
myNiveau[2] = 69 + myDude4/* - 6*(currentHand->getActivePlayerList().size() - 2)*/;
|
||||||
|
|
||||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist
|
|
||||||
// int aggValue = (int)(((currentHand->getPlayerArray()[0]->getMyAggressive()*1.0)/7.0 - 1.0/currentHand->getActivePlayerList()->size())*21.0);
|
|
||||||
//
|
|
||||||
// if(currentHand->getPlayerArray()[0]->getMyActiveStatus() && currentHand->getPlayerArray()[0]->getMyAction() != 1) {
|
|
||||||
// for(i=0; i<3; i++) {
|
|
||||||
// myNiveau[i] -= aggValue;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
||||||
it_c = currentHand->getActivePlayerIt(0);
|
it_c = currentHand->getActivePlayerIt(0);
|
||||||
if( it_c != currentHand->getActivePlayerList()->end() ) {
|
if( it_c != currentHand->getActivePlayerList()->end() ) {
|
||||||
@@ -2436,16 +2406,6 @@ void LocalPlayer::riverEngine() {
|
|||||||
// 3. Call -- Raise
|
// 3. Call -- Raise
|
||||||
myNiveau[2] = 69 + myDude4/* - 6*(currentHand->getActivePlayerList().size() - 2)*/;
|
myNiveau[2] = 69 + myDude4/* - 6*(currentHand->getActivePlayerList().size() - 2)*/;
|
||||||
|
|
||||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist
|
|
||||||
// int aggValue = (int)(((currentHand->getPlayerArray()[0]->getMyAggressive()*1.0)/7.0 - 1.0/currentHand->getActivePlayerList()->size())*21.0);
|
|
||||||
//
|
|
||||||
// if(currentHand->getPlayerArray()[0]->getMyActiveStatus() && currentHand->getPlayerArray()[0]->getMyAction() != 1) {
|
|
||||||
// for(i=0; i<3; i++) {
|
|
||||||
// myNiveau[i] -= aggValue;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
// Aggresivität des humanPlayers auslesen -> nur wenn er aktiv ist !
|
||||||
it_c = currentHand->getActivePlayerIt(0);
|
it_c = currentHand->getActivePlayerIt(0);
|
||||||
if( it_c != currentHand->getActivePlayerList()->end() ) {
|
if( it_c != currentHand->getActivePlayerList()->end() ) {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ClientBoard::ClientBoard()
|
ClientBoard::ClientBoard()
|
||||||
: /*playerArray(0),*/ currentHand(0), pot(0), sets(0)
|
: currentHand(0), pot(0), sets(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,10 +34,9 @@ ClientBoard::~ClientBoard()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ClientBoard::setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> > sl_old,*/ PlayerList sl, PlayerList apl, PlayerList rpl)
|
ClientBoard::setPlayerLists(PlayerList sl, PlayerList apl, PlayerList rpl)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
|
||||||
// playerArray = sl_old; // delete
|
|
||||||
seatsList = sl;
|
seatsList = sl;
|
||||||
activePlayerList = apl;
|
activePlayerList = apl;
|
||||||
runningPlayerList = rpl;
|
runningPlayerList = rpl;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public:
|
|||||||
ClientBoard();
|
ClientBoard();
|
||||||
~ClientBoard();
|
~ClientBoard();
|
||||||
|
|
||||||
void setPlayerLists(/*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList);
|
void setPlayerLists(PlayerList, PlayerList, PlayerList);
|
||||||
void setHand(HandInterface*);
|
void setHand(HandInterface*);
|
||||||
|
|
||||||
void setMyCards(int* theValue);
|
void setMyCards(int* theValue);
|
||||||
@@ -55,7 +55,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
mutable boost::recursive_mutex m_syncMutex;
|
mutable boost::recursive_mutex m_syncMutex;
|
||||||
|
|
||||||
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
|
|
||||||
PlayerList seatsList;
|
PlayerList seatsList;
|
||||||
PlayerList activePlayerList;
|
PlayerList activePlayerList;
|
||||||
PlayerList runningPlayerList;
|
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_old,*/ PlayerList 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, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC)
|
||||||
{
|
{
|
||||||
return new ClientHand(f, g, b, /*sl_old,*/ sl, apl, rpl, id, sP, dP, sB, sC);
|
return new ClientHand(f, g, b, sl, apl, rpl, id, sP, dP, sB, sC);
|
||||||
}
|
}
|
||||||
|
|
||||||
BoardInterface* ClientEngineFactory::createBoard()
|
BoardInterface* ClientEngineFactory::createBoard()
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
ClientEngineFactory();
|
ClientEngineFactory();
|
||||||
~ClientEngineFactory();
|
~ClientEngineFactory();
|
||||||
|
|
||||||
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);
|
HandInterface* createHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerList sl, PlayerList apl, PlayerList rpl, int id, int sP, int dP, int sB,int sC);
|
||||||
BoardInterface* createBoard();
|
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);
|
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);
|
std::vector<boost::shared_ptr<BeRoInterface> > createBeRo(HandInterface* hi, int id, unsigned dP, int sB);
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
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)
|
ClientHand::ClientHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, 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), currentRound(0),
|
: myFactory(f), myGui(g), myBoard(b), seatsList(sl), activePlayerList(apl), runningPlayerList(rpl), myID(id), startQuantityPlayers(sP), dealerPosition(dP), currentRound(0),
|
||||||
smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(0),
|
smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(0),
|
||||||
cardsShown(false), bettingRoundsPlayed(0)
|
cardsShown(false), bettingRoundsPlayed(0)
|
||||||
{
|
{
|
||||||
@@ -67,12 +67,6 @@ ClientHand::start()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// std::vector<boost::shared_ptr<PlayerInterface> >
|
|
||||||
// ClientHand::getPlayerArray() const
|
|
||||||
// {
|
|
||||||
// return playerArray;
|
|
||||||
// }
|
|
||||||
|
|
||||||
PlayerList
|
PlayerList
|
||||||
ClientHand::getSeatsList() const
|
ClientHand::getSeatsList() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,12 +32,11 @@
|
|||||||
class ClientHand : public HandInterface
|
class ClientHand : public HandInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, /*std::vector<boost::shared_ptr<PlayerInterface> >,*/ PlayerList, PlayerList, PlayerList , int, int, int, int, int );
|
ClientHand ( boost::shared_ptr<EngineFactory> f, GuiInterface*, BoardInterface*, PlayerList, PlayerList, PlayerList , int, int, int, int, int );
|
||||||
~ClientHand();
|
~ClientHand();
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
// std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const;
|
|
||||||
PlayerList getSeatsList() const;
|
PlayerList getSeatsList() const;
|
||||||
PlayerList getActivePlayerList() const;
|
PlayerList getActivePlayerList() const;
|
||||||
PlayerList getRunningPlayerList() const;
|
PlayerList getRunningPlayerList() const;
|
||||||
@@ -97,7 +96,6 @@ class ClientHand : public HandInterface
|
|||||||
GuiInterface *myGui;
|
GuiInterface *myGui;
|
||||||
BoardInterface *myBoard;
|
BoardInterface *myBoard;
|
||||||
|
|
||||||
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // delete
|
|
||||||
PlayerList seatsList;
|
PlayerList seatsList;
|
||||||
PlayerList activePlayerList;
|
PlayerList activePlayerList;
|
||||||
PlayerList runningPlayerList;
|
PlayerList runningPlayerList;
|
||||||
|
|||||||
+22
-92
@@ -40,22 +40,14 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
|||||||
|
|
||||||
blindsList = myGameData.manualBlindsList;
|
blindsList = myGameData.manualBlindsList;
|
||||||
|
|
||||||
|
|
||||||
if(DEBUG_MODE) {
|
if(DEBUG_MODE) {
|
||||||
startSmallBlind = 10;
|
startSmallBlind = 10;
|
||||||
currentSmallBlind = startSmallBlind;
|
currentSmallBlind = startSmallBlind;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cout << "Create Game Object" << "\n";
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
currentHandID = 0;
|
// determine dealer position
|
||||||
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// playerArray[i] = 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Dealer Position bestimmen
|
|
||||||
PlayerDataList::const_iterator player_i = playerDataList.begin();
|
PlayerDataList::const_iterator player_i = playerDataList.begin();
|
||||||
PlayerDataList::const_iterator player_end = playerDataList.end();
|
PlayerDataList::const_iterator player_end = playerDataList.end();
|
||||||
|
|
||||||
@@ -67,17 +59,18 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
|||||||
}
|
}
|
||||||
if (player_i == player_end)
|
if (player_i == player_end)
|
||||||
throw LocalException(__FILE__, __LINE__, ERR_DEALER_NOT_FOUND);
|
throw LocalException(__FILE__, __LINE__, ERR_DEALER_NOT_FOUND);
|
||||||
|
|
||||||
dealerPosition = startData.startDealerPlayerId;
|
dealerPosition = startData.startDealerPlayerId;
|
||||||
|
|
||||||
// Board erstellen
|
// create board
|
||||||
currentBoard = myFactory->createBoard();
|
currentBoard = myFactory->createBoard();
|
||||||
|
|
||||||
|
// create player lists
|
||||||
seatsList = PlayerList(new std::list<boost::shared_ptr<PlayerInterface> >);
|
seatsList = PlayerList(new std::list<boost::shared_ptr<PlayerInterface> >);
|
||||||
activePlayerList = PlayerList(new std::list<boost::shared_ptr<PlayerInterface> >);
|
activePlayerList = PlayerList(new std::list<boost::shared_ptr<PlayerInterface> >);
|
||||||
runningPlayerList = PlayerList(new std::list<boost::shared_ptr<PlayerInterface> >);
|
runningPlayerList = PlayerList(new std::list<boost::shared_ptr<PlayerInterface> >);
|
||||||
|
|
||||||
// Player erstellen
|
// create player
|
||||||
|
|
||||||
player_i = playerDataList.begin();
|
player_i = playerDataList.begin();
|
||||||
player_end = playerDataList.end();
|
player_end = playerDataList.end();
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
@@ -99,24 +92,22 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
|||||||
++player_i;
|
++player_i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create Player Objects
|
// create player objects
|
||||||
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(currentBoard, i, uniqueId, type, myName, myAvatarFile, startCash, startQuantityPlayers > i, 0);
|
boost::shared_ptr<PlayerInterface> tmpPlayer = myFactory->createPlayer(currentBoard, i, uniqueId, type, myName, myAvatarFile, startCash, startQuantityPlayers > i, 0);
|
||||||
|
|
||||||
tmpPlayer->setNetSessionData(myNetSession);
|
tmpPlayer->setNetSessionData(myNetSession);
|
||||||
|
|
||||||
// fill player lists
|
// fill player lists
|
||||||
// playerArray.push_back(tmpPlayer); // delete
|
|
||||||
seatsList->push_back(tmpPlayer);
|
seatsList->push_back(tmpPlayer);
|
||||||
if(startQuantityPlayers > i) {
|
if(startQuantityPlayers > i) {
|
||||||
activePlayerList->push_back(tmpPlayer);
|
activePlayerList->push_back(tmpPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
(*runningPlayerList) = (*activePlayerList);
|
(*runningPlayerList) = (*activePlayerList);
|
||||||
|
|
||||||
// playerArray[i]->setNetSessionData(myNetSession); // delete
|
|
||||||
|
|
||||||
}
|
}
|
||||||
currentBoard->setPlayerLists(/*playerArray,*/ seatsList, activePlayerList, runningPlayerList); // delete playerArray
|
|
||||||
|
currentBoard->setPlayerLists(seatsList, activePlayerList, runningPlayerList);
|
||||||
|
|
||||||
//start timer
|
//start timer
|
||||||
blindsTimer.reset();
|
blindsTimer.reset();
|
||||||
@@ -125,13 +116,10 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
|
|||||||
|
|
||||||
Game::~Game()
|
Game::~Game()
|
||||||
{
|
{
|
||||||
// cout << "Delete Game Object" << "\n";
|
|
||||||
|
|
||||||
delete currentBoard;
|
delete currentBoard;
|
||||||
currentBoard = 0;
|
currentBoard = 0;
|
||||||
delete currentHand;
|
delete currentHand;
|
||||||
currentHand = 0;
|
currentHand = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HandInterface *Game::getCurrentHand()
|
HandInterface *Game::getCurrentHand()
|
||||||
@@ -149,38 +137,31 @@ void Game::initHand()
|
|||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
PlayerListIterator it, it_2;
|
PlayerListIterator it;
|
||||||
|
|
||||||
currentHandID++;
|
currentHandID++;
|
||||||
|
|
||||||
// calculate smallBlind
|
// calculate smallBlind
|
||||||
raiseBlinds();
|
raiseBlinds();
|
||||||
|
|
||||||
//Spieler Action auf 0 setzen
|
// set player action none
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
for(it=seatsList->begin(); it!=seatsList->end(); it++) {
|
||||||
// playerArray[i]->setMyAction(0);
|
(*it)->setMyAction(PLAYER_ACTION_NONE);
|
||||||
// }
|
|
||||||
|
|
||||||
//Spieler Action auf 0 setzen
|
|
||||||
for(it_c=seatsList->begin(); it_c!=seatsList->end(); it_c++) {
|
|
||||||
(*it_c)->setMyAction(PLAYER_ACTION_NONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spieler mit leerem Cash auf inactive setzen
|
// set player with empty cash inactive
|
||||||
it = activePlayerList->begin();
|
it = activePlayerList->begin();
|
||||||
|
|
||||||
while( it!=activePlayerList->end() ) {
|
while( it!=activePlayerList->end() ) {
|
||||||
|
|
||||||
if((*it)->getMyCash() == 0) {
|
if((*it)->getMyCash() == 0) {
|
||||||
// cout << "playerID: " << (*it)->getMyID() << endl;
|
(*it)->setMyActiveStatus(false);
|
||||||
(*it)->setMyActiveStatus(0);
|
|
||||||
it = activePlayerList->erase(it);
|
it = activePlayerList->erase(it);
|
||||||
} else {
|
} else {
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eventuell vorhandene Hand löschen
|
// delete possible existing hands
|
||||||
if(currentHand) {
|
if(currentHand) {
|
||||||
delete currentHand;
|
delete currentHand;
|
||||||
currentHand = 0;
|
currentHand = 0;
|
||||||
@@ -189,17 +170,10 @@ void Game::initHand()
|
|||||||
runningPlayerList->clear();
|
runningPlayerList->clear();
|
||||||
(*runningPlayerList) = (*activePlayerList);
|
(*runningPlayerList) = (*activePlayerList);
|
||||||
|
|
||||||
// Hand erstellen
|
// create Hand
|
||||||
currentHand = myFactory->createHand(myFactory, myGui, currentBoard, /*playerArray,*/ seatsList, activePlayerList, runningPlayerList, currentHandID, startQuantityPlayers, dealerPosition, currentSmallBlind, startCash); // delete playerArray
|
currentHand = myFactory->createHand(myFactory, myGui, currentBoard, seatsList, activePlayerList, runningPlayerList, currentHandID, startQuantityPlayers, dealerPosition, currentSmallBlind, startCash);
|
||||||
|
|
||||||
|
// shifting dealer button -> TODO exception-rule !!!
|
||||||
// Dealer-Button weiterschieben --> Achtung inactive -> TODO exception-rule !!! DELETE
|
|
||||||
// for(i=0; (i<MAX_NUMBER_OF_PLAYERS && !(playerArray[dealerPosition]->getMyActiveStatus())) || i==0; i++) {
|
|
||||||
//
|
|
||||||
// dealerPosition = (dealerPosition+1)%(MAX_NUMBER_OF_PLAYERS);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Dealer-Button weiterschieben --> Achtung inactive -> TODO exception-rule !!!
|
|
||||||
bool nextDealerFound = false;
|
bool nextDealerFound = false;
|
||||||
PlayerListConstIterator dealerPositionIt = currentHand->getSeatIt(dealerPosition);
|
PlayerListConstIterator dealerPositionIt = currentHand->getSeatIt(dealerPosition);
|
||||||
if(dealerPositionIt == seatsList->end()) {
|
if(dealerPositionIt == seatsList->end()) {
|
||||||
@@ -211,10 +185,10 @@ void Game::initHand()
|
|||||||
dealerPositionIt++;
|
dealerPositionIt++;
|
||||||
if(dealerPositionIt == seatsList->end()) dealerPositionIt = seatsList->begin();
|
if(dealerPositionIt == seatsList->end()) dealerPositionIt = seatsList->begin();
|
||||||
|
|
||||||
it = currentHand->getActivePlayerIt( (*dealerPositionIt)->getMyUniqueID() );
|
it_c = currentHand->getActivePlayerIt( (*dealerPositionIt)->getMyUniqueID() );
|
||||||
if(it != activePlayerList->end() ) {
|
if(it_c != activePlayerList->end() ) {
|
||||||
nextDealerFound = true;
|
nextDealerFound = true;
|
||||||
dealerPosition = (*it)->getMyUniqueID();
|
dealerPosition = (*it_c)->getMyUniqueID();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,10 +202,9 @@ void Game::initHand()
|
|||||||
|
|
||||||
void Game::startHand()
|
void Game::startHand()
|
||||||
{
|
{
|
||||||
//GUI bereinigen
|
|
||||||
myGui->nextRoundCleanGui();
|
myGui->nextRoundCleanGui();
|
||||||
|
|
||||||
//Log new Hand
|
// log new hand
|
||||||
myGui->logNewGameHandMsg(myGameID, currentHandID);
|
myGui->logNewGameHandMsg(myGameID, currentHandID);
|
||||||
myGui->flushLogAtGame(myGameID);
|
myGui->flushLogAtGame(myGameID);
|
||||||
|
|
||||||
@@ -265,84 +238,41 @@ boost::shared_ptr<PlayerInterface> Game::getCurrentPlayer()
|
|||||||
|
|
||||||
void Game::raiseBlinds() {
|
void Game::raiseBlinds() {
|
||||||
|
|
||||||
// cout << "timer minutes " << blindsTimer.elapsed().total_seconds()/60 << "\n";
|
|
||||||
// cout << "gameData.RaiseIntervalMode " << myGameData.RaiseIntervalMode << "\n";
|
|
||||||
// cout << "gameData.raiseMode " << myGameData.raiseMode << "\n";
|
|
||||||
// cout << "gameData.afterManualBlindsMode " << myGameData.afterManualBlindsMode << "\n";
|
|
||||||
|
|
||||||
bool raiseBlinds = false;
|
bool raiseBlinds = false;
|
||||||
|
|
||||||
if (myGameData.raiseIntervalMode == RAISE_ON_HANDNUMBER) {
|
if (myGameData.raiseIntervalMode == RAISE_ON_HANDNUMBER) {
|
||||||
|
|
||||||
if (lastHandBlindsRaised + myGameData.raiseSmallBlindEveryHandsValue <= currentHandID) {
|
if (lastHandBlindsRaised + myGameData.raiseSmallBlindEveryHandsValue <= currentHandID) {
|
||||||
raiseBlinds = true;
|
raiseBlinds = true;
|
||||||
lastHandBlindsRaised = currentHandID;
|
lastHandBlindsRaised = currentHandID;
|
||||||
|
|
||||||
// cout << "raise now on hands \n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (lastTimeBlindsRaised + myGameData.raiseSmallBlindEveryMinutesValue <= blindsTimer.elapsed().total_seconds()/60) {
|
if (lastTimeBlindsRaised + myGameData.raiseSmallBlindEveryMinutesValue <= blindsTimer.elapsed().total_seconds()/60) {
|
||||||
raiseBlinds = true;
|
raiseBlinds = true;
|
||||||
lastTimeBlindsRaised = blindsTimer.elapsed().total_seconds()/60;
|
lastTimeBlindsRaised = blindsTimer.elapsed().total_seconds()/60;
|
||||||
|
|
||||||
// cout << "raise now on minutes \n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (raiseBlinds) {
|
if (raiseBlinds) {
|
||||||
|
|
||||||
// At this point, the blinds must be raised
|
// At this point, the blinds must be raised
|
||||||
// Now we check how the blinds should be raised
|
// Now we check how the blinds should be raised
|
||||||
|
|
||||||
if (myGameData.raiseMode == DOUBLE_BLINDS) {
|
if (myGameData.raiseMode == DOUBLE_BLINDS) {
|
||||||
currentSmallBlind *= 2;
|
currentSmallBlind *= 2;
|
||||||
// cout << "double small blind \n";
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Increase the position of the list
|
|
||||||
/* list<int> blindsList = myGameData.manualBlindsList;*/
|
|
||||||
// list<int>::iterator it;
|
|
||||||
|
|
||||||
if(!blindsList.empty()) {
|
if(!blindsList.empty()) {
|
||||||
|
|
||||||
currentSmallBlind = blindsList.front();
|
currentSmallBlind = blindsList.front();
|
||||||
blindsList.pop_front();
|
blindsList.pop_front();
|
||||||
|
|
||||||
// it = find(blindsList.begin(), blindsList.end(), currentSmallBlind);
|
|
||||||
// if(it != blindsList.end()) {
|
|
||||||
// it++;
|
|
||||||
// cout << "increase position in blindslist \n";
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// cout << "blindslist exceeds\n";
|
|
||||||
// if(currentSmallBlind == myGameData.firstSmallBlind) {
|
|
||||||
// it = blindsList.begin();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
// else { cout << "blindslist is empty \n"; }
|
|
||||||
// Check if we can get an element of the list or the position exceeds the lis
|
|
||||||
// if (blindsList.empty() || it == blindsList.end()) {
|
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// The position exceeds the list
|
// The position exceeds the list
|
||||||
if (myGameData.afterManualBlindsMode == AFTERMB_DOUBLE_BLINDS) {
|
if (myGameData.afterManualBlindsMode == AFTERMB_DOUBLE_BLINDS) {
|
||||||
currentSmallBlind *= 2;
|
currentSmallBlind *= 2;
|
||||||
// cout << "after blindslist double blind\n";
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(myGameData.afterManualBlindsMode == AFTERMB_RAISE_ABOUT) {
|
if(myGameData.afterManualBlindsMode == AFTERMB_RAISE_ABOUT) {
|
||||||
currentSmallBlind += myGameData.afterMBAlwaysRaiseValue;
|
currentSmallBlind += myGameData.afterMBAlwaysRaiseValue;
|
||||||
// cout << "after blindslist increase about x \n";
|
|
||||||
}
|
}
|
||||||
// else { /* Stay at last blind */ cout << "after blindslist stay at last blind \n"; }
|
|
||||||
}
|
}
|
||||||
// } else {
|
|
||||||
// Grab the blinds amount from the list
|
|
||||||
// currentSmallBlind = *it;
|
|
||||||
// cout << "set new small blind from blindslist \n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-7
@@ -56,12 +56,10 @@ public:
|
|||||||
HandInterface *getCurrentHand();
|
HandInterface *getCurrentHand();
|
||||||
const HandInterface *getCurrentHand() const;
|
const HandInterface *getCurrentHand() const;
|
||||||
|
|
||||||
// std::vector<boost::shared_ptr<PlayerInterface> > getPlayerArray() const {return playerArray;}
|
|
||||||
PlayerList getSeatsList() const {return seatsList;}
|
PlayerList getSeatsList() const {return seatsList;}
|
||||||
PlayerList getActivePlayerList() const {return activePlayerList;}
|
PlayerList getActivePlayerList() const {return activePlayerList;}
|
||||||
PlayerList getRunningPlayerList() const {return runningPlayerList;}
|
PlayerList getRunningPlayerList() const {return runningPlayerList;}
|
||||||
|
|
||||||
//Zufgriff Startvariablen
|
|
||||||
void setStartQuantityPlayers(int theValue) { startQuantityPlayers = theValue; }
|
void setStartQuantityPlayers(int theValue) { startQuantityPlayers = theValue; }
|
||||||
int getStartQuantityPlayers() const { return startQuantityPlayers; }
|
int getStartQuantityPlayers() const { return startQuantityPlayers; }
|
||||||
|
|
||||||
@@ -91,21 +89,18 @@ private:
|
|||||||
HandInterface *currentHand;
|
HandInterface *currentHand;
|
||||||
BoardInterface *currentBoard;
|
BoardInterface *currentBoard;
|
||||||
|
|
||||||
// std::vector<boost::shared_ptr<PlayerInterface> > playerArray; // available seats --> seatList !!! TODO // delete
|
|
||||||
PlayerList seatsList;
|
PlayerList seatsList;
|
||||||
PlayerList activePlayerList; // used seats
|
PlayerList activePlayerList; // used seats
|
||||||
PlayerList runningPlayerList; // nonfolded and nonallin active players
|
PlayerList runningPlayerList; // nonfolded and nonallin active players
|
||||||
|
|
||||||
// boost::shared_ptr<PlayerInterface> playerArray[MAX_NUMBER_OF_PLAYERS];
|
// start variables
|
||||||
|
|
||||||
//Startvariablen
|
|
||||||
int startQuantityPlayers;
|
int startQuantityPlayers;
|
||||||
int startCash;
|
int startCash;
|
||||||
int startSmallBlind;
|
int startSmallBlind;
|
||||||
int myGameID;
|
int myGameID;
|
||||||
int guiPlayerNum;
|
int guiPlayerNum;
|
||||||
|
|
||||||
//Laufvariablen
|
// running variables
|
||||||
int currentSmallBlind;
|
int currentSmallBlind;
|
||||||
int currentHandID;
|
int currentHandID;
|
||||||
unsigned dealerPosition;
|
unsigned dealerPosition;
|
||||||
|
|||||||
@@ -70,8 +70,6 @@ Log::Log(mainWindowImpl* w, ConfigFile *c) : myW(w), myConfig(c), myLogDir(0), m
|
|||||||
stream << "<body style=\"font-size:smaller\">\n";
|
stream << "<body style=\"font-size:smaller\">\n";
|
||||||
stream << "<img src='logo.png'>\n";
|
stream << "<img src='logo.png'>\n";
|
||||||
stream << "<h3><b>Log-File for PokerTH 0.6 Session started on "+QDate::currentDate().toString("yyyy-MM-dd")+" at "+QTime::currentTime().toString("hh:mm:ss")+"</b></h3>\n";
|
stream << "<h3><b>Log-File for PokerTH 0.6 Session started on "+QDate::currentDate().toString("yyyy-MM-dd")+" at "+QTime::currentTime().toString("hh:mm:ss")+"</b></h3>\n";
|
||||||
// stream << "</body>\n";
|
|
||||||
// stream << "</html>\n";
|
|
||||||
myLogFile->close();
|
myLogFile->close();
|
||||||
|
|
||||||
//Zu alte Dateien löschen!!!
|
//Zu alte Dateien löschen!!!
|
||||||
@@ -151,195 +149,11 @@ void Log::logPlayerActionMsg(QString msg, int action, int setValue) {
|
|||||||
|
|
||||||
void Log::logNewGameHandMsg(int gameID, int handID) {
|
void Log::logNewGameHandMsg(int gameID, int handID) {
|
||||||
|
|
||||||
// int i, j, k;
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
||||||
|
|
||||||
myW->textBrowser_Log->append("<span style=\"font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
|
myW->textBrowser_Log->append("<span style=\"font-size:large; font-weight:bold\">## Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+" ##</span>");
|
||||||
|
|
||||||
|
|
||||||
// if(myConfig->readConfigInt("LogOnOff")) {
|
|
||||||
// //if write logfiles is enabled
|
|
||||||
//
|
|
||||||
// logFileStreamString += "<p><b>####################   Game: "+QString::number(gameID,10)+" | Hand: "+QString::number(handID,10)+"   ####################</b></br>";
|
|
||||||
// logFileStreamString += "BLIND LEVEL: "+QString::number(currentHand->getSmallBlind())+"$/"+QString::number(currentHand->getSmallBlind()*2)+"$</br>";
|
|
||||||
// logFileStreamString += "CASH: ";
|
|
||||||
//
|
|
||||||
// //Aktive Spieler zählen
|
|
||||||
// // int activePlayersCounter = 0;
|
|
||||||
// // for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
|
|
||||||
// // if (currentHand->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
|
|
||||||
// // }
|
|
||||||
// int k = 0;
|
|
||||||
// // if(currentHand->getActivePlayerList()->size() > 2) {
|
|
||||||
// //
|
|
||||||
// // for(i=0; i<currentHand->getStartQuantityPlayers(); i++) {
|
|
||||||
// //
|
|
||||||
// // if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
|
||||||
// // //print cash only for active players
|
|
||||||
// //
|
|
||||||
// //
|
|
||||||
// // if(currentHand->getPlayerArray()[i]->getMyButton() == 1) {
|
|
||||||
// // if(k==1) { logFileStreamString += ", "; }
|
|
||||||
// // k=1;
|
|
||||||
// // logFileStreamString += QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+" (Dealer): "+QString::number(currentHand->getPlayerArray()[i]->getMyCash(),10)+"$";
|
|
||||||
// // }
|
|
||||||
// // else {
|
|
||||||
// // if(k==1) { logFileStreamString += ", "; }
|
|
||||||
// // k=1;
|
|
||||||
// // logFileStreamString += QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+": "+QString::number(currentHand->getPlayerArray()[i]->getMyCash()+currentHand->getPlayerArray()[i]->getMySet(),10)+"$";
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// // else {
|
|
||||||
// // for(i=0; i<currentHand->getStartQuantityPlayers(); i++) {
|
|
||||||
// // if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
|
||||||
// // //print cash only for active players
|
|
||||||
// // if(currentHand->getPlayerArray()[i]->getMyButton() == 2) {
|
|
||||||
// // if(k==1) { logFileStreamString += ", "; }
|
|
||||||
// // k=1;
|
|
||||||
// // logFileStreamString += QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+" (Dealer): "+QString::number(currentHand->getPlayerArray()[i]->getMyCash()+currentHand->getPlayerArray()[i]->getMySet(),10)+"$";
|
|
||||||
// // }
|
|
||||||
// // else {
|
|
||||||
// // if(k==1) { logFileStreamString += ", "; }
|
|
||||||
// // k=1;
|
|
||||||
// // logFileStreamString += QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyName().c_str())+": "+QString::number(currentHand->getPlayerArray()[i]->getMyCash()+currentHand->getPlayerArray()[i]->getMySet(),10)+"$";
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
//
|
|
||||||
// //print cash only for active players
|
|
||||||
// for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
|
||||||
//
|
|
||||||
// if(currentHand->getActivePlayerList()->size() > 2) {
|
|
||||||
//
|
|
||||||
// if((*it_c)->getMyButton() == BUTTON_DEALER) {
|
|
||||||
// if(k==1) { logFileStreamString += ", "; }
|
|
||||||
// k=1;
|
|
||||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" (Dealer): "+QString::number((*it_c)->getMyCash(),10)+"$";
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// if(k==1) { logFileStreamString += ", "; }
|
|
||||||
// k=1;
|
|
||||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+": "+QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10)+"$";
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// // heads up
|
|
||||||
// else {
|
|
||||||
//
|
|
||||||
// if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND) {
|
|
||||||
// if(k==1) { logFileStreamString += ", "; }
|
|
||||||
// k=1;
|
|
||||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" (Dealer): "+QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10)+"$";
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// if(k==1) { logFileStreamString += ", "; }
|
|
||||||
// k=1;
|
|
||||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+": "+QString::number((*it_c)->getMyCash()+(*it_c)->getMySet(),10)+"$";
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// /* // log blinds
|
|
||||||
// logFileStreamString += "</br>BLINDS: ";
|
|
||||||
// // for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// //
|
|
||||||
// // j = 0;
|
|
||||||
// // //Aktive Spieler zählen
|
|
||||||
// // int activePlayersCounter = 0;
|
|
||||||
// // for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
|
|
||||||
// // if (currentHand->getPlayerArray()[k]->getMyAction() != 1 && currentHand->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
|
|
||||||
// // }
|
|
||||||
// //
|
|
||||||
// // switch (currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyButton()) {
|
|
||||||
// // case 2 : logFileStreamString += QString::fromUtf8(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyName().c_str())+" ("+QString::number(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMySet(),10)+"$), ";
|
|
||||||
// // break;
|
|
||||||
// // case 3 : logFileStreamString += QString::fromUtf8(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMyName().c_str())+" ("+QString::number(currentHand->getPlayerArray()[(i+currentHand->getDealerPosition()+j)%MAX_NUMBER_OF_PLAYERS]->getMySet(),10)+"$)";
|
|
||||||
// // break;
|
|
||||||
// // default :;
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// // for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
|
||||||
// //
|
|
||||||
// // switch ( (*it_c)->getMyButton() ) {
|
|
||||||
// // case 2 : logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$), ";
|
|
||||||
// // break;
|
|
||||||
// // case 3 : logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$)";
|
|
||||||
// // break;
|
|
||||||
// // default : ;
|
|
||||||
// // }
|
|
||||||
// // }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// cout << "SB: " << currentHand->getCurrentBeRo()->getSmallBlindPositionId() << endl;
|
|
||||||
// cout << "BB: " << currentHand->getCurrentBeRo()->getBigBlindPositionId() << endl;
|
|
||||||
//
|
|
||||||
// // smallBlind
|
|
||||||
// it_c = currentHand->getActivePlayerIt(currentHand->getCurrentBeRo()->getSmallBlindPositionId());
|
|
||||||
// if(it_c != currentHand->getActivePlayerList()->end()) {
|
|
||||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$), ";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // bigBlind
|
|
||||||
// it_c = currentHand->getActivePlayerIt(currentHand->getCurrentBeRo()->getBigBlindPositionId());
|
|
||||||
// if(it_c != currentHand->getActivePlayerList()->end()) {
|
|
||||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$)";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// logFileStreamString += "</br></br><b>PREFLOP</b>";
|
|
||||||
// logFileStreamString += "</br>\n";*/
|
|
||||||
// /*
|
|
||||||
// if(myConfig->readConfigInt("LogInterval") < 2) {
|
|
||||||
// // write for log after every action and after every hand
|
|
||||||
// writeLogFileStream(logFileStreamString);
|
|
||||||
// logFileStreamString = "";
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// // write for log after every game
|
|
||||||
// if(gameID > lastGameID) {
|
|
||||||
// writeLogFileStream(logFileStreamString);
|
|
||||||
// logFileStreamString = "";
|
|
||||||
// lastGameID = gameID;
|
|
||||||
// }
|
|
||||||
// }*/
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
//if write logfiles is enabled
|
//if write logfiles is enabled
|
||||||
|
|
||||||
@@ -354,99 +168,40 @@ void Log::logNewGameHandMsg(int gameID, int handID) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName) {
|
void Log::logNewBlindsSetsMsg(int sbSet, int bbSet, QString sbName, QString bbName) {
|
||||||
|
|
||||||
// log blinds
|
// log blinds
|
||||||
logFileStreamString += "BLINDS: ";
|
logFileStreamString += "BLINDS: ";
|
||||||
/*
|
|
||||||
cout << "SB: " << sbName << endl;
|
|
||||||
cout << "BB: " << bbName << endl; */
|
|
||||||
|
|
||||||
// smallBlind
|
|
||||||
// it_c = currentHand->getActivePlayerIt(currentHand->getCurrentBeRo()->getSmallBlindPositionId());
|
|
||||||
// if(it_c != currentHand->getActivePlayerList()->end()) {
|
|
||||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$), ";
|
|
||||||
// }*/
|
|
||||||
|
|
||||||
logFileStreamString += sbName+" ("+QString::number(sbSet,10)+"$), ";
|
logFileStreamString += sbName+" ("+QString::number(sbSet,10)+"$), ";
|
||||||
|
|
||||||
// bigBlind
|
|
||||||
// it_c = currentHand->getActivePlayerIt(currentHand->getCurrentBeRo()->getBigBlindPositionId());
|
|
||||||
// if(it_c != currentHand->getActivePlayerList()->end()) {
|
|
||||||
// logFileStreamString += QString::fromUtf8((*it_c)->getMyName().c_str())+" ("+QString::number((*it_c)->getMySet(),10)+"$)";
|
|
||||||
// }
|
|
||||||
logFileStreamString += bbName+" ("+QString::number(bbSet,10)+"$)";
|
logFileStreamString += bbName+" ("+QString::number(bbSet,10)+"$)";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
||||||
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||||
if(currentHand->getActivePlayerList()->size() > 2) {
|
if(currentHand->getActivePlayerList()->size() > 2) {
|
||||||
if((*it_c)->getMyButton() == BUTTON_DEALER) {
|
if((*it_c)->getMyButton() == BUTTON_DEALER) {
|
||||||
|
|
||||||
// logFileStreamString += "</br></br>DEALER: " + QString::fromUtf8((*it_c)->getMyName().c_str());
|
|
||||||
|
|
||||||
logFileStreamString += "</br>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + " starts as dealer.";
|
logFileStreamString += "</br>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + " starts as dealer.";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND) {
|
if((*it_c)->getMyButton() == BUTTON_SMALL_BLIND) {
|
||||||
// logFileStreamString += "</br></br>DEALER: " + QString::fromUtf8((*it_c)->getMyName().c_str());
|
|
||||||
|
|
||||||
logFileStreamString += "</br>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + " starts as dealer.";
|
logFileStreamString += "</br>" + QString::fromUtf8((*it_c)->getMyName().c_str()) + " starts as dealer.";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logFileStreamString += "</br></br><b>PREFLOP</b>";
|
logFileStreamString += "</br></br><b>PREFLOP</b>";
|
||||||
logFileStreamString += "</br>\n";
|
logFileStreamString += "</br>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::logPlayerWinsMsg(QString playerName, int pot, bool main) {
|
void Log::logPlayerWinsMsg(QString playerName, int pot, bool main) {
|
||||||
|
|
||||||
// HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
|
||||||
|
|
||||||
// myW->textBrowser_Log->append(QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName().c_str())+" wins "+QString::number(pot,10)+"$!!! ");
|
|
||||||
|
|
||||||
// PlayerListConstIterator playerConstIt = currentHand->getActivePlayerIt(playerID);
|
|
||||||
// assert( playerConstIt != currentHand->getActivePlayerList()->end() );
|
|
||||||
if(main) {
|
if(main) {
|
||||||
myW->textBrowser_Log->append("<span style=\"color:#FFFF00;\">"+playerName+" wins "+QString::number(pot,10)+"$</span>");
|
myW->textBrowser_Log->append("<span style=\"color:#FFFF00;\">"+playerName+" wins "+QString::number(pot,10)+"$</span>");
|
||||||
} else {
|
} else {
|
||||||
@@ -456,22 +211,12 @@ void Log::logPlayerWinsMsg(QString playerName, int pot, bool main) {
|
|||||||
if(myConfig->readConfigInt("LogOnOff")) {
|
if(myConfig->readConfigInt("LogOnOff")) {
|
||||||
//if write logfiles is enabled
|
//if write logfiles is enabled
|
||||||
|
|
||||||
// if (cardsValueInt != -1) {
|
|
||||||
// myW->textBrowser_Log->append(QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$ with "+translateCardsValueCode(cardsValueInt).at(0)+"!!! ");
|
|
||||||
// stream << "</br><i>"+QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName())+" wins "+QString::number(pot,10)+"$!!!</i></p>\n";
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
|
|
||||||
|
|
||||||
// logFileStreamString += "</br><i>"+QString::fromUtf8(currentHand->getPlayerArray()[playerID]->getMyName().c_str())+" wins "+QString::number(pot,10)+"$!!!</i></p>\n";
|
|
||||||
|
|
||||||
logFileStreamString += "</br><i>"+playerName+" wins "+QString::number(pot,10)+"$";
|
logFileStreamString += "</br><i>"+playerName+" wins "+QString::number(pot,10)+"$";
|
||||||
if(!main) {
|
if(!main) {
|
||||||
logFileStreamString += " (side pot)";
|
logFileStreamString += " (side pot)";
|
||||||
}
|
}
|
||||||
logFileStreamString += "</i>\n";
|
logFileStreamString += "</i>\n";
|
||||||
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||||
writeLogFileStream(logFileStreamString);
|
writeLogFileStream(logFileStreamString);
|
||||||
logFileStreamString = "";
|
logFileStreamString = "";
|
||||||
@@ -488,7 +233,6 @@ void Log::logPlayerSitsOut(QString playerName) {
|
|||||||
|
|
||||||
logFileStreamString += "</br><i><span style=\"font-size:smaller;\">"+playerName+" sits out</span></i>\n";
|
logFileStreamString += "</br><i><span style=\"font-size:smaller;\">"+playerName+" sits out</span></i>\n";
|
||||||
|
|
||||||
|
|
||||||
if(myConfig->readConfigInt("LogInterval") == 0) {
|
if(myConfig->readConfigInt("LogInterval") == 0) {
|
||||||
writeLogFileStream(logFileStreamString);
|
writeLogFileStream(logFileStreamString);
|
||||||
logFileStreamString = "";
|
logFileStreamString = "";
|
||||||
@@ -1469,8 +1213,6 @@ QStringList Log::translateCardsValueCode(int cardsValueCode) {
|
|||||||
|
|
||||||
QString Log::determineHandName(int myCardsValueInt) {
|
QString Log::determineHandName(int myCardsValueInt) {
|
||||||
|
|
||||||
// size_t i;
|
|
||||||
|
|
||||||
list<int> shownCardsValueInt;
|
list<int> shownCardsValueInt;
|
||||||
list<int> sameHandCardsValueInt;
|
list<int> sameHandCardsValueInt;
|
||||||
bool different = false;
|
bool different = false;
|
||||||
@@ -1478,14 +1220,6 @@ QString Log::determineHandName(int myCardsValueInt) {
|
|||||||
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = myW->getSession().getCurrentGame()->getCurrentHand();
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
|
|
||||||
// collect cardsValueInt of all players who will show their cards
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != PLAYER_ACTION_FOLD) {
|
|
||||||
// shownCardsValueInt.push_back(currentHand->getPlayerArray()[i]->getMyCardsValueInt());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// collect cardsValueInt of all players who will show their cards
|
// collect cardsValueInt of all players who will show their cards
|
||||||
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||||
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||||
@@ -1502,12 +1236,6 @@ QString Log::determineHandName(int myCardsValueInt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// for(it = shownCardsValueInt.begin(); it != shownCardsValueInt.end(); it++) {
|
|
||||||
// cout << *it << endl;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// cout << endl;
|
|
||||||
|
|
||||||
QString handName;
|
QString handName;
|
||||||
|
|
||||||
switch(myCardsValueInt/100000000) {
|
switch(myCardsValueInt/100000000) {
|
||||||
|
|||||||
@@ -1030,24 +1030,6 @@ void mainWindowImpl::callSettingsDialog() {
|
|||||||
//Falls Spielernamen geändert wurden --> neu zeichnen --> erst beim nächsten Neustart neu ausgelesen
|
//Falls Spielernamen geändert wurden --> neu zeichnen --> erst beim nächsten Neustart neu ausgelesen
|
||||||
if (mySettingsDialog->getPlayerNickIsChanged() && mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) {
|
if (mySettingsDialog->getPlayerNickIsChanged() && mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
|
||||||
// currentHand->getPlayerArray()[0]->setMyName(mySettingsDialog->lineEdit_HumanPlayerName->text().toUtf8().constData());
|
|
||||||
// currentHand->getPlayerArray()[1]->setMyName(mySettingsDialog->lineEdit_Opponent1Name->text().toUtf8().constData());
|
|
||||||
// currentHand->getPlayerArray()[2]->setMyName(mySettingsDialog->lineEdit_Opponent2Name->text().toUtf8().constData());
|
|
||||||
// currentHand->getPlayerArray()[3]->setMyName(mySettingsDialog->lineEdit_Opponent3Name->text().toUtf8().constData());
|
|
||||||
// currentHand->getPlayerArray()[4]->setMyName(mySettingsDialog->lineEdit_Opponent4Name->text().toUtf8().constData());
|
|
||||||
// currentHand->getPlayerArray()[5]->setMyName(mySettingsDialog->lineEdit_Opponent5Name->text().toUtf8().constData());
|
|
||||||
// currentHand->getPlayerArray()[6]->setMyName(mySettingsDialog->lineEdit_Opponent6Name->text().toUtf8().constData());
|
|
||||||
// mySettingsDialog->setPlayerNickIsChanged(FALSE);
|
|
||||||
//
|
|
||||||
// refreshPlayerName();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Game *currentGame = mySession->getCurrentGame();
|
Game *currentGame = mySession->getCurrentGame();
|
||||||
PlayerListIterator it = currentGame->getSeatsList()->begin();
|
PlayerListIterator it = currentGame->getSeatsList()->begin();
|
||||||
(*it)->setMyName(mySettingsDialog->lineEdit_HumanPlayerName->text().toUtf8().constData());
|
(*it)->setMyName(mySettingsDialog->lineEdit_HumanPlayerName->text().toUtf8().constData());
|
||||||
@@ -1064,27 +1046,6 @@ void mainWindowImpl::callSettingsDialog() {
|
|||||||
|
|
||||||
if(mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) {
|
if(mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) {
|
||||||
|
|
||||||
// HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
|
||||||
// currentHand->getPlayerArray()[0]->setMyAvatar(mySettingsDialog->pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData());
|
|
||||||
// currentHand->getPlayerArray()[1]->setMyAvatar(mySettingsDialog->pushButton_Opponent1Avatar->getMyLink().toUtf8().constData());
|
|
||||||
// currentHand->getPlayerArray()[2]->setMyAvatar(mySettingsDialog->pushButton_Opponent2Avatar->getMyLink().toUtf8().constData());
|
|
||||||
// currentHand->getPlayerArray()[3]->setMyAvatar(mySettingsDialog->pushButton_Opponent3Avatar->getMyLink().toUtf8().constData());
|
|
||||||
// currentHand->getPlayerArray()[4]->setMyAvatar(mySettingsDialog->pushButton_Opponent4Avatar->getMyLink().toUtf8().constData());
|
|
||||||
// currentHand->getPlayerArray()[5]->setMyAvatar(mySettingsDialog->pushButton_Opponent5Avatar->getMyLink().toUtf8().constData());
|
|
||||||
// currentHand->getPlayerArray()[6]->setMyAvatar(mySettingsDialog->pushButton_Opponent6Avatar->getMyLink().toUtf8().constData());
|
|
||||||
//
|
|
||||||
// //avatar refresh
|
|
||||||
// refreshPlayerAvatar();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Game *currentGame = mySession->getCurrentGame();
|
Game *currentGame = mySession->getCurrentGame();
|
||||||
PlayerListIterator it = currentGame->getSeatsList()->begin();
|
PlayerListIterator it = currentGame->getSeatsList()->begin();
|
||||||
(*it)->setMyAvatar(mySettingsDialog->pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData());
|
(*it)->setMyAvatar(mySettingsDialog->pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData());
|
||||||
@@ -1097,13 +1058,6 @@ void mainWindowImpl::callSettingsDialog() {
|
|||||||
|
|
||||||
//avatar refresh
|
//avatar refresh
|
||||||
refreshPlayerAvatar();
|
refreshPlayerAvatar();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Flipside refresh
|
//Flipside refresh
|
||||||
@@ -1212,12 +1166,6 @@ void mainWindowImpl::setSession(boost::shared_ptr<Session> session) { mySession
|
|||||||
//refresh-Funktionen
|
//refresh-Funktionen
|
||||||
void mainWindowImpl::refreshSet() {
|
void mainWindowImpl::refreshSet() {
|
||||||
|
|
||||||
// int i;
|
|
||||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[i]->getMySet() == 0) setLabelArray[i]->setText("");
|
|
||||||
// else setLabelArray[i]->setText("Set: "+QString::number(mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[i]->getMySet(),10)+" $");
|
|
||||||
// }
|
|
||||||
|
|
||||||
Game *currentGame = mySession->getCurrentGame();
|
Game *currentGame = mySession->getCurrentGame();
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
@@ -1238,59 +1186,10 @@ void mainWindowImpl::refreshButton() {
|
|||||||
QPixmap bigblindButton(myAppDataPath +"gfx/gui/table/default/bigblindPuck.png");
|
QPixmap bigblindButton(myAppDataPath +"gfx/gui/table/default/bigblindPuck.png");
|
||||||
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
|
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
|
||||||
|
|
||||||
// int i;
|
|
||||||
// int k;
|
|
||||||
//Aktive Spieler zählen
|
|
||||||
// int activePlayersCounter = 0;
|
|
||||||
// for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
|
|
||||||
// if (mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
|
|
||||||
// }
|
|
||||||
|
|
||||||
Game *currentGame = mySession->getCurrentGame();
|
Game *currentGame = mySession->getCurrentGame();
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
|
|
||||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
|
||||||
// if(activePlayersCounter > 2) {
|
|
||||||
// switch (currentHand->getPlayerArray()[i]->getMyButton()) {
|
|
||||||
//
|
|
||||||
// case 1 : buttonLabelArray[i]->setPixmap(dealerButton);
|
|
||||||
// break;
|
|
||||||
// case 2 : {
|
|
||||||
// if ( myConfig->readConfigInt("ShowBlindButtons")) buttonLabelArray[i]->setPixmap(smallblindButton);
|
|
||||||
// else { buttonLabelArray[i]->setPixmap(onePix); }
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// case 3 : {
|
|
||||||
// if (myConfig->readConfigInt("ShowBlindButtons")) buttonLabelArray[i]->setPixmap(bigblindButton);
|
|
||||||
// else { buttonLabelArray[i]->setPixmap(onePix); }
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// default: buttonLabelArray[i]->setPixmap(onePix);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// switch (currentHand->getPlayerArray()[i]->getMyButton()) {
|
|
||||||
//
|
|
||||||
// case 2 : buttonLabelArray[i]->setPixmap(dealerButton);
|
|
||||||
// break;
|
|
||||||
// case 3 : {
|
|
||||||
// if (myConfig->readConfigInt("ShowBlindButtons")) buttonLabelArray[i]->setPixmap(bigblindButton);
|
|
||||||
// else { buttonLabelArray[i]->setPixmap(onePix); }
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// default: buttonLabelArray[i]->setPixmap(onePix);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else { buttonLabelArray[i]->setPixmap(onePix); }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
|
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
|
||||||
if( (*it_c)->getMyActiveStatus() ) {
|
if( (*it_c)->getMyActiveStatus() ) {
|
||||||
if( currentGame->getActivePlayerList()->size() > 2 ) {
|
if( currentGame->getActivePlayerList()->size() > 2 ) {
|
||||||
@@ -1342,18 +1241,6 @@ void mainWindowImpl::refreshButton() {
|
|||||||
|
|
||||||
void mainWindowImpl::refreshPlayerName() {
|
void mainWindowImpl::refreshPlayerName() {
|
||||||
|
|
||||||
// int i;
|
|
||||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[i]->getMyActiveStatus()) {
|
|
||||||
// playerNameLabelArray[i]->setText(QString::fromUtf8(mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[i]->getMyName().c_str()));
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// playerNameLabelArray[i]->setText("");
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
@@ -1385,36 +1272,9 @@ QStringList mainWindowImpl::getPlayerNicksList() {
|
|||||||
void mainWindowImpl::refreshPlayerAvatar() {
|
void mainWindowImpl::refreshPlayerAvatar() {
|
||||||
|
|
||||||
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
|
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
|
||||||
// int i;
|
|
||||||
|
|
||||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||||
|
|
||||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
|
||||||
//
|
|
||||||
// if(!i) {
|
|
||||||
// if(currentHand->getPlayerArray()[0]->getMyAvatar() == "" || !QFile::QFile(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyAvatar().c_str())).exists()) {
|
|
||||||
// playerAvatarLabelArray[0]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/genereticAvatar.png"));
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// playerAvatarLabelArray[0]->setPixmap(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyAvatar().c_str()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyAvatar() == "" || !QFile::QFile(QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyAvatar().c_str())).exists()) {
|
|
||||||
// playerAvatarLabelArray[i]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/genereticAvatar.png"));
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// playerAvatarLabelArray[i]->setPixmap(QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyAvatar().c_str()));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// playerAvatarLabelArray[i]->setPixmap(onePix);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
||||||
if((*it_c)->getMyActiveStatus()) {
|
if((*it_c)->getMyActiveStatus()) {
|
||||||
@@ -1431,7 +1291,6 @@ void mainWindowImpl::refreshPlayerAvatar() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
||||||
@@ -1446,38 +1305,6 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
|||||||
|
|
||||||
if(playerID == -1 || playerAction == -1) {
|
if(playerID == -1 || playerAction == -1) {
|
||||||
|
|
||||||
// int i;
|
|
||||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
//
|
|
||||||
// //if no action --> clear Pixmap
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyAction() == 0) {
|
|
||||||
// actionLabelArray[i]->setPixmap(onePix);
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// // if(i!=0 || ( i==0 && currentHand->getPlayerArray()[0]->getMyAction() != 1) ) {
|
|
||||||
// //paint action pixmap
|
|
||||||
// actionLabelArray[i]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_"+actionArray[currentHand->getPlayerArray()[i]->getMyAction()]+".png"));
|
|
||||||
// // }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (currentHand->getPlayerArray()[i]->getMyAction()==1) {
|
|
||||||
// // groupBoxArray[i]->setDisabled(TRUE);
|
|
||||||
//
|
|
||||||
// if(i != 0) {
|
|
||||||
// holeCardsArray[i][0]->setPixmap(onePix, FALSE);
|
|
||||||
// holeCardsArray[i][1]->setPixmap(onePix, FALSE);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
||||||
|
|
||||||
@@ -1486,10 +1313,8 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
|||||||
actionLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
|
actionLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// if(i!=0 || ( i==0 && currentHand->getPlayerArray()[0]->getMyAction() != 1) ) {
|
|
||||||
//paint action pixmap
|
//paint action pixmap
|
||||||
actionLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_"+actionArray[(*it_c)->getMyAction()]+".png"));
|
actionLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_"+actionArray[(*it_c)->getMyAction()]+".png"));
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*it_c)->getMyAction()==1) {
|
if ((*it_c)->getMyAction()==1) {
|
||||||
@@ -1501,19 +1326,6 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//if no action --> clear Pixmap
|
//if no action --> clear Pixmap
|
||||||
@@ -1546,22 +1358,8 @@ void mainWindowImpl::refreshAction(int playerID, int playerAction) {
|
|||||||
|
|
||||||
void mainWindowImpl::refreshCash() {
|
void mainWindowImpl::refreshCash() {
|
||||||
|
|
||||||
// int i;
|
|
||||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||||
|
|
||||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
|
||||||
//
|
|
||||||
// cashLabelArray[i]->setText(QString::number(currentHand->getPlayerArray()[i]->getMyCash(),10)+" $");
|
|
||||||
// cashTopLabelArray[i]->setText("Cash:");
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// cashLabelArray[i]->setText("");
|
|
||||||
// cashTopLabelArray[i]->setText("");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
||||||
if((*it_c)->getMyActiveStatus()) {
|
if((*it_c)->getMyActiveStatus()) {
|
||||||
@@ -1582,64 +1380,10 @@ void mainWindowImpl::refreshCash() {
|
|||||||
|
|
||||||
void mainWindowImpl::refreshGroupbox(int playerID, int status) {
|
void mainWindowImpl::refreshGroupbox(int playerID, int status) {
|
||||||
|
|
||||||
// int i;
|
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
if(playerID == -1 || status == -1) {
|
if(playerID == -1 || status == -1) {
|
||||||
|
|
||||||
// HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
|
||||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
//
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyTurn()) {
|
|
||||||
// //Groupbox glow wenn der Spiele dran ist.
|
|
||||||
// if(i==0) {
|
|
||||||
// groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxActiveGlow.png) }");
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// groupBoxArray[i]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxActiveGlow.png) }");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// //Groupbox auf Hintergrundfarbe setzen wenn der Spiele nicht dran aber aktiv ist.
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
|
|
||||||
// if(i==0) {
|
|
||||||
// groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow.png) }");
|
|
||||||
// //show buttons
|
|
||||||
// for(j=0; j<3; j++) {
|
|
||||||
// userWidgetsArray[j]->show();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// groupBoxArray[i]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxInactiveGlow.png) }");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //Groupbox verdunkeln wenn der Spiele inactive ist.
|
|
||||||
// else {
|
|
||||||
// if(i==0) {
|
|
||||||
// groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow.png) }");
|
|
||||||
// //hide buttons
|
|
||||||
// for(j=0; j<4; j++) {
|
|
||||||
// userWidgetsArray[j]->hide();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// groupBoxArray[i]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxInactiveGlow.png) }");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
||||||
@@ -1682,19 +1426,6 @@ void mainWindowImpl::refreshGroupbox(int playerID, int status) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch(status) {
|
switch(status) {
|
||||||
@@ -1781,14 +1512,8 @@ void mainWindowImpl::refreshGameLabels(int gameState) {
|
|||||||
|
|
||||||
void mainWindowImpl::refreshAll() {
|
void mainWindowImpl::refreshAll() {
|
||||||
|
|
||||||
// int i;
|
|
||||||
|
|
||||||
refreshSet();
|
refreshSet();
|
||||||
refreshButton();
|
refreshButton();
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// refreshAction( i, mySession->getCurrentGame()->getPlayerArray()[i]->getMyAction());
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
@@ -1796,10 +1521,6 @@ void mainWindowImpl::refreshAll() {
|
|||||||
refreshAction( (*it_c)->getMyID(), (*it_c)->getMyAction());
|
refreshAction( (*it_c)->getMyID(), (*it_c)->getMyAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
refreshCash();
|
refreshCash();
|
||||||
refreshGroupbox();
|
refreshGroupbox();
|
||||||
refreshPlayerName();
|
refreshPlayerName();
|
||||||
@@ -1808,12 +1529,7 @@ void mainWindowImpl::refreshAll() {
|
|||||||
|
|
||||||
void mainWindowImpl::refreshChangePlayer() {
|
void mainWindowImpl::refreshChangePlayer() {
|
||||||
|
|
||||||
// int i;
|
|
||||||
|
|
||||||
refreshSet();
|
refreshSet();
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// refreshAction( i, mySession->getCurrentGame()->getPlayerArray()[i]->getMyAction());
|
|
||||||
// }
|
|
||||||
|
|
||||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
@@ -1849,42 +1565,8 @@ void mainWindowImpl::dealHoleCards() {
|
|||||||
int tempCardsIntArray[2];
|
int tempCardsIntArray[2];
|
||||||
|
|
||||||
// Karten der Gegner und eigene Karten austeilen
|
// Karten der Gegner und eigene Karten austeilen
|
||||||
// int i;
|
|
||||||
int j;
|
int j;
|
||||||
Game *currentGame = mySession->getCurrentGame();
|
Game *currentGame = mySession->getCurrentGame();
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// currentGame->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
|
||||||
// for(j=0; j<2; j++) {
|
|
||||||
// if(currentGame->getPlayerArray()[i]->getMyActiveStatus()) {
|
|
||||||
// if ((i == 0) || DEBUG_MODE) {
|
|
||||||
// if(myConfig->readConfigInt("AntiPeekMode")) {
|
|
||||||
// holeCardsArray[i][j]->setPixmap(*flipside, TRUE);
|
|
||||||
// tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png");
|
|
||||||
// holeCardsArray[i][j]->setFrontPixmap(tempCardsPixmapArray[j]);
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png");
|
|
||||||
// holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j],FALSE);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// holeCardsArray[i][j]->setPixmap(*flipside, TRUE);
|
|
||||||
// /* holeCardsArray[i][j]->setStyleSheet("QLabel:hover { background-image:url(:/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");*/
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
//
|
|
||||||
// holeCardsArray[i][j]->setPixmap(onePix, FALSE);
|
|
||||||
// // holeCardsArray[i][j]->repaint();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
for(it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
|
for(it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
|
||||||
@@ -2403,14 +2085,6 @@ int mainWindowImpl::getMyCallAmount() {
|
|||||||
|
|
||||||
tempHighestSet = currentHand->getCurrentBeRo()->getHighestSet();
|
tempHighestSet = currentHand->getCurrentBeRo()->getHighestSet();
|
||||||
|
|
||||||
// if (currentHand->getPlayerArray()[0]->getMyCash()+currentHand->getPlayerArray()[0]->getMySet() <= tempHighestSet) {
|
|
||||||
//
|
|
||||||
// return currentHand->getPlayerArray()[0]->getMyCash();
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// return tempHighestSet - currentHand->getPlayerArray()[0]->getMySet();
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (currentHand->getSeatsList()->front()->getMyCash()+currentHand->getSeatsList()->front()->getMySet() <= tempHighestSet) {
|
if (currentHand->getSeatsList()->front()->getMyCash()+currentHand->getSeatsList()->front()->getMySet() <= tempHighestSet) {
|
||||||
|
|
||||||
return currentHand->getSeatsList()->front()->getMyCash();
|
return currentHand->getSeatsList()->front()->getMyCash();
|
||||||
@@ -2506,7 +2180,7 @@ void mainWindowImpl::mySet(){
|
|||||||
|
|
||||||
// cout << "Set-Value " << spinBox_set->value() << endl;
|
// cout << "Set-Value " << spinBox_set->value() << endl;
|
||||||
currentHand->getSeatsList()->front()->setMySet(spinBox_set->value());
|
currentHand->getSeatsList()->front()->setMySet(spinBox_set->value());
|
||||||
// cout << "MySET " << currentHand->getPlayerArray()[0]->getMySet() << endl;
|
|
||||||
if (spinBox_set->value() >= tempCash ) {
|
if (spinBox_set->value() >= tempCash ) {
|
||||||
|
|
||||||
currentHand->getSeatsList()->front()->setMySet(currentHand->getSeatsList()->front()->getMyCash());
|
currentHand->getSeatsList()->front()->setMySet(currentHand->getSeatsList()->front()->getMyCash());
|
||||||
@@ -2709,7 +2383,6 @@ void mainWindowImpl::nextPlayerAnimation() {
|
|||||||
|
|
||||||
//refresh Change Player
|
//refresh Change Player
|
||||||
refreshSet();
|
refreshSet();
|
||||||
// refreshAction(currentHand->getLastPlayersTurn(), currentHand->getPlayerArray()[currentHand->getLastPlayersTurn()]->getMyAction());
|
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
for(it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
for(it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
|
||||||
@@ -2791,17 +2464,8 @@ void mainWindowImpl::postRiverRunAnimation2() {
|
|||||||
horizontalSlider_bet->setDisabled(TRUE);
|
horizontalSlider_bet->setDisabled(TRUE);
|
||||||
spinBox_set->setDisabled(TRUE);
|
spinBox_set->setDisabled(TRUE);
|
||||||
|
|
||||||
|
|
||||||
// int i;
|
|
||||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||||
|
|
||||||
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
|
|
||||||
// int activePlayersCounter = 0;
|
|
||||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if (currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus()) activePlayersCounter++;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
int nonfoldPlayersCounter = 0;
|
int nonfoldPlayersCounter = 0;
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||||
@@ -2809,100 +2473,6 @@ void mainWindowImpl::postRiverRunAnimation2() {
|
|||||||
nonfoldPlayersCounter++;
|
nonfoldPlayersCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if(nonfoldPlayersCounter!=1) {
|
|
||||||
//
|
|
||||||
// if(!flipHolecardsAllInAlreadyDone) {
|
|
||||||
//
|
|
||||||
// //TODO - Turn cards like in the rules
|
|
||||||
//
|
|
||||||
// // postRiverRunAnimation2_flipHoleCards1Timer->start(nextPlayerSpeed2);
|
|
||||||
//
|
|
||||||
// // //Config? mit oder ohne Eye-Candy?
|
|
||||||
// if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
|
||||||
// // mit Eye-Candy
|
|
||||||
//
|
|
||||||
// //TempArrays
|
|
||||||
// int tempCardsIntArray[2];
|
|
||||||
//
|
|
||||||
// int i, j;
|
|
||||||
//
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
|
|
||||||
// if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
|
|
||||||
// for(j=0; j<2; j++) {
|
|
||||||
//
|
|
||||||
// holeCardsArray[i][j]->startFlipCards(guiGameSpeed, QPixmap(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //set Player value (logging)
|
|
||||||
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,1);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// //Ohne Eye-Candy
|
|
||||||
//
|
|
||||||
// //Karten der aktiven Spieler umdrehen
|
|
||||||
// QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
|
|
||||||
//
|
|
||||||
// //TempArrays
|
|
||||||
// QPixmap tempCardsPixmapArray[2];
|
|
||||||
// int tempCardsIntArray[2];
|
|
||||||
//
|
|
||||||
// int i, j;
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
|
|
||||||
// if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
|
|
||||||
// for(j=0; j<2; j++) {
|
|
||||||
// tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png");
|
|
||||||
// holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //set Player value (logging)
|
|
||||||
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,1);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //Wenn einmal umgedreht dann fertig!!
|
|
||||||
// flipHolecardsAllInAlreadyDone = TRUE;
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// int tempCardsIntArray[2];
|
|
||||||
// int i;
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
|
|
||||||
//
|
|
||||||
// //set Player value (logging)
|
|
||||||
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,3);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// postRiverRunAnimation2Timer->start(postRiverRunAnimationSpeed);
|
|
||||||
// }
|
|
||||||
// else { postRiverRunAnimation3(); }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(nonfoldPlayersCounter!=1) {
|
if(nonfoldPlayersCounter!=1) {
|
||||||
|
|
||||||
if(!flipHolecardsAllInAlreadyDone) {
|
if(!flipHolecardsAllInAlreadyDone) {
|
||||||
@@ -3015,100 +2585,9 @@ void mainWindowImpl::postRiverRunAnimation2_flipHoleCards2() {
|
|||||||
|
|
||||||
void mainWindowImpl::postRiverRunAnimation3() {
|
void mainWindowImpl::postRiverRunAnimation3() {
|
||||||
|
|
||||||
// int i;
|
|
||||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||||
//Alle Winner erhellen und "Winner" schreiben
|
//Alle Winner erhellen und "Winner" schreiben
|
||||||
|
|
||||||
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
//
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
|
|
||||||
//
|
|
||||||
// // QPalette tempPalette = groupBoxArray[i]->palette();
|
|
||||||
// // tempPalette.setColor(QPalette::Window, highlight);
|
|
||||||
// // groupBoxArray[i]->setPalette(tempPalette);
|
|
||||||
// actionLabelArray[i]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_winner.png"));
|
|
||||||
//
|
|
||||||
// //show winnercards if more than one player is active TODO
|
|
||||||
// if ( currentHand->getActivePlayerList()->size() != 1 && myConfig->readConfigInt("ShowFadeOutCardsAnimation")) {
|
|
||||||
//
|
|
||||||
// int j;
|
|
||||||
// int bestHandPos[5];
|
|
||||||
// currentHand->getPlayerArray()[i]->getMyBestHandPosition(bestHandPos);
|
|
||||||
//
|
|
||||||
// //index 0 testen --> Karte darf nicht im MyBestHand Position Array drin sein, es darf nicht nur ein Spieler Aktiv sein, die Config fordert die Animation
|
|
||||||
// bool index0 = TRUE;
|
|
||||||
// for(j=0; j<5; j++) {
|
|
||||||
// // cout << (currentHand->getPlayerArray()[i]->getMyBestHandPosition())[j] << endl;
|
|
||||||
// if (bestHandPos[j] == 0 ) { index0 = FALSE; }
|
|
||||||
// }
|
|
||||||
// if (index0) { holeCardsArray[i][0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index0" << endl;*/}
|
|
||||||
// //index 1 testen
|
|
||||||
// bool index1 = TRUE;
|
|
||||||
// for(j=0; j<5; j++) {
|
|
||||||
// if (bestHandPos[j] == 1 ) { index1 = FALSE; }
|
|
||||||
// }
|
|
||||||
// if (index1) { holeCardsArray[i][1]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index1" << endl;*/}
|
|
||||||
// //index 2 testen
|
|
||||||
// bool index2 = TRUE;
|
|
||||||
// for(j=0; j<5; j++) {
|
|
||||||
// if (bestHandPos[j] == 2 ) { index2 = FALSE; }
|
|
||||||
// }
|
|
||||||
// if (index2) { boardCardsArray[0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index2" << endl;*/}
|
|
||||||
// //index 3 testen
|
|
||||||
// bool index3 = TRUE;
|
|
||||||
// for(j=0; j<5; j++) {
|
|
||||||
// if (bestHandPos[j] == 3 ) { index3 = FALSE; }
|
|
||||||
// }
|
|
||||||
// if (index3) { boardCardsArray[1]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index3" << endl;*/}
|
|
||||||
// //index 4 testen
|
|
||||||
// bool index4 = TRUE;
|
|
||||||
// for(j=0; j<5; j++) {
|
|
||||||
// if (bestHandPos[j] == 4 ) { index4 = FALSE; }
|
|
||||||
// }
|
|
||||||
// if (index4) { boardCardsArray[2]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index4" << endl;*/}
|
|
||||||
// //index 5 testen
|
|
||||||
// bool index5 = TRUE;
|
|
||||||
// for(j=0; j<5; j++) {
|
|
||||||
// if (bestHandPos[j] == 5 ) { index5 = FALSE; }
|
|
||||||
// }
|
|
||||||
// if (index5) { boardCardsArray[3]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index5" << endl;*/}
|
|
||||||
// //index 6 testen
|
|
||||||
// bool index6 = TRUE;
|
|
||||||
// for(j=0; j<5; j++) {
|
|
||||||
// if (bestHandPos[j] == 6 ) { index6 = FALSE; }
|
|
||||||
// }
|
|
||||||
// if (index6) { boardCardsArray[4]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index6" << endl;*/}
|
|
||||||
// }
|
|
||||||
// //Pot-Verteilung Loggen
|
|
||||||
// //Pro Spieler den Cash aus dem Player und dem Label auslesen. Player_cash - Label_cash = Gewinnsumme
|
|
||||||
// bool toIntBool = TRUE;
|
|
||||||
// int pot = currentHand->getPlayerArray()[i]->getMyCash() - cashLabelArray[i]->text().remove(" $").toInt(&toIntBool,10) ;
|
|
||||||
// //Wenn River dann auch das Blatt loggen!
|
|
||||||
// // if (textLabel_handLabel->text() == "River") {
|
|
||||||
//
|
|
||||||
// //set Player value (logging)
|
|
||||||
// currentHand->getPlayerArray()[i]->setMyWinnerState(1, pot);
|
|
||||||
//
|
|
||||||
// // }
|
|
||||||
// // else {
|
|
||||||
// // myLog->logPlayerWinsMsg(i, pot);
|
|
||||||
// // }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
//
|
|
||||||
// if( currentHand->getActivePlayerList()->size() != 1 && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus() && myConfig->readConfigInt("ShowFadeOutCardsAnimation") ) {
|
|
||||||
//
|
|
||||||
// //aufgedeckte Gegner auch ausblenden
|
|
||||||
// holeCardsArray[i][0]->startFadeOut(guiGameSpeed);
|
|
||||||
// holeCardsArray[i][1]->startFadeOut(guiGameSpeed);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int nonfoldPlayerCounter = 0;
|
int nonfoldPlayerCounter = 0;
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
|
|
||||||
@@ -3140,7 +2619,6 @@ void mainWindowImpl::postRiverRunAnimation3() {
|
|||||||
//index 0 testen --> Karte darf nicht im MyBestHand Position Array drin sein, es darf nicht nur ein Spieler Aktiv sein, die Config fordert die Animation
|
//index 0 testen --> Karte darf nicht im MyBestHand Position Array drin sein, es darf nicht nur ein Spieler Aktiv sein, die Config fordert die Animation
|
||||||
bool index0 = TRUE;
|
bool index0 = TRUE;
|
||||||
for(j=0; j<5; j++) {
|
for(j=0; j<5; j++) {
|
||||||
// cout << (currentHand->getPlayerArray()[i]->getMyBestHandPosition())[j] << endl;
|
|
||||||
if (bestHandPos[j] == 0 ) { index0 = FALSE; }
|
if (bestHandPos[j] == 0 ) { index0 = FALSE; }
|
||||||
}
|
}
|
||||||
if (index0) { holeCardsArray[(*it_c)->getMyID()][0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index0" << endl;*/}
|
if (index0) { holeCardsArray[(*it_c)->getMyID()][0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index0" << endl;*/}
|
||||||
@@ -3242,42 +2720,8 @@ void mainWindowImpl::postRiverRunAnimation4() {
|
|||||||
|
|
||||||
void mainWindowImpl::postRiverRunAnimation5() {
|
void mainWindowImpl::postRiverRunAnimation5() {
|
||||||
|
|
||||||
// int i;
|
|
||||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||||
|
|
||||||
//CashTopLabel und PotLabel blinken lassen
|
|
||||||
// if (distributePotAnimCounter<10) {
|
|
||||||
//
|
|
||||||
// if (distributePotAnimCounter==0 || distributePotAnimCounter==2 || distributePotAnimCounter==4 || distributePotAnimCounter==6 || distributePotAnimCounter==8) {
|
|
||||||
//
|
|
||||||
// label_Pot->setText("");
|
|
||||||
//
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
|
|
||||||
//
|
|
||||||
// cashTopLabelArray[i]->setText("");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// label_Pot->setText("Pot");
|
|
||||||
//
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
|
|
||||||
//
|
|
||||||
// cashTopLabelArray[i]->setText("Cash:");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// distributePotAnimCounter++;
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// potDistributeTimer->stop();
|
|
||||||
// postRiverRunAnimation5Timer->start(gameSpeed);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
|
|
||||||
if (distributePotAnimCounter<10) {
|
if (distributePotAnimCounter<10) {
|
||||||
@@ -3329,16 +2773,9 @@ void mainWindowImpl::postRiverRunAnimation6() {
|
|||||||
|
|
||||||
// wenn nur noch ein Spieler aktive "neues Spiel"-Dialog anzeigen
|
// wenn nur noch ein Spieler aktive "neues Spiel"-Dialog anzeigen
|
||||||
int playersPositiveCashCounter = 0;
|
int playersPositiveCashCounter = 0;
|
||||||
// for (i=0; i<mySession->getCurrentGame()->getStartQuantityPlayers(); i++) {
|
|
||||||
// // cout << "player 0 cash: " << currentHand->getPlayerArray()[0]->getMyCash()
|
|
||||||
//
|
|
||||||
// if (currentHand->getPlayerArray()[i]->getMyCash() > 0)
|
|
||||||
// playersPositiveCashCounter++;
|
|
||||||
// }
|
|
||||||
|
|
||||||
PlayerListConstIterator it_c;
|
PlayerListConstIterator it_c;
|
||||||
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||||
// cout << "player 0 cash: " << currentHand->getPlayerArray()[0]->getMyCash()
|
|
||||||
|
|
||||||
if ((*it_c)->getMyCash() > 0) playersPositiveCashCounter++;
|
if ((*it_c)->getMyCash() > 0) playersPositiveCashCounter++;
|
||||||
}
|
}
|
||||||
@@ -3347,18 +2784,6 @@ void mainWindowImpl::postRiverRunAnimation6() {
|
|||||||
|
|
||||||
if (playersPositiveCashCounter==1) {
|
if (playersPositiveCashCounter==1) {
|
||||||
|
|
||||||
// for (i=0; i<mySession->getCurrentGame()->getStartQuantityPlayers(); i++) {
|
|
||||||
// // cout << "player 0 cash: " << currentHand->getPlayerArray()[0]->getMyCash()
|
|
||||||
// if (currentHand->get/*PlayerArray*/()[i]->getMyCash() > 0) {
|
|
||||||
// (statisticArray[currentHand->getPlayerArray()[i]->getMyDude4()+7])++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for(i=0; i<15; i++) {
|
|
||||||
// cout << i-7 << ": " << statisticArray[i] << " | ";
|
|
||||||
// }
|
|
||||||
// cout << endl;
|
|
||||||
|
|
||||||
callNewGameDialog();
|
callNewGameDialog();
|
||||||
//Bei Cancel nichts machen!!!
|
//Bei Cancel nichts machen!!!
|
||||||
return;
|
return;
|
||||||
@@ -3369,76 +2794,8 @@ void mainWindowImpl::postRiverRunAnimation6() {
|
|||||||
|
|
||||||
void mainWindowImpl::flipHolecardsAllIn() {
|
void mainWindowImpl::flipHolecardsAllIn() {
|
||||||
|
|
||||||
// int i;
|
|
||||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||||
|
|
||||||
// if(!flipHolecardsAllInAlreadyDone) {
|
|
||||||
// //Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
|
|
||||||
// int activePlayersCounter = 0;
|
|
||||||
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// if (currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus() == 1) activePlayersCounter++;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if(activePlayersCounter!=1) {
|
|
||||||
//
|
|
||||||
// //Config? mit oder ohne Eye-Candy?
|
|
||||||
// if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
|
||||||
// // mit Eye-Candy
|
|
||||||
//
|
|
||||||
// //TempArrays
|
|
||||||
// int tempCardsIntArray[2];
|
|
||||||
//
|
|
||||||
// int i, j;
|
|
||||||
//
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
|
|
||||||
// if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
|
|
||||||
// for(j=0; j<2; j++) {
|
|
||||||
// holeCardsArray[i][j]->startFlipCards(guiGameSpeed, QPixmap(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //set Player value (logging)
|
|
||||||
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,2);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// //Ohne Eye-Candy
|
|
||||||
//
|
|
||||||
// //Karten der aktiven Spieler umdrehen
|
|
||||||
// QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
|
|
||||||
//
|
|
||||||
// //TempArrays
|
|
||||||
// QPixmap tempCardsPixmapArray[2];
|
|
||||||
// int temp2CardsIntArray[2];
|
|
||||||
//
|
|
||||||
// int i, j;
|
|
||||||
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
// currentHand->getPlayerArray()[i]->getMyCards(temp2CardsIntArray);
|
|
||||||
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
|
|
||||||
// if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
|
|
||||||
// for(j=0; j<2; j++) {
|
|
||||||
//
|
|
||||||
// tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(temp2CardsIntArray[j], 10)+".png");
|
|
||||||
// holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //set Player value (logging)
|
|
||||||
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,2);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(!flipHolecardsAllInAlreadyDone) {
|
if(!flipHolecardsAllInAlreadyDone) {
|
||||||
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
|
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
|
||||||
int nonfoldPlayersCounter = 0;
|
int nonfoldPlayersCounter = 0;
|
||||||
|
|||||||
@@ -720,24 +720,6 @@ void
|
|||||||
ClientThread::RemoveDisconnectedPlayers()
|
ClientThread::RemoveDisconnectedPlayers()
|
||||||
{
|
{
|
||||||
// This should only be called between hands.
|
// This should only be called between hands.
|
||||||
// if (m_game.get())
|
|
||||||
// {
|
|
||||||
// for (int i = 0; i < m_game->getStartQuantityPlayers(); i++)
|
|
||||||
// {
|
|
||||||
// boost::shared_ptr<PlayerInterface> tmpPlayer = m_game->getPlayerArray()[i];
|
|
||||||
// if (tmpPlayer->getMyActiveStatus())
|
|
||||||
// {
|
|
||||||
// // If a player is not in the player data list, it was disconnected.
|
|
||||||
// if (!GetPlayerDataByUniqueId(tmpPlayer->getMyUniqueID()).get())
|
|
||||||
// {
|
|
||||||
// tmpPlayer->setMyCash(0);
|
|
||||||
// tmpPlayer->setMyActiveStatus(false);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// This should only be called between hands.
|
|
||||||
if (m_game.get())
|
if (m_game.get())
|
||||||
{
|
{
|
||||||
PlayerListIterator it;
|
PlayerListIterator it;
|
||||||
|
|||||||
Reference in New Issue
Block a user