myW removed from engine classes

This commit is contained in:
doitux
2007-01-13 14:27:56 +00:00
parent d17b23737a
commit 1afc0c12c1
20 changed files with 226 additions and 159 deletions
+12 -11
View File
@@ -20,23 +20,24 @@
#ifndef BOARDINTERFACE_H
#define BOARDINTERFACE_H
class BoardInterface{
class BoardInterface {
public:
virtual ~BoardInterface();
// virtual void setPlayer(LocalPlayer**);
// virtual void setHand(LocalHand*);
//
// void setMyCards(int* theValue) { int i; for(i=0; i<5; i++) myCards[i] = theValue[i]; }
// void getMyCards(int* theValue) { int i; for(i=0; i<5; i++) theValue[i] = myCards[i]; }
// virtual void setPlayer(LocalPlayer**) =0;
// virtual void setHand(LocalHand*) =0;
//
// int getPot() const { return pot;}
// void setPot(int theValue) { pot = theValue;}
// int getSets() const { return sets; }
// virtual void setMyCards(int* theValue) =0;
// virtual void getMyCards(int* theValue) =0;
//
// void collectSets();
// void collectPot();
// virtual int getPot() const=0;
// virtual void setPot(int theValue) =0;
// virtual int getSets() const=0;
//
// virtual void collectSets() const=0;
// virtual void collectPot() const=0;
};
+11 -15
View File
@@ -25,18 +25,18 @@
using namespace std;
Game::Game(mainWindowImpl *w, GuiInterface* g, int qP, int sC, int sB) : myW(w), myGui(g), actualHand(0), actualBoard(0), startQuantityPlayers(qP), startCash(sC), startSmallBlind(sB), actualQuantityPlayers(qP), actualSmallBlind(sB), actualHandID(0), dealerPosition(0)
Game::Game(GuiInterface* g, int qP, int sC, int sB) : myGui(g), actualHand(0), actualBoard(0), startQuantityPlayers(qP), startCash(sC), startSmallBlind(sB), actualQuantityPlayers(qP), actualSmallBlind(sB), actualHandID(0), dealerPosition(0)
{
int i;
for(i=0; i<myW->getMaxQuantityPlayers(); i++) {
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
playerArray[i] = 0;
}
// myEngine = new EngineWrapper();
myW->setGame(this);
myGui->setGame(this);
// myGui->setGameEngine(myEngine);
@@ -49,7 +49,7 @@ Game::Game(mainWindowImpl *w, GuiInterface* g, int qP, int sC, int sB) : myW(w),
// Player erstellen
LocalPlayer *tempPlayer;
for(i=0; i<myW->getMaxQuantityPlayers(); i++) {
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
tempPlayer = new LocalPlayer(actualBoard, i, startCash, startQuantityPlayers > i, 0);
playerArray[i] = tempPlayer;
}
@@ -75,7 +75,7 @@ Game::~Game()
actualHand = 0;
LocalPlayer *tempPlayer;
for(i=0; i<myW->getMaxQuantityPlayers(); i++) {
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
tempPlayer = playerArray[i];
playerArray[i] = 0;
delete tempPlayer;
@@ -99,31 +99,27 @@ void Game::startHand()
if(actualHandID%9 == 0) actualSmallBlind *= 2;
//Spieler Action auf 0 setzen
for(i=0; i<myW->getMaxQuantityPlayers(); i++) {
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
playerArray[i]->setMyAction(0);
}
// Spieler mit leerem Cash auf inactive setzen
for(i=0; i<myW->getMaxQuantityPlayers(); i++) {
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
if(playerArray[i]->getMyCash() == 0) playerArray[i]->setMyActiveStatus(0);
}
//Spiel-Men disablen
// myW->actionNewGame->setDisabled(TRUE);
// Hand erstellen
actualHand = new LocalHand(myW, myGui, actualBoard, playerArray, actualHandID, actualQuantityPlayers, dealerPosition, actualSmallBlind, startCash);
actualHand = new LocalHand(myGui, actualBoard, playerArray, actualHandID, actualQuantityPlayers, dealerPosition, actualSmallBlind, startCash);
//GUI bereinigen
myW->nextRoundCleanGui();
myGui->nextRoundCleanGui();
//Spielernamen schreiben
myW->refreshPlayerName();
myGui->refreshPlayerName();
// Dealer-Button weiterschieben --> Achtung inactive
do {
dealerPosition = (dealerPosition+1)%(myW->getMaxQuantityPlayers());
dealerPosition = (dealerPosition+1)%(myGui->getMaxQuantityPlayers());
} while(!(playerArray[dealerPosition]->getMyActiveStatus()));
+1 -3
View File
@@ -24,7 +24,6 @@
class LocalHand;
class LocalBoard;
class mainWindowImpl;
class GuiInterface;
class LocalPlayer;
@@ -32,7 +31,7 @@ class LocalPlayer;
class Game {
public:
Game(mainWindowImpl*, GuiInterface*, int, int, int);
Game(GuiInterface*, int, int, int);
~Game();
@@ -66,7 +65,6 @@ public:
private:
mainWindowImpl *myW;
GuiInterface *myGui;
LocalHand *actualHand;
LocalBoard *actualBoard;
+53 -3
View File
@@ -23,21 +23,46 @@
// #include <iostream>
#include <string>
#include "session.h"
#include "game.h"
//wird nach Einbau der EngineInterfaces zu handinterface.h
#include "localhand.h"
class GuiInterface{
public:
virtual ~GuiInterface();
virtual void showPlayerActionLogMsg(std::string playName, int &action, int &setValue) const=0;
//wird nach Einbau der EngineInterfaces umbenannt in setGameInterface und cp.
virtual void setGame(Game*) =0;
virtual void setHand(LocalHand*) =0;
virtual void setSession(Session*) =0;
//
virtual int getMaxQuantityPlayers() const=0;
//refresh-Funktionen
virtual void refreshSet() const=0;
virtual void refreshChangePlayer() const=0;
virtual void refreshPot() const=0;
virtual void refreshGroupbox() const=0;
virtual void refreshAll() const=0;
virtual void refreshPlayerName() const=0;
// virtual void refreshButton() const=0;
// virtual void refreshAction() const=0;
// virtual void refreshCash() const=0;
// // Karten-Funktionen
virtual void dealHoleCards() const=0;
virtual void dealFlopCards() const=0;
virtual void dealTurnCard() const=0;
virtual void dealRiverCard() const=0;
virtual void highlightRoundLabel(std::string) const=0;
virtual void nextPlayerAnimation() const=0;
virtual void preflopAnimation1() const=0;
@@ -53,8 +78,33 @@ public:
virtual void riverAnimation2() const=0;
virtual void postRiverAnimation1() const=0;
virtual void postRiverRunAnimation1() const=0;
// virtual void postRiverAnimation2() const=0;
// virtual void handSwitchRounds() const=0;
//
// virtual void startNewHand() const=0;
virtual void nextRoundCleanGui() const=0;
//
// virtual void userWidgetsBackgroudColor() const=0;
// virtual void timerBlockerFalse() const=0;
virtual void meInAction() const=0;
//log.cpp
virtual void showPlayerActionLogMsg(std::string playName, int action, int setValue) const=0;
};
+22 -3
View File
@@ -44,18 +44,27 @@ GuiWrapper::~GuiWrapper()
{
}
void GuiWrapper::setGame(Game *g) { myW->setGame(g); }
void GuiWrapper::setHand(LocalHand *lh) { myW->setHand(lh); }
void GuiWrapper::setSession(Session *s) { myW->setSession(s); }
void GuiWrapper::showPlayerActionLogMsg(string playerName, int &action, int &setValue) const { myLog->showPlayerActionLogMsg(playerName, action, setValue);
}
int GuiWrapper::getMaxQuantityPlayers() const { return myW->getMaxQuantityPlayers(); }
void GuiWrapper::refreshSet() const { myW->refreshSet(); }
void GuiWrapper::refreshChangePlayer() const { myW->refreshChangePlayer(); }
void GuiWrapper::refreshAll() const { myW->refreshAll(); }
void GuiWrapper::refreshPot() const { myW->refreshPot(); }
void GuiWrapper::refreshGroupbox() const { myW->refreshGroupbox(); }
void GuiWrapper::refreshPlayerName() const { myW->refreshPlayerName(); }
void GuiWrapper::dealHoleCards() const { myW->dealHoleCards(); }
void GuiWrapper::dealFlopCards() const { myW->dealFlopCards0(); }
void GuiWrapper::dealTurnCard() const { myW->dealTurnCards0(); }
void GuiWrapper::dealRiverCard() const { myW->dealRiverCards0(); }
void GuiWrapper::highlightRoundLabel(string round) const { myW->highlightRoundLabel(round); }
void GuiWrapper::nextPlayerAnimation() const { myW->nextPlayerAnimation(); }
void GuiWrapper::preflopAnimation1() const { myW->preflopAnimation1(); }
@@ -71,3 +80,13 @@ void GuiWrapper::riverAnimation1() const { myW->riverAnimation1(); }
void GuiWrapper::riverAnimation2() const { myW->riverAnimation2(); }
void GuiWrapper::postRiverAnimation1() const { myW->postRiverAnimation1(); }
void GuiWrapper::postRiverRunAnimation1() const { myW->postRiverRunAnimation1(); }
void GuiWrapper::nextRoundCleanGui() const { myW->nextRoundCleanGui(); }
void GuiWrapper::meInAction() const { myW->meInAction(); }
void GuiWrapper::showPlayerActionLogMsg(string playerName, int action, int setValue) const { myLog->showPlayerActionLogMsg(playerName, action, setValue); }
+36 -18
View File
@@ -21,6 +21,8 @@
#define GUIWRAPPER_H
#include <guiinterface.h>
#include <string>
#include <iostream>
class mainWindowImpl;
class Log;
@@ -34,32 +36,48 @@ public:
~GuiWrapper();
void setGame(Game*);
void setHand(LocalHand*);
void setSession(Session*);
int getMaxQuantityPlayers() const;
void refreshSet() const;
void refreshChangePlayer() const;
void refreshPot() const;
void refreshGroupbox() const;
void refreshAll() const;
void refreshPlayerName() const;
void dealHoleCards() const;
void dealFlopCards() const;
void dealTurnCard() const;
void dealRiverCard() const;
virtual void showPlayerActionLogMsg(std::string playerName, int &action, int &setValue) const;
virtual void refreshSet() const;
virtual void refreshChangePlayer() const;
void highlightRoundLabel(std::string round) const;
virtual void dealFlopCards() const;
virtual void dealTurnCard() const;
virtual void dealRiverCard() const;
void nextPlayerAnimation() const;
virtual void nextPlayerAnimation() const;
virtual void preflopAnimation1() const;
virtual void preflopAnimation2() const;
void preflopAnimation1() const;
void preflopAnimation2() const;
virtual void flopAnimation1() const;
virtual void flopAnimation2() const;
void flopAnimation1() const;
void flopAnimation2() const;
virtual void turnAnimation1() const;
virtual void turnAnimation2() const;
void turnAnimation1() const;
void turnAnimation2() const;
virtual void riverAnimation1() const;
virtual void riverAnimation2() const;
void riverAnimation1() const;
void riverAnimation2() const;
virtual void postRiverAnimation1() const;
// virtual void postRiverAnimation2() const;
void postRiverAnimation1() const;
void postRiverRunAnimation1() const;
void nextRoundCleanGui() const;
void meInAction() const;
void showPlayerActionLogMsg(std::string playerName, int action, int setValue) const;
private:
-8
View File
@@ -62,11 +62,3 @@ void Log::showPlayerActionLogMsg(string playerName, int &action, int &setValue)
// void Log::msgPlayerAction(QString playerName, int action , int setValue) {
//
//
//
// // actualHand->getMainWindowImpl()->textBrowser_Log->append(msg);
//
// }
+3 -1
View File
@@ -343,7 +343,9 @@ void mainWindowImpl::refreshGroupbox() {
}
void mainWindowImpl::highlightRoundLabel(QString round) {
void mainWindowImpl::highlightRoundLabel(string tempround) {
QString round (QString::fromStdString(tempround));
// für PostRiverRun (alte Runden stehen lassen)
if(round != "") {
+5 -10
View File
@@ -22,23 +22,18 @@
#include "ui_mainwindow.h"
#include <iostream>
#include <string>
#include <QtGui>
#include <QtCore>
/*#include "newgamedialogimpl.h"
#include "aboutpokerthimpl.h"
#include "game.h"
#include "localhand.h"
#include "session.h"*/
//#include "player.h"
//#include "board.h"
class Game;
class LocalHand;
class Session;
class LocalHand;
class QColor;
class mainWindowImpl: public QMainWindow, public Ui::mainWindow {
Q_OBJECT
public:
@@ -74,7 +69,7 @@ public:
void meInAction();
void disableMyButtons();
void highlightRoundLabel(QString);
void highlightRoundLabel(std::string);
public slots:
+2 -2
View File
@@ -40,7 +40,7 @@ void LocalBoard::collectSets() {
sets = 0;
int i;
for(i=0; i<actualHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) sets += playerArray[i]->getMySet();
for(i=0; i<actualHand->getGuiInterface()->getMaxQuantityPlayers(); i++) sets += playerArray[i]->getMySet();
}
@@ -48,7 +48,7 @@ void LocalBoard::collectPot() {
int i;
pot += sets;
sets = 0;
for(i=0; i<actualHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++){ playerArray[i]->setMySetNull(); }
for(i=0; i<actualHand->getGuiInterface()->getMaxQuantityPlayers(); i++){ playerArray[i]->setMySetNull(); }
}
+9 -9
View File
@@ -28,7 +28,7 @@ LocalFlop::LocalFlop(LocalHand* bR, int id, int qP, int dP, int sB) : myHand(bR)
int i;
//SmallBlind-Position ermitteln
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
}
@@ -54,7 +54,7 @@ void LocalFlop::flopRun() {
bool allHighestSet = 1;
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
}
@@ -70,14 +70,14 @@ void LocalFlop::flopRun() {
myHand->setActualRound(2);
//Action lchen und ActionButtons refresh
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if(myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0);
}
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
myHand->getBoard()->collectSets();
myHand->getBoard()->collectPot();
myHand->getMainWindowImpl()->refreshPot();
myHand->getMainWindowImpl()->refreshAll();
myHand->getGuiInterface()->refreshPot();
myHand->getGuiInterface()->refreshAll();
myHand->switchRounds();
@@ -86,16 +86,16 @@ void LocalFlop::flopRun() {
// Flop ist wirklich dran
// nhsten Spieler ermitteln
do { playersTurn = (playersTurn+1)%(myHand->getMainWindowImpl()->getMaxQuantityPlayers());
do { playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers());
} while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6);
//Spieler-Position vor SmallBlind-Position ermitteln
int activePlayerBeforeSmallBlind = smallBlindPosition;
do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + myHand->getMainWindowImpl()->getMaxQuantityPlayers() - 1 ) % (myHand->getMainWindowImpl()->getMaxQuantityPlayers());
do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + myHand->getGuiInterface()->getMaxQuantityPlayers() - 1 ) % (myHand->getGuiInterface()->getMaxQuantityPlayers());
} while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6);
myHand->getPlayerArray()[playersTurn]->setMyTurn(TRUE);
myHand->getMainWindowImpl()->refreshGroupbox();
myHand->getGuiInterface()->refreshGroupbox();
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
// cout << "playersTurn " << playersTurn << endl;
@@ -106,7 +106,7 @@ void LocalFlop::flopRun() {
// Wir sind dran
// cout << "actualRound " << myHand->getActualRound() << endl;
// cout << "highestSet vor meInAction " << highestSet << endl;
myHand->getMainWindowImpl()->meInAction();
myHand->getGuiInterface()->meInAction();
}
else {
//Gegner sind dran
+20 -20
View File
@@ -21,12 +21,12 @@
using namespace std;
LocalHand::LocalHand(mainWindowImpl *w, GuiInterface *g, LocalBoard *b, LocalPlayer **p, int id, int qP, int dP, int sB,int sC) : myW(w), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(FALSE)
LocalHand::LocalHand(GuiInterface *g, LocalBoard *b, LocalPlayer **p, int id, int qP, int dP, int sB,int sC) : myW(w), myGui(g), myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(qP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(FALSE)
{
int i, j;
CardsValue myCardsValue;
myW->setHand(this);
myGui->setHand(this);
myBoard->setHand(this);
// myEngine->setHand(this);
@@ -43,7 +43,7 @@ LocalHand::LocalHand(mainWindowImpl *w, GuiInterface *g, LocalBoard *b, LocalPla
// Dealer, SB, BB bestimmen
assignButtons();
myW->refreshAll();
myGui->refreshAll();
// Karten generieren und Board sowie Player zuweisen
Tools myTool;
@@ -67,7 +67,7 @@ LocalHand::LocalHand(mainWindowImpl *w, GuiInterface *g, LocalBoard *b, LocalPla
}
// Karten austeilen
myW->dealHoleCards();
myGui->dealHoleCards();
@@ -103,7 +103,7 @@ void LocalHand::assignButtons() {
int i;
// alle Buttons loeschen
for (i=0; i<myW->getMaxQuantityPlayers(); i++) { playerArray[i]->setMyButton(0); }
for (i=0; i<myGui->getMaxQuantityPlayers(); i++) { playerArray[i]->setMyButton(0); }
// DealerButton zuweisen
playerArray[dealerPosition]->setMyButton(1);
@@ -111,7 +111,7 @@ void LocalHand::assignButtons() {
// Small Blind zuweisen und setzen
i = dealerPosition;
do {
i = (i+1)%(myW->getMaxQuantityPlayers());
i = (i+1)%(myGui->getMaxQuantityPlayers());
if(playerArray[i]->getMyActiveStatus()) {
playerArray[i]->setMyButton(2);
// mit SmallBlind All In ?
@@ -131,7 +131,7 @@ void LocalHand::assignButtons() {
// Big Blind zuweisen
do {
i = (i+1)%(myW->getMaxQuantityPlayers());
i = (i+1)%(myGui->getMaxQuantityPlayers());
if(playerArray[i]->getMyActiveStatus()) {
playerArray[i]->setMyButton(3);
// mit BigBlind All In ?
@@ -159,19 +159,19 @@ void LocalHand::switchRounds() {
//Aktive Spieler zlen --> wenn nur noch einer nicht-folded dann gleich den Pot verteilen
int activePlayersCounter = 0;
for (i=0; i<myW->getMaxQuantityPlayers(); i++) {
for (i=0; i<myGui->getMaxQuantityPlayers(); i++) {
if (playerArray[i]->getMyAction() != 1 && playerArray[i]->getMyActiveStatus() == 1) activePlayersCounter++;
}
// Anzahl der Spieler ermitteln, welche All In sind
int allInPlayersCounter = 0;
for (i=0; i<myW->getMaxQuantityPlayers(); i++) {
for (i=0; i<myGui->getMaxQuantityPlayers(); i++) {
if (playerArray[i]->getMyAction() == 6) allInPlayersCounter++;
}
if(activePlayersCounter==1) {
myBoard->collectPot();
myW->refreshPot();
myGui->refreshPot();
myGui->refreshSet();
actualRound = 4;
}
@@ -188,7 +188,7 @@ void LocalHand::switchRounds() {
int tempHighestSet;
if(allInPlayersCounter+1 == activePlayersCounter) {
// Spieler ermitteln, der noch nicht All In ist
for (i=0; i<myW->getMaxQuantityPlayers(); i++) {
for (i=0; i<myGui->getMaxQuantityPlayers(); i++) {
if(playerArray[i]->getMyAction() != 1 && playerArray[i]->getMyAction() != 6 && playerArray[i]->getMyActiveStatus() == 1) {
tempHighestSet = 0;
switch (actualRound) {
@@ -213,13 +213,13 @@ void LocalHand::switchRounds() {
// beim Vorliegen einer All In Kondition -> Ausfhrung einer Sonderprozedur
if(allInCondition) {
myBoard->collectPot();
myW->refreshPot();
myW->refreshSet();
myGui->refreshPot();
myGui->refreshSet();
actualRound++;
}
myW->refreshGroupbox();
myGui->refreshGroupbox();
highlightRoundLabel();
// /*/*/*/*cout <<*/*/*/*/ "NextPlayerSpeed1 stop" << endl;
//
@@ -259,22 +259,22 @@ void LocalHand::switchRounds() {
void LocalHand::highlightRoundLabel() {
switch(actualRound) {
case 0: {
myW->highlightRoundLabel("Preflop");
myGui->highlightRoundLabel("Preflop");
} break;
case 1: {
myW->highlightRoundLabel("Flop");
myGui->highlightRoundLabel("Flop");
} break;
case 2: {
myW->highlightRoundLabel("Turn");
myGui->highlightRoundLabel("Turn");
} break;
case 3: {
myW->highlightRoundLabel("River");
myGui->highlightRoundLabel("River");
} break;
case 4: {
myW->highlightRoundLabel("");
myGui->highlightRoundLabel("");
} break;
default: {
myW->highlightRoundLabel("!!! FEHLER !!!");
myGui->highlightRoundLabel("!!! FEHLER !!!");
}
}
}
+4 -5
View File
@@ -20,7 +20,7 @@
#ifndef LOCALHAND_H
#define LOCALHAND_H
#include "mainwindowimpl.h"
#include "guiinterface.h"
#include "localboard.h"
#include "localplayer.h"
@@ -30,7 +30,7 @@
#include "localturn.h"
#include "localriver.h"
class mainWindowImpl;
class GuiInterface;
class LocalBoard;
class LocalPlayer;
@@ -43,7 +43,7 @@ class LocalRiver;
class LocalHand {
public:
LocalHand(mainWindowImpl*, GuiInterface*, LocalBoard*, LocalPlayer**, int, int, int, int, int);
LocalHand(GuiInterface*, LocalBoard*, LocalPlayer**, int, int, int, int, int);
~LocalHand();
@@ -53,7 +53,6 @@ public:
LocalFlop* getFlop() const { return myFlop; }
LocalTurn* getTurn() const { return myTurn; }
LocalRiver* getRiver() const { return myRiver; }
mainWindowImpl* getMainWindowImpl() const { return myW; }
GuiInterface* getGuiInterface() const { return myGui; }
void setMyID(const int& theValue) { myID = theValue; }
@@ -82,7 +81,7 @@ public:
private:
mainWindowImpl *myW;
GuiInterface *myGui;
LocalBoard *myBoard;
LocalPlayer **playerArray;
+4 -4
View File
@@ -54,7 +54,7 @@ void LocalPlayer::action() {
preflopEngine();
actualBoard->collectSets();
actualHand->getMainWindowImpl()->refreshPot();
actualHand->getGuiInterface()->refreshPot();
} break;
case 1: {
@@ -62,7 +62,7 @@ void LocalPlayer::action() {
flopEngine();
actualBoard->collectSets();
actualHand->getMainWindowImpl()->refreshPot();
actualHand->getGuiInterface()->refreshPot();
} break;
case 2: {
@@ -70,7 +70,7 @@ void LocalPlayer::action() {
turnEngine();
actualBoard->collectSets();
actualHand->getMainWindowImpl()->refreshPot();
actualHand->getGuiInterface()->refreshPot();
} break;
case 3: {
@@ -78,7 +78,7 @@ void LocalPlayer::action() {
riverEngine();
actualBoard->collectSets();
actualHand->getMainWindowImpl()->refreshPot();
actualHand->getGuiInterface()->refreshPot();
} break;
default: {}
+10 -10
View File
@@ -27,12 +27,12 @@ LocalPreflop::LocalPreflop(LocalHand* bR, int id, int qP, int dP, int sB) : myHa
{
myHand->getBoard()->collectSets();
myHand->getMainWindowImpl()->refreshPot();
myHand->getGuiInterface()->refreshPot();
// // BigBlind ermitteln
bigBlindPosition = dealerPosition;
while (myHand->getPlayerArray()[bigBlindPosition]->getMyButton() != 3) {
bigBlindPosition = (bigBlindPosition+1)%(myHand->getMainWindowImpl()->getMaxQuantityPlayers());
bigBlindPosition = (bigBlindPosition+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers());
}
// // erste Spielernummer fr preflopRun() setzen
@@ -55,7 +55,7 @@ void LocalPreflop::preflopRun() {
bool allHighestSet = 1;
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
}
@@ -64,7 +64,7 @@ void LocalPreflop::preflopRun() {
// BigBlind ermitteln
bigBlindPosition = dealerPosition;
while (myHand->getPlayerArray()[bigBlindPosition]->getMyButton() != 3) {
bigBlindPosition = (bigBlindPosition+1)%(myHand->getMainWindowImpl()->getMaxQuantityPlayers());
bigBlindPosition = (bigBlindPosition+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers());
}
// prfen, ob Preflop wirklich dran ist
@@ -75,14 +75,14 @@ void LocalPreflop::preflopRun() {
myHand->setActualRound(1);
//Action lchen und ActionButtons refresh
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if(myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0);
}
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
myHand->getBoard()->collectSets();
myHand->getBoard()->collectPot();
myHand->getMainWindowImpl()->refreshPot();
myHand->getMainWindowImpl()->refreshAll();
myHand->getGuiInterface()->refreshPot();
myHand->getGuiInterface()->refreshAll();
myHand->switchRounds();
@@ -93,18 +93,18 @@ void LocalPreflop::preflopRun() {
// nhsten Spieler ermitteln
do {
playersTurn = (playersTurn+1)%(myHand->getMainWindowImpl()->getMaxQuantityPlayers());
playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers());
// falls BigBlind, dann PreflopFirstRound zuende
if(myHand->getPlayerArray()[playersTurn]->getMyButton() == 3) preflopFirstRound = FALSE;
} while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || myHand->getPlayerArray()[playersTurn]->getMyAction() == 1 || myHand->getPlayerArray()[playersTurn]->getMyAction() == 6);
myHand->getPlayerArray()[playersTurn]->setMyTurn(TRUE);
myHand->getMainWindowImpl()->refreshGroupbox();
myHand->getGuiInterface()->refreshGroupbox();
if(playersTurn == 0) {
// Wir sind dran
myHand->getMainWindowImpl()->meInAction();
myHand->getGuiInterface()->meInAction();
}
else {
//Gegner sind dran
+20 -20
View File
@@ -28,7 +28,7 @@ LocalRiver::LocalRiver(LocalHand* bR, int id, int qP, int dP, int sB) : myHand(b
{ int i;
//SmallBlind-Position ermitteln
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
}
@@ -53,7 +53,7 @@ void LocalRiver::riverRun() {
bool allHighestSet = 1;
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
// cout << "Spieler " << i << " Set " << myHand->getPlayerArray()[i]->getMySet() << endl;
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
@@ -71,14 +71,14 @@ void LocalRiver::riverRun() {
myHand->setActualRound(4);
//Action lᅵchen und ActionButtons refresh
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if(myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0);
}
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
myHand->getBoard()->collectSets();
myHand->getBoard()->collectPot();
myHand->getMainWindowImpl()->refreshPot();
myHand->getMainWindowImpl()->refreshAll();
myHand->getGuiInterface()->refreshPot();
myHand->getGuiInterface()->refreshAll();
myHand->switchRounds();
@@ -87,16 +87,16 @@ void LocalRiver::riverRun() {
// River ist wirklich dran
// nᅵhsten Spieler ermitteln
do { playersTurn = (playersTurn+1)%(myHand->getMainWindowImpl()->getMaxQuantityPlayers());
do { playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers());
} while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6);
//Spieler-Position vor SmallBlind-Position ermitteln
int activePlayerBeforeSmallBlind = smallBlindPosition;
do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + myHand->getMainWindowImpl()->getMaxQuantityPlayers() - 1 ) % (myHand->getMainWindowImpl()->getMaxQuantityPlayers());
do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + myHand->getGuiInterface()->getMaxQuantityPlayers() - 1 ) % (myHand->getGuiInterface()->getMaxQuantityPlayers());
} while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6);
myHand->getPlayerArray()[playersTurn]->setMyTurn(TRUE);
myHand->getMainWindowImpl()->refreshGroupbox();
myHand->getGuiInterface()->refreshGroupbox();
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
// cout << "playersTurn " << playersTurn << endl;
@@ -107,7 +107,7 @@ void LocalRiver::riverRun() {
// Wir sind dran
// cout << "actualRound " << myHand->getActualRound() << endl;
// cout << "highestSet vor meInAction " << highestSet << endl;
myHand->getMainWindowImpl()->meInAction();
myHand->getGuiInterface()->meInAction();
}
else {
//Gegner sind dran
@@ -131,7 +131,7 @@ void LocalRiver::postRiverRun() {
// cout << myHand->getPlayerArray()[0]->getMyAverageSets() << endl;
//berechnen welcher Spieler gewonnen hat
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
// cout << "Spieler: " << i << " hat: " << myHand->getPlayerArray()[i]->getMyCardsValueInt() << endl;
@@ -147,7 +147,7 @@ void LocalRiver::postRiverRun() {
myHand->getBoard()->setPot(0);
//starte die Animaionsreihe
myHand->getMainWindowImpl()->postRiverRunAnimation1();
myHand->getGuiInterface()->postRiverRunAnimation1();
}
void LocalRiver::nextPlayer2() {
@@ -177,14 +177,14 @@ void LocalRiver::distributePot() {
/////////////////////
// winnersArray erstellen -> hier werden die winner der jeweiligen Potverteilungsrunden eingetragen
int *winnersArray = new int[myHand->getMainWindowImpl()->getMaxQuantityPlayers()];
int *winnersArray = new int[myHand->getGuiInterface()->getMaxQuantityPlayers()];
// Anzahl der winner in einer Potverteilungsrunde
int winnersCounter = 0;
// dieses Array ermittelt wieviel jeder Spieler wᅵrend der gesamten BettingRound gesetzt hat
int roundSetArray[myHand->getMainWindowImpl()->getMaxQuantityPlayers()];
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
int roundSetArray[myHand->getGuiInterface()->getMaxQuantityPlayers()];
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
// Standardwert fr nicht mehr aktive
roundSetArray[i] = 0;
// nur fr die Spieler ermitteln, die noch aktiv sind (inkl. der gefoldeten)
@@ -194,10 +194,10 @@ void LocalRiver::distributePot() {
}
// 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[myHand->getMainWindowImpl()->getMaxQuantityPlayers()];
int cardsValueArray[myHand->getGuiInterface()->getMaxQuantityPlayers()];
int playerWantsPotCounter = 0;
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
// Standardwert
cardsValueArray[i] = 0;
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1) {
@@ -230,7 +230,7 @@ void LocalRiver::distributePot() {
highestCardsValueTemp = 0;
// aktuellen highestCardsValueTemp berechnen, von denen die noch an der Potverteilung teilnehmen
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if(cardsValueArray[i] > highestCardsValueTemp ) {
highestCardsValueTemp = myHand->getPlayerArray()[i]->getMyCardsValueInt();
}
@@ -239,7 +239,7 @@ void LocalRiver::distributePot() {
// 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<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if(cardsValueArray[i] == highestCardsValueTemp ) {
winnersArray[winnersCounter] = i;
winnersCounter++;
@@ -266,7 +266,7 @@ void LocalRiver::distributePot() {
// else {
// alle Spieler nacheinander durchgehen und prfen von wem man wieviel Geld aus dem Pot bekommt
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
// zuerst prfen ob ein gefoldeter Spieler was gesetzt hatte
if(i != winner && myHand->getPlayerArray()[i]->getMyAction() == 1) {
@@ -346,7 +346,7 @@ void LocalRiver::distributePot() {
}
// alle Spieler nacheinander durchgehen und prfen von wem die Winner wieviel Geld aus dem Pot bekommen
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
// prfen ob Spieler i zu den Winnern gehᅵt
playerIsWinner = FALSE;
+9 -9
View File
@@ -27,7 +27,7 @@ LocalTurn::LocalTurn(LocalHand* bR, int id, int qP, int dP, int sB) : myHand(bR)
{ int i;
//SmallBlind-Position ermitteln
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if (myHand->getPlayerArray()[i]->getMyButton() == 2) smallBlindPosition = i;
}
@@ -53,7 +53,7 @@ void LocalTurn::turnRun() {
bool allHighestSet = 1;
// prfe, ob alle Sets gleich sind ( falls nicht, dann allHighestSet = 0 )
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if(myHand->getPlayerArray()[i]->getMyActiveStatus() && myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) {
// cout << "Spieler " << i << " Set " << myHand->getPlayerArray()[i]->getMySet() << endl;
if(highestSet != myHand->getPlayerArray()[i]->getMySet()) { allHighestSet=0; }
@@ -71,14 +71,14 @@ void LocalTurn::turnRun() {
myHand->setActualRound(3);
//Action lchen und ActionButtons refresh
for(i=0; i<myHand->getMainWindowImpl()->getMaxQuantityPlayers(); i++) {
for(i=0; i<myHand->getGuiInterface()->getMaxQuantityPlayers(); i++) {
if(myHand->getPlayerArray()[i]->getMyAction() != 1 && myHand->getPlayerArray()[i]->getMyAction() != 6) myHand->getPlayerArray()[i]->setMyAction(0);
}
//Sets in den Pot verschieben und Sets = 0 und Pot-refresh
myHand->getBoard()->collectSets();
myHand->getBoard()->collectPot();
myHand->getMainWindowImpl()->refreshPot();
myHand->getMainWindowImpl()->refreshAll();
myHand->getGuiInterface()->refreshPot();
myHand->getGuiInterface()->refreshAll();
myHand->switchRounds();
@@ -87,16 +87,16 @@ void LocalTurn::turnRun() {
// Turn ist wirklich dran
// nhsten Spieler ermitteln
do { playersTurn = (playersTurn+1)%(myHand->getMainWindowImpl()->getMaxQuantityPlayers());
do { playersTurn = (playersTurn+1)%(myHand->getGuiInterface()->getMaxQuantityPlayers());
} while(!(myHand->getPlayerArray()[playersTurn]->getMyActiveStatus()) || (myHand->getPlayerArray()[playersTurn]->getMyAction())==1 || (myHand->getPlayerArray()[playersTurn]->getMyAction())==6);
//Spieler-Position vor SmallBlind-Position ermitteln
int activePlayerBeforeSmallBlind = smallBlindPosition;
do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + myHand->getMainWindowImpl()->getMaxQuantityPlayers() - 1 ) % (myHand->getMainWindowImpl()->getMaxQuantityPlayers());
do { activePlayerBeforeSmallBlind = (activePlayerBeforeSmallBlind + myHand->getGuiInterface()->getMaxQuantityPlayers() - 1 ) % (myHand->getGuiInterface()->getMaxQuantityPlayers());
} while(!(myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyActiveStatus()) || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==1 || (myHand->getPlayerArray()[activePlayerBeforeSmallBlind]->getMyAction())==6);
myHand->getPlayerArray()[playersTurn]->setMyTurn(TRUE);
myHand->getMainWindowImpl()->refreshGroupbox();
myHand->getGuiInterface()->refreshGroupbox();
// cout << "activePlayerBeforeSmallBlind " << activePlayerBeforeSmallBlind << endl;
// cout << "playersTurn " << playersTurn << endl;
@@ -107,7 +107,7 @@ void LocalTurn::turnRun() {
// Wir sind dran
// cout << "actualRound " << myHand->getActualRound() << endl;
// cout << "highestSet vor meInAction " << highestSet << endl;
myHand->getMainWindowImpl()->meInAction();
myHand->getGuiInterface()->meInAction();
}
else {
//Gegner sind dran
+1 -1
View File
@@ -45,7 +45,7 @@ int main( int argc, char **argv )
GuiInterface *myGuiInterface = new GuiWrapper(myW);
Session theFirst(myW, myGuiInterface);
Session theFirst(myGuiInterface);
return a.exec();
+3 -4
View File
@@ -18,13 +18,12 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "session.h"
#include "mainwindowimpl.h"
#include "game.h"
#include "guiinterface.h"
using namespace std;
Session::Session(mainWindowImpl* w, GuiInterface* g) : actualGame(0), myW(w), myGui(g)
Session::Session(GuiInterface* g) : actualGame(0), myGui(g)
{
@@ -33,7 +32,7 @@ Session::Session(mainWindowImpl* w, GuiInterface* g) : actualGame(0), myW(w), my
// a.setMainWidget( w );
// myW->show();
// Session an mainwindowimpl bergeben
myW->setSession(this);
myGui->setSession(this);
}
@@ -46,7 +45,7 @@ Session::~Session()
void Session::startGame(int qP, int sC, int sB) {
actualGame = new Game(myW, myGui, qP, sC, sB);
actualGame = new Game(myGui, qP, sC, sB);
}
+1 -3
View File
@@ -23,7 +23,6 @@
#include <fstream>
#include <string>
class mainWindowImpl;
class GuiInterface;
class Game;
@@ -31,7 +30,7 @@ class Game;
class Session{
public:
Session(mainWindowImpl*, GuiInterface*);
Session(GuiInterface*);
~Session();
@@ -40,7 +39,6 @@ public:
private:
Game *actualGame;
mainWindowImpl *myW;
GuiInterface *myGui;
};