adapt log of local game to log of network/internet game

This commit is contained in:
floty
2012-12-22 00:19:53 +01:00
parent 2b1543a453
commit dc5f7fb495
8 changed files with 30 additions and 40 deletions
+3 -3
View File
@@ -490,7 +490,7 @@ void LocalHand::setBlinds()
(*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);
} else { } else {
(*it_c)->setMySet(smallBlind); (*it_c)->setMySet(smallBlind);
@@ -510,7 +510,7 @@ void LocalHand::setBlinds()
(*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);
} else { } else {
(*it_c)->setMySet(2*smallBlind); (*it_c)->setMySet(2*smallBlind);
@@ -526,7 +526,7 @@ void LocalHand::switchRounds()
// logging last player action // logging last player action
PlayerListConstIterator previousPlayerIt = getRunningPlayerIt(previousPlayerID); PlayerListConstIterator previousPlayerIt = getRunningPlayerIt(previousPlayerID);
if(previousPlayerIt != runningPlayerList->end()) { if(previousPlayerIt != runningPlayerList->end()) {
if(myLog) myLog->logPlayerAction((*previousPlayerIt)->getMyName(),myLog->transformPlayerActionLog((*previousPlayerIt)->getMyAction()),(*previousPlayerIt)->getMySet()); if(myLog) myLog->logPlayerAction((*previousPlayerIt)->getMyName(),myLog->transformPlayerActionLog((*previousPlayerIt)->getMyAction()),(*previousPlayerIt)->getMyLastRelativeSet());
} }
PlayerListIterator it, it_1; PlayerListIterator it, it_1;
+11 -21
View File
@@ -1068,7 +1068,7 @@ void LocalPlayer::action()
//set that i was the last active player. need this for unhighlighting groupbox //set that i was the last active player. need this for unhighlighting groupbox
currentHand->setPreviousPlayerID(myID); currentHand->setPreviousPlayerID(myID);
currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, mySet); currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, myLastRelativeSet);
currentHand->getGuiInterface()->nextPlayerAnimation(); currentHand->getGuiInterface()->nextPlayerAnimation();
// cout << "playerID in action(): " << (*(currentHand->getCurrentBeRo()->getCurrentPlayersTurnIt()))->getMyID() << endl; // cout << "playerID in action(): " << (*(currentHand->getCurrentBeRo()->getCurrentPlayersTurnIt()))->getMyID() << endl;
@@ -3230,14 +3230,12 @@ void LocalPlayer::evaluation(int bet, int raise)
case 3: { case 3: {
// all in // all in
if(highestSet >= myCash + mySet) { if(highestSet >= myCash + mySet) {
mySet += myCash; setMySet(myCash);
myCash = 0;
myAction = PLAYER_ACTION_ALLIN; myAction = PLAYER_ACTION_ALLIN;
} }
// sonst // sonst
else { else {
myCash = myCash - highestSet + mySet; setMySet(highestSet-mySet);
mySet = highestSet;
} }
} }
break; break;
@@ -3250,16 +3248,14 @@ void LocalPlayer::evaluation(int bet, int raise)
currentHand->getCurrentBeRo()->setFullBetRule(true); currentHand->getCurrentBeRo()->setFullBetRule(true);
} }
currentHand->getCurrentBeRo()->setMinimumRaise(myCash); currentHand->getCurrentBeRo()->setMinimumRaise(myCash);
mySet = myCash; setMySet(myCash);
myCash = 0;
myAction = PLAYER_ACTION_ALLIN; myAction = PLAYER_ACTION_ALLIN;
highestSet = mySet; highestSet = mySet;
} }
// sonst // sonst
else { else {
currentHand->getCurrentBeRo()->setMinimumRaise(bet); currentHand->getCurrentBeRo()->setMinimumRaise(bet);
myCash = myCash - bet; setMySet(bet);
mySet = bet;
highestSet = mySet; highestSet = mySet;
} }
@@ -3272,14 +3268,12 @@ void LocalPlayer::evaluation(int bet, int raise)
if(currentHand->getCurrentBeRo()->getFullBetRule()) { // full bet rule -> only call possible if(currentHand->getCurrentBeRo()->getFullBetRule()) { // full bet rule -> only call possible
// all in // all in
if(highestSet >= myCash + mySet) { if(highestSet >= myCash + mySet) {
mySet += myCash; setMySet(myCash);
myCash = 0;
myAction = PLAYER_ACTION_ALLIN; myAction = PLAYER_ACTION_ALLIN;
} }
// sonst // sonst
else { else {
myCash = myCash - highestSet + mySet; setMySet(highestSet-mySet);
mySet = highestSet;
myAction = PLAYER_ACTION_CALL; myAction = PLAYER_ACTION_CALL;
} }
} else { } else {
@@ -3292,8 +3286,7 @@ void LocalPlayer::evaluation(int bet, int raise)
// perhaps full bet rule // perhaps full bet rule
if(highestSet >= myCash + mySet) { if(highestSet >= myCash + mySet) {
// only call all-in // only call all-in
mySet += myCash; setMySet(myCash);
myCash = 0;
myAction = PLAYER_ACTION_ALLIN; myAction = PLAYER_ACTION_ALLIN;
} else { } else {
// raise, but not enough --> full bet rule // raise, but not enough --> full bet rule
@@ -3301,9 +3294,8 @@ void LocalPlayer::evaluation(int bet, int raise)
// lastPlayerAction für Karten umblättern reihenfolge setzrn // lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->setLastActionPlayerID(myUniqueID); currentHand->setLastActionPlayerID(myUniqueID);
mySet += myCash; setMySet(myCash);
currentHand->getCurrentBeRo()->setMinimumRaise(mySet-highestSet); currentHand->getCurrentBeRo()->setMinimumRaise(mySet-highestSet);
myCash = 0;
myAction = PLAYER_ACTION_ALLIN; myAction = PLAYER_ACTION_ALLIN;
highestSet = mySet; highestSet = mySet;
} }
@@ -3311,9 +3303,8 @@ void LocalPlayer::evaluation(int bet, int raise)
// lastPlayerAction für Karten umblättern reihenfolge setzrn // lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->setLastActionPlayerID(myUniqueID); currentHand->setLastActionPlayerID(myUniqueID);
mySet += myCash; setMySet(myCash);
currentHand->getCurrentBeRo()->setMinimumRaise(mySet-highestSet); currentHand->getCurrentBeRo()->setMinimumRaise(mySet-highestSet);
myCash = 0;
myAction = PLAYER_ACTION_ALLIN; myAction = PLAYER_ACTION_ALLIN;
highestSet = mySet; highestSet = mySet;
} }
@@ -3321,8 +3312,7 @@ void LocalPlayer::evaluation(int bet, int raise)
// sonst // sonst
else { else {
currentHand->getCurrentBeRo()->setMinimumRaise(raise); currentHand->getCurrentBeRo()->setMinimumRaise(raise);
myCash = myCash + mySet - highestSet - raise; setMySet(highestSet+raise-mySet);
mySet = highestSet + raise;
highestSet = mySet; highestSet = mySet;
// lastPlayerAction für Karten umblättern reihenfolge setzrn // lastPlayerAction für Karten umblättern reihenfolge setzrn
currentHand->setLastActionPlayerID(myUniqueID); currentHand->setLastActionPlayerID(myUniqueID);
+3 -3
View File
@@ -113,10 +113,10 @@ public:
return myLastRelativeSet; return myLastRelativeSet;
} }
void setMyAction(PlayerAction theValue, bool blind = 0) { void setMyAction(PlayerAction theValue, bool human = 0) {
myAction = theValue; myAction = theValue;
// logging for human player // logging for seat 0
if(myAction && !blind) currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, mySet); if(myAction && human) currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, myLastRelativeSet);
} }
PlayerAction getMyAction() const { PlayerAction getMyAction() const {
return myAction; return myAction;
+1 -1
View File
@@ -195,7 +195,7 @@ ClientPlayer::getMyLastRelativeSet() const
} }
void void
ClientPlayer::setMyAction(PlayerAction theValue, bool /*blind*/) ClientPlayer::setMyAction(PlayerAction theValue, bool /*human*/)
{ {
boost::recursive_mutex::scoped_lock lock(m_syncMutex); boost::recursive_mutex::scoped_lock lock(m_syncMutex);
myAction = theValue; myAction = theValue;
+1 -1
View File
@@ -64,7 +64,7 @@ public:
int getMySet() const; int getMySet() const;
int getMyLastRelativeSet() const; int getMyLastRelativeSet() const;
void setMyAction(PlayerAction theValue, bool blind); void setMyAction(PlayerAction theValue, bool human);
PlayerAction getMyAction() const; PlayerAction getMyAction() const;
void setMyButton(int theValue); void setMyButton(int theValue);
+2 -2
View File
@@ -62,8 +62,8 @@ public:
virtual int getMySet() const =0; virtual int getMySet() const =0;
virtual int getMyLastRelativeSet() const =0; virtual int getMyLastRelativeSet() const =0;
virtual void setMyAction(PlayerAction theValue, bool blind=0) =0; virtual void setMyAction(PlayerAction theValue, bool human=0) =0;
virtual PlayerAction getMyAction() const =0; virtual PlayerAction getMyAction() const =0;
virtual void setMyButton(int theValue) =0; virtual void setMyButton(int theValue) =0;
virtual int getMyButton() const =0; virtual int getMyButton() const =0;
+8 -8
View File
@@ -1990,7 +1990,7 @@ void gameTableImpl::myFold()
boost::shared_ptr<HandInterface> currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); boost::shared_ptr<HandInterface> currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
boost::shared_ptr<PlayerInterface> humanPlayer = currentHand->getSeatsList()->front(); boost::shared_ptr<PlayerInterface> humanPlayer = currentHand->getSeatsList()->front();
humanPlayer->setMyAction(PLAYER_ACTION_FOLD); humanPlayer->setMyAction(PLAYER_ACTION_FOLD,true);
humanPlayer->setMyTurn(0); humanPlayer->setMyTurn(0);
//set that i was the last active player. need this for unhighlighting groupbox //set that i was the last active player. need this for unhighlighting groupbox
@@ -2009,7 +2009,7 @@ void gameTableImpl::myCheck()
boost::shared_ptr<HandInterface> currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); boost::shared_ptr<HandInterface> currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
boost::shared_ptr<PlayerInterface> humanPlayer = currentHand->getSeatsList()->front(); boost::shared_ptr<PlayerInterface> humanPlayer = currentHand->getSeatsList()->front();
humanPlayer->setMyTurn(0); humanPlayer->setMyTurn(0);
humanPlayer->setMyAction(PLAYER_ACTION_CHECK); humanPlayer->setMyAction(PLAYER_ACTION_CHECK,true);
//set that i was the last active player. need this for unhighlighting groupbox //set that i was the last active player. need this for unhighlighting groupbox
currentHand->setPreviousPlayerID(0); currentHand->setPreviousPlayerID(0);
@@ -2072,10 +2072,10 @@ void gameTableImpl::myCall()
humanPlayer->setMySet(humanPlayer->getMyCash()); humanPlayer->setMySet(humanPlayer->getMyCash());
humanPlayer->setMyCash(0); humanPlayer->setMyCash(0);
humanPlayer->setMyAction(PLAYER_ACTION_ALLIN); humanPlayer->setMyAction(PLAYER_ACTION_ALLIN,true);
} else { } else {
humanPlayer->setMySet(tempHighestSet - humanPlayer->getMySet()); humanPlayer->setMySet(tempHighestSet - humanPlayer->getMySet());
humanPlayer->setMyAction(PLAYER_ACTION_CALL); humanPlayer->setMyAction(PLAYER_ACTION_CALL,true);
} }
humanPlayer->setMyTurn(0); humanPlayer->setMyTurn(0);
@@ -2108,7 +2108,7 @@ void gameTableImpl::mySet()
humanPlayer->setMySet(humanPlayer->getMyCash()); humanPlayer->setMySet(humanPlayer->getMyCash());
humanPlayer->setMyCash(0); humanPlayer->setMyCash(0);
humanPlayer->setMyAction(PLAYER_ACTION_ALLIN); humanPlayer->setMyAction(PLAYER_ACTION_ALLIN,true);
// full bet rule // full bet rule
if(currentHand->getCurrentBeRo()->getHighestSet() + currentHand->getCurrentBeRo()->getMinimumRaise() > humanPlayer->getMySet()) { if(currentHand->getCurrentBeRo()->getHighestSet() + currentHand->getCurrentBeRo()->getMinimumRaise() > humanPlayer->getMySet()) {
@@ -2119,7 +2119,7 @@ void gameTableImpl::mySet()
if(myActionIsRaise) { if(myActionIsRaise) {
//do not if allIn //do not if allIn
if(humanPlayer->getMyAction() != 6) { if(humanPlayer->getMyAction() != 6) {
humanPlayer->setMyAction(PLAYER_ACTION_RAISE); humanPlayer->setMyAction(PLAYER_ACTION_RAISE,true);
} }
myActionIsRaise = 0; myActionIsRaise = 0;
@@ -2129,7 +2129,7 @@ void gameTableImpl::mySet()
if(myActionIsBet) { if(myActionIsBet) {
//do not if allIn //do not if allIn
if(humanPlayer->getMyAction() != 6) { if(humanPlayer->getMyAction() != 6) {
humanPlayer->setMyAction(PLAYER_ACTION_BET); humanPlayer->setMyAction(PLAYER_ACTION_BET,true);
} }
myActionIsBet = 0; myActionIsBet = 0;
@@ -2166,7 +2166,7 @@ void gameTableImpl::myAllIn()
humanPlayer->setMySet(humanPlayer->getMyCash()); humanPlayer->setMySet(humanPlayer->getMyCash());
humanPlayer->setMyCash(0); humanPlayer->setMyCash(0);
humanPlayer->setMyAction(PLAYER_ACTION_ALLIN); humanPlayer->setMyAction(PLAYER_ACTION_ALLIN,true);
// full bet rule // full bet rule
if(currentHand->getCurrentBeRo()->getHighestSet() + currentHand->getCurrentBeRo()->getMinimumRaise() > humanPlayer->getMySet()) { if(currentHand->getCurrentBeRo()->getHighestSet() + currentHand->getCurrentBeRo()->getMinimumRaise() > humanPlayer->getMySet()) {
+1 -1
View File
@@ -21,9 +21,9 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <sqlite3.h>
#include "configfile.h" #include "configfile.h"
#include <sqlite3.h>
#include <QtCore> #include <QtCore>
#include <QtGui> #include <QtGui>