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

98 lines
3.6 KiB
C++
Raw Normal View History

2011-07-03 22:27:36 +00:00
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2011 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
2007-08-05 13:07:23 +00:00
#include "localberopostriver.h"
#include <handinterface.h>
#include <game_defs.h>
#include <iostream>
using namespace std;
2011-10-21 00:16:43 +00:00
LocalBeRoPostRiver::LocalBeRoPostRiver(HandInterface* hi, int dP, int sB) : LocalBeRo(hi, dP, sB, GAME_STATE_POST_RIVER), highestCardsValue(0)
2007-08-05 13:07:23 +00:00
{
}
LocalBeRoPostRiver::~LocalBeRoPostRiver()
{
}
void LocalBeRoPostRiver::run()
{
}
2007-08-05 13:07:23 +00:00
void LocalBeRoPostRiver::postRiverRun()
{
PlayerListConstIterator it_c;
PlayerListIterator it;
2007-08-05 13:07:23 +00:00
// who is the winner
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() > highestCardsValue ) {
highestCardsValue = (*it_c)->getMyCardsValueInt();
2007-08-05 13:07:23 +00:00
}
}
int potPlayers = 0;
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
2007-08-05 13:07:23 +00:00
potPlayers++;
}
}
2007-11-12 22:11:16 +00:00
// prüfen ob nur noch human player an der verteilung teilnimmt und myAggressive für human player setzen
if(potPlayers == 1) {
for(it=getMyHand()->getActivePlayerList()->begin(); it!=getMyHand()->getActivePlayerList()->end(); ++it) {
2007-11-12 22:11:16 +00:00
if( (*it)->getMyAction() != PLAYER_ACTION_FOLD) {
(*it)->setMyAggressive(true);
}
}
}
2007-08-05 13:07:23 +00:00
2007-11-12 22:11:16 +00:00
// it = getMyHand()->getActivePlayerIt(0);
// if( it != getMyHand()->getActivePlayerList()->end() ) {
// if( potPlayers == 1 && (*it)->getMyAction() != PLAYER_ACTION_FOLD ) {
// (*it)->setMyAggressive(true);
// }
// }
// Spieler ermitteln, welche die Karten auf jeden Fall umdrehen müssen
getMyHand()->getBoard()->determinePlayerNeedToShowCards();
2007-08-05 13:07:23 +00:00
// Pot-Verteilung
2007-08-10 18:44:41 +00:00
getMyHand()->getBoard()->distributePot();
2007-08-05 13:07:23 +00:00
//Pot auf 0 setzen
2007-08-07 23:59:34 +00:00
getMyHand()->getBoard()->setPot(0);
2011-10-21 00:16:43 +00:00
// Logging hole Cards / Hands
int myCards[2];
for(it_c=getMyHand()->getActivePlayerList()->begin(); it_c!=getMyHand()->getActivePlayerList()->end(); ++it_c) {
if( (*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
(*it_c)->getMyCards(myCards);
getMyHand()->getLog()->logHoleCardsHandName((*it_c)->getMyID()+1,myCards,(*it_c)->getMyCardsValueInt(),getMyHand()->getActivePlayerList());
}
}
2007-08-05 13:07:23 +00:00
//starte die Animaionsreihe
getMyHand()->getGuiInterface()->postRiverRunAnimation1();
2007-08-05 13:07:23 +00:00
}