logging playerAction in engine now
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC)
|
LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC)
|
||||||
: HandInterface(), myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(0), bettingRoundsPlayed(0)
|
: HandInterface(), myFactory(f), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), lastPlayersTurn(0), allInCondition(0), bettingRoundsPlayed(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
@@ -272,6 +272,7 @@ void LocalHand::assignButtons() {
|
|||||||
|
|
||||||
void LocalHand::switchRounds() {
|
void LocalHand::switchRounds() {
|
||||||
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// cout <<" ------- HandID: " << myID << " | actualround: " << actualRound << " ---------" << endl;
|
// cout <<" ------- HandID: " << myID << " | actualround: " << actualRound << " ---------" << endl;
|
||||||
|
|||||||
@@ -64,7 +64,11 @@ public:
|
|||||||
int getMySet() const { return mySet;}
|
int getMySet() const { return mySet;}
|
||||||
int getMyLastRelativeSet() const { return myLastRelativeSet; }
|
int getMyLastRelativeSet() const { return myLastRelativeSet; }
|
||||||
|
|
||||||
void setMyAction(int theValue) { myAction = theValue; }
|
void setMyAction(int theValue) {
|
||||||
|
myAction = theValue;
|
||||||
|
// logging for human player
|
||||||
|
if(myAction) actualHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, mySet);
|
||||||
|
}
|
||||||
int getMyAction() const { return myAction; }
|
int getMyAction() const { return myAction; }
|
||||||
|
|
||||||
void setMyButton(int theValue) { myButton = theValue; }
|
void setMyButton(int theValue) { myButton = theValue; }
|
||||||
|
|||||||
+6
-4
@@ -138,10 +138,7 @@ void Game::initHand()
|
|||||||
// smallBlind alle x Runden erhöhen
|
// smallBlind alle x Runden erhöhen
|
||||||
if(actualHandID%(startHandsBeforeRaiseSmallBlind+1) == 0) { actualSmallBlind *= 2; }
|
if(actualHandID%(startHandsBeforeRaiseSmallBlind+1) == 0) { actualSmallBlind *= 2; }
|
||||||
|
|
||||||
//Spieler Action auf 0 setzen
|
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
|
||||||
playerArray[i]->setMyAction(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Spieler mit leerem Cash auf inactive setzen
|
// Spieler mit leerem Cash auf inactive setzen
|
||||||
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
@@ -157,6 +154,11 @@ void Game::initHand()
|
|||||||
// Hand erstellen
|
// Hand erstellen
|
||||||
actualHand = myFactory->createHand(myFactory, myGui, actualBoard, playerArray, actualHandID, startQuantityPlayers, actualQuantityPlayers, dealerPosition, actualSmallBlind, startCash);
|
actualHand = myFactory->createHand(myFactory, myGui, actualBoard, playerArray, actualHandID, startQuantityPlayers, actualQuantityPlayers, dealerPosition, actualSmallBlind, startCash);
|
||||||
|
|
||||||
|
//Spieler Action auf 0 setzen
|
||||||
|
for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
|
||||||
|
playerArray[i]->setMyAction(0);
|
||||||
|
}
|
||||||
|
|
||||||
// Dealer-Button weiterschieben --> Achtung inactive
|
// Dealer-Button weiterschieben --> Achtung inactive
|
||||||
do {
|
do {
|
||||||
dealerPosition = (dealerPosition+1)%(MAX_NUMBER_OF_PLAYERS);
|
dealerPosition = (dealerPosition+1)%(MAX_NUMBER_OF_PLAYERS);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
|
||||||
: QMainWindow(parent), myConfig(c), gameSpeed(0), debugMode(0), breakAfterActualHand(FALSE)
|
: QMainWindow(parent), myConfig(c), gameSpeed(0), myActionIsBet(0), myActionIsRaise(0), debugMode(0), breakAfterActualHand(FALSE)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -1496,8 +1496,8 @@ void mainWindowImpl::myFold(){
|
|||||||
currentHand->getPlayerArray()[0]->setMyAction(1);
|
currentHand->getPlayerArray()[0]->setMyAction(1);
|
||||||
currentHand->getPlayerArray()[0]->setMyTurn(0);
|
currentHand->getPlayerArray()[0]->setMyTurn(0);
|
||||||
|
|
||||||
//Action in LogWindow
|
// //Action in LogWindow
|
||||||
myLog->logPlayerActionMsg(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyName().c_str()), currentHand->getPlayerArray()[0]->getMyAction(), currentHand->getPlayerArray()[0]->getMySet());
|
// myLog->logPlayerActionMsg(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyName().c_str()), currentHand->getPlayerArray()[0]->getMyAction(), currentHand->getPlayerArray()[0]->getMySet());
|
||||||
|
|
||||||
holeCardsArray[0][0]->startFadeOut(10);
|
holeCardsArray[0][0]->startFadeOut(10);
|
||||||
holeCardsArray[0][1]->startFadeOut(10);
|
holeCardsArray[0][1]->startFadeOut(10);
|
||||||
@@ -1514,11 +1514,12 @@ void mainWindowImpl::myFold(){
|
|||||||
|
|
||||||
void mainWindowImpl::myCheck() {
|
void mainWindowImpl::myCheck() {
|
||||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||||
currentHand->getPlayerArray()[0]->setMyAction(2);
|
|
||||||
currentHand->getPlayerArray()[0]->setMyTurn(0);
|
|
||||||
|
|
||||||
//Action in LogWindow
|
currentHand->getPlayerArray()[0]->setMyTurn(0);
|
||||||
myLog->logPlayerActionMsg(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyName().c_str()), currentHand->getPlayerArray()[0]->getMyAction(), currentHand->getPlayerArray()[0]->getMySet());
|
currentHand->getPlayerArray()[0]->setMyAction(2);
|
||||||
|
|
||||||
|
// //Action in LogWindow
|
||||||
|
// myLog->logPlayerActionMsg(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyName().c_str()), currentHand->getPlayerArray()[0]->getMyAction(), currentHand->getPlayerArray()[0]->getMySet());
|
||||||
|
|
||||||
disableMyButtons();
|
disableMyButtons();
|
||||||
|
|
||||||
@@ -1550,9 +1551,9 @@ void mainWindowImpl::myCall(){
|
|||||||
|
|
||||||
if (currentHand->getPlayerArray()[0]->getMyCash()+currentHand->getPlayerArray()[0]->getMySet() <= tempHighestSet) {
|
if (currentHand->getPlayerArray()[0]->getMyCash()+currentHand->getPlayerArray()[0]->getMySet() <= tempHighestSet) {
|
||||||
|
|
||||||
currentHand->getPlayerArray()[0]->setMyAction(6);
|
|
||||||
currentHand->getPlayerArray()[0]->setMySet(currentHand->getPlayerArray()[0]->getMyCash());
|
currentHand->getPlayerArray()[0]->setMySet(currentHand->getPlayerArray()[0]->getMyCash());
|
||||||
currentHand->getPlayerArray()[0]->setMyCash(0);
|
currentHand->getPlayerArray()[0]->setMyCash(0);
|
||||||
|
currentHand->getPlayerArray()[0]->setMyAction(6);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
currentHand->getPlayerArray()[0]->setMySet(tempHighestSet - currentHand->getPlayerArray()[0]->getMySet());
|
currentHand->getPlayerArray()[0]->setMySet(tempHighestSet - currentHand->getPlayerArray()[0]->getMySet());
|
||||||
@@ -1563,8 +1564,8 @@ void mainWindowImpl::myCall(){
|
|||||||
currentHand->getBoard()->collectSets();
|
currentHand->getBoard()->collectSets();
|
||||||
refreshPot();
|
refreshPot();
|
||||||
|
|
||||||
//Action in LogWindow
|
// //Action in LogWindow
|
||||||
myLog->logPlayerActionMsg(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyName().c_str()), currentHand->getPlayerArray()[0]->getMyAction(), currentHand->getPlayerArray()[0]->getMySet());
|
// myLog->logPlayerActionMsg(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyName().c_str()), currentHand->getPlayerArray()[0]->getMyAction(), currentHand->getPlayerArray()[0]->getMySet());
|
||||||
|
|
||||||
disableMyButtons();
|
disableMyButtons();
|
||||||
|
|
||||||
@@ -1594,7 +1595,7 @@ void mainWindowImpl::myBet(){
|
|||||||
spinBox_set->setFocus();
|
spinBox_set->setFocus();
|
||||||
spinBox_set->selectAll();
|
spinBox_set->selectAll();
|
||||||
|
|
||||||
currentHand->getPlayerArray()[0]->setMyAction(4);
|
myActionIsBet = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowImpl::myRaise(){
|
void mainWindowImpl::myRaise(){
|
||||||
@@ -1625,7 +1626,7 @@ void mainWindowImpl::myRaise(){
|
|||||||
spinBox_set->setFocus();
|
spinBox_set->setFocus();
|
||||||
spinBox_set->selectAll();
|
spinBox_set->selectAll();
|
||||||
|
|
||||||
currentHand->getPlayerArray()[0]->setMyAction(5);
|
myActionIsRaise = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowImpl::mySet(){
|
void mainWindowImpl::mySet(){
|
||||||
@@ -1638,11 +1639,12 @@ void mainWindowImpl::mySet(){
|
|||||||
// cout << "MySET " << currentHand->getPlayerArray()[0]->getMySet() << endl;
|
// cout << "MySET " << currentHand->getPlayerArray()[0]->getMySet() << endl;
|
||||||
if (spinBox_set->value() >= tempCash ) {
|
if (spinBox_set->value() >= tempCash ) {
|
||||||
|
|
||||||
currentHand->getPlayerArray()[0]->setMyAction(6);
|
|
||||||
currentHand->getPlayerArray()[0]->setMySet(currentHand->getPlayerArray()[0]->getMyCash());
|
currentHand->getPlayerArray()[0]->setMySet(currentHand->getPlayerArray()[0]->getMyCash());
|
||||||
currentHand->getPlayerArray()[0]->setMyCash(0);
|
currentHand->getPlayerArray()[0]->setMyCash(0);
|
||||||
|
currentHand->getPlayerArray()[0]->setMyAction(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (currentHand->getActualRound()) {
|
switch (currentHand->getActualRound()) {
|
||||||
|
|
||||||
case 0: {currentHand->getPreflop()->setHighestSet(currentHand->getPlayerArray()[0]->getMySet());}
|
case 0: {currentHand->getPreflop()->setHighestSet(currentHand->getPlayerArray()[0]->getMySet());}
|
||||||
@@ -1656,13 +1658,23 @@ void mainWindowImpl::mySet(){
|
|||||||
default: {}
|
default: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(myActionIsRaise) {
|
||||||
|
currentHand->getPlayerArray()[0]->setMyAction(5);
|
||||||
|
myActionIsRaise = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(myActionIsBet) {
|
||||||
|
currentHand->getPlayerArray()[0]->setMyAction(4);
|
||||||
|
myActionIsBet = 0;
|
||||||
|
}
|
||||||
|
|
||||||
currentHand->getPlayerArray()[0]->setMyTurn(0);
|
currentHand->getPlayerArray()[0]->setMyTurn(0);
|
||||||
|
|
||||||
currentHand->getBoard()->collectSets();
|
currentHand->getBoard()->collectSets();
|
||||||
refreshPot();
|
refreshPot();
|
||||||
|
|
||||||
//Action in LogWindow
|
// //Action in LogWindow
|
||||||
myLog->logPlayerActionMsg(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyName().c_str()), currentHand->getPlayerArray()[0]->getMyAction(), currentHand->getPlayerArray()[0]->getMySet());
|
// myLog->logPlayerActionMsg(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyName().c_str()), currentHand->getPlayerArray()[0]->getMyAction(), currentHand->getPlayerArray()[0]->getMySet());
|
||||||
|
|
||||||
disableMyButtons();
|
disableMyButtons();
|
||||||
|
|
||||||
@@ -1676,10 +1688,12 @@ void mainWindowImpl::mySet(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowImpl::myAllIn(){
|
void mainWindowImpl::myAllIn(){
|
||||||
|
|
||||||
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
|
||||||
currentHand->getPlayerArray()[0]->setMyAction(6);
|
|
||||||
currentHand->getPlayerArray()[0]->setMySet(currentHand->getPlayerArray()[0]->getMyCash());
|
currentHand->getPlayerArray()[0]->setMySet(currentHand->getPlayerArray()[0]->getMyCash());
|
||||||
currentHand->getPlayerArray()[0]->setMyCash(0);
|
currentHand->getPlayerArray()[0]->setMyCash(0);
|
||||||
|
currentHand->getPlayerArray()[0]->setMyAction(6);
|
||||||
|
|
||||||
switch (currentHand->getActualRound()) {
|
switch (currentHand->getActualRound()) {
|
||||||
|
|
||||||
@@ -1699,8 +1713,8 @@ void mainWindowImpl::myAllIn(){
|
|||||||
currentHand->getBoard()->collectSets();
|
currentHand->getBoard()->collectSets();
|
||||||
refreshPot();
|
refreshPot();
|
||||||
|
|
||||||
//Action in LogWindow
|
// //Action in LogWindow
|
||||||
myLog->logPlayerActionMsg(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyName().c_str()), currentHand->getPlayerArray()[0]->getMyAction(), currentHand->getPlayerArray()[0]->getMySet());
|
// myLog->logPlayerActionMsg(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyName().c_str()), currentHand->getPlayerArray()[0]->getMyAction(), currentHand->getPlayerArray()[0]->getMySet());
|
||||||
|
|
||||||
disableMyButtons();
|
disableMyButtons();
|
||||||
|
|
||||||
|
|||||||
@@ -358,6 +358,8 @@ private:
|
|||||||
int preflopNextPlayerSpeed;
|
int preflopNextPlayerSpeed;
|
||||||
int nextOpponentSpeed;
|
int nextOpponentSpeed;
|
||||||
|
|
||||||
|
bool myActionIsBet;
|
||||||
|
bool myActionIsRaise;
|
||||||
|
|
||||||
bool debugMode;
|
bool debugMode;
|
||||||
bool breakAfterActualHand;
|
bool breakAfterActualHand;
|
||||||
|
|||||||
Reference in New Issue
Block a user