From d8e70d997d34b440174532eb75d65f9ed5043820 Mon Sep 17 00:00:00 2001 From: doitux Date: Wed, 15 Oct 2008 19:49:39 +0000 Subject: [PATCH] gui cardchancemonitor --- src/engine/local_engine/tools.cpp | 2 +- src/engine/local_engine/tools.h | 2 +- src/gui/qt/gametable/gametableimpl.cpp | 23 ++++++++++++++++++++--- src/gui/qt/gametable/gametableimpl.h | 2 +- src/gui/qt/gametable/mychancelabel.cpp | 22 +++++++++++----------- 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/engine/local_engine/tools.cpp b/src/engine/local_engine/tools.cpp index 099e06a2..9fcdb52e 100755 --- a/src/engine/local_engine/tools.cpp +++ b/src/engine/local_engine/tools.cpp @@ -91,7 +91,7 @@ void Tools::getRandNumber(int start, int end, int howMany, int* randArray, bool } -int* Tools::calcCardsChance(int* playerCards, int* boardCards, GameState beRoID) +int* Tools::calcCardsChance(GameState beRoID, int* playerCards, int* boardCards) { // int playerCards[2]; diff --git a/src/engine/local_engine/tools.h b/src/engine/local_engine/tools.h index 90ed80b0..c517ed55 100755 --- a/src/engine/local_engine/tools.h +++ b/src/engine/local_engine/tools.h @@ -25,7 +25,7 @@ class Tools{ public: static void getRandNumber(int, int, int, int*, bool); - static int* calcCardsChance(int*,int*,GameState); + static int* calcCardsChance(GameState, int*, int*); }; #endif diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index b01f3713..e62bac56 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -1182,6 +1182,9 @@ void gameTableImpl::dealHoleCards() { //fix press mouse button during bankrupt with anti-peek-mode this->mouseOverFlipCards(FALSE); + + //refresh CardsChanceMonitor Tool + refreshCardsChance(GAME_STATE_PREFLOP); } void gameTableImpl::dealBeRoCards(int myBeRoID) { @@ -1289,6 +1292,9 @@ void gameTableImpl::dealFlopCards6() { updateMyButtonsState(0); //mode 0 == called from dealberocards dealFlopCards6Timer->start(postDealCardsSpeed); } + + //refresh CardsChanceMonitor Tool + refreshCardsChance(GAME_STATE_FLOP); } void gameTableImpl::dealTurnCards0() { dealTurnCards0Timer->start(preDealCardsSpeed); } @@ -1323,8 +1329,9 @@ void gameTableImpl::dealTurnCards2() { else { updateMyButtonsState(0); //mode 0 == called from dealberocards dealTurnCards2Timer->start(postDealCardsSpeed); - } + //refresh CardsChanceMonitor Tool + refreshCardsChance(GAME_STATE_TURN); } void gameTableImpl::dealRiverCards0() { dealRiverCards0Timer->start(preDealCardsSpeed); } @@ -1361,6 +1368,8 @@ void gameTableImpl::dealRiverCards2() { updateMyButtonsState(0); //mode 0 == called from dealberocards dealRiverCards2Timer->start(postDealCardsSpeed); } + //refresh CardsChanceMonitor Tool + refreshCardsChance(GAME_STATE_RIVER); } void gameTableImpl::provideMyActions(int mode) { @@ -3136,8 +3145,16 @@ void gameTableImpl::refreshVotesMonitor() label_votesMonitor->setText(tr("Player %1 has %2 votes against him.").arg(QString::fromUtf8(info.playerName.c_str()))); } -void gameTableImpl::refreshCardsChance() +void gameTableImpl::refreshCardsChance(GameState bero) { - label_chance->refreshChance(Tools::calcCardsChance()); + if(myConfig->readConfigInt("ShowCardsChanceMonitor")) { + int boardCards[5]; + int holeCards[2]; + + (*myStartWindow->getSession()->getCurrentGame()->getSeatsList()->begin())->getMyCards(holeCards); + myStartWindow->getSession()->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(boardCards); + + label_chance->refreshChance(Tools::calcCardsChance(bero, holeCards, boardCards)); + } } diff --git a/src/gui/qt/gametable/gametableimpl.h b/src/gui/qt/gametable/gametableimpl.h index 4cfe0ed2..de18f489 100755 --- a/src/gui/qt/gametable/gametableimpl.h +++ b/src/gui/qt/gametable/gametableimpl.h @@ -230,7 +230,7 @@ public slots: void postRiverRunAnimation5(); void postRiverRunAnimation6(); - void refreshCardsChance(); + void refreshCardsChance(GameState); void blinkingStartButtonAnimationAction(); diff --git a/src/gui/qt/gametable/mychancelabel.cpp b/src/gui/qt/gametable/mychancelabel.cpp index 393d69a3..47d15944 100644 --- a/src/gui/qt/gametable/mychancelabel.cpp +++ b/src/gui/qt/gametable/mychancelabel.cpp @@ -103,20 +103,20 @@ void MyChanceLabel::paintEvent(QPaintEvent * event) { //Draw gfx painter.setPen(QColor(0,0,0)); - QLinearGradient linearGrad(QPointF(80,3), QPointF(180,10)); + QLinearGradient linearGrad(QPointF(80,3), QPointF(190,10)); linearGrad.setColorAt(0, Qt::blue); linearGrad.setColorAt(0.5, Qt::yellow); linearGrad.setColorAt(1, Qt::red); painter.setBrush(linearGrad); - if(RFChance != 0) painter.drawRect(80,3,(107*RFChance)/100,7); - if(SFChance != 0) painter.drawRect(80,16,(107*SFChance)/100,7); - if(FOAKChance != 0) painter.drawRect(80,29,(107*FOAKChance)/100,7); - if(FHChance != 0) painter.drawRect(80,42,(107*FHChance)/100,7); - if(FLChance != 0) painter.drawRect(80,55,(107*FLChance)/100,7); - if(STRChance != 0) painter.drawRect(80,68,(107*STRChance)/100,7); - if(TOAKChance != 0) painter.drawRect(80,81,(107*TOAKChance)/100,7); - if(TPChance != 0) painter.drawRect(80,94,(107*TPChance)/100,7); - if(OPChance != 0) painter.drawRect(80,107,(107*OPChance)/100,7); - if(HCChance != 0) painter.drawRect(80,120,(107*HCChance)/100,7); + if(RFChance != 0) painter.drawRect(80,3,(117*RFChance)/100,7); + if(SFChance != 0) painter.drawRect(80,16,(117*SFChance)/100,7); + if(FOAKChance != 0) painter.drawRect(80,29,(117*FOAKChance)/100,7); + if(FHChance != 0) painter.drawRect(80,42,(117*FHChance)/100,7); + if(FLChance != 0) painter.drawRect(80,55,(117*FLChance)/100,7); + if(STRChance != 0) painter.drawRect(80,68,(117*STRChance)/100,7); + if(TOAKChance != 0) painter.drawRect(80,81,(117*TOAKChance)/100,7); + if(TPChance != 0) painter.drawRect(80,94,(117*TPChance)/100,7); + if(OPChance != 0) painter.drawRect(80,107,(117*OPChance)/100,7); + if(HCChance != 0) painter.drawRect(80,120,(117*HCChance)/100,7); }