This commit is contained in:
@@ -52,8 +52,6 @@ ConfigFile::ConfigFile()
|
|||||||
TiXmlDocument doc(configFileName);
|
TiXmlDocument doc(configFileName);
|
||||||
if(!doc.LoadFile()){ createDefaultConfig(); }
|
if(!doc.LoadFile()){ createDefaultConfig(); }
|
||||||
|
|
||||||
// cout << "readConfigString Value: " << readConfigString("Opponent1Name", "doitux") << "\n";
|
|
||||||
writeConfigString(string("MyName"), string("Ret"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,7 @@ LocalPlayer::LocalPlayer(BoardInterface *b, int id, std::string name, int sC, bo
|
|||||||
// cout << "Spieler: " << myID << " Dude: " << myDude << " Cash: " << myCash << " ActiveStatus: " << myActiveStatus << " Button: " << myButton << endl;
|
// cout << "Spieler: " << myID << " Dude: " << myDude << " Cash: " << myCash << " ActiveStatus: " << myActiveStatus << " Button: " << myButton << endl;
|
||||||
|
|
||||||
myCardsValue = new CardsValue;
|
myCardsValue = new CardsValue;
|
||||||
/*
|
|
||||||
ostringstream temp;
|
|
||||||
temp << "Player " << myID;
|
|
||||||
myName = temp.str();*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-3
@@ -27,10 +27,11 @@
|
|||||||
#include "playerinterface.h"
|
#include "playerinterface.h"
|
||||||
#include "handinterface.h"
|
#include "handinterface.h"
|
||||||
|
|
||||||
|
#include "configfile.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
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)
|
Game::Game(ConfigFile* c, GuiInterface* g, int qP, int sC, int sB) : myConfig(c), myGui(g), actualHand(0), actualBoard(0), startQuantityPlayers(qP), startCash(sC), startSmallBlind(sB), actualQuantityPlayers(qP), actualSmallBlind(sB), actualHandID(0), dealerPosition(0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -56,9 +57,20 @@ Game::Game(GuiInterface* g, int qP, int sC, int sB) : myGui(g), actualHand(0), a
|
|||||||
PlayerInterface *tempPlayer;
|
PlayerInterface *tempPlayer;
|
||||||
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
|
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
|
||||||
|
|
||||||
// cout << myGui->getPlayerName(i) << "\n";
|
//Namen abfragen
|
||||||
|
ostringstream myName;
|
||||||
|
ostringstream myDefaultName;
|
||||||
|
if (i==0) {
|
||||||
|
myName << "MyName";
|
||||||
|
myDefaultName << "Human Player";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
myName << "Opponent" << i << "Name";
|
||||||
|
myDefaultName << "Player " << i << "Name";
|
||||||
|
}
|
||||||
|
|
||||||
tempPlayer = myFactory->createPlayer(actualBoard, i, myGui->getPlayerName(i), startCash, startQuantityPlayers > i, 0);
|
//PlayerObjekte erzeugen
|
||||||
|
tempPlayer = myFactory->createPlayer(actualBoard, i, myConfig->readConfigString(myName.str(),myDefaultName.str()), startCash, startQuantityPlayers > i, 0);
|
||||||
playerArray[i] = tempPlayer;
|
playerArray[i] = tempPlayer;
|
||||||
}
|
}
|
||||||
actualBoard->setPlayer(playerArray);
|
actualBoard->setPlayer(playerArray);
|
||||||
|
|||||||
+7
-1
@@ -21,18 +21,21 @@
|
|||||||
#define GAME_H
|
#define GAME_H
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
class GuiInterface;
|
class GuiInterface;
|
||||||
class HandInterface;
|
class HandInterface;
|
||||||
class PlayerInterface;
|
class PlayerInterface;
|
||||||
class BoardInterface;
|
class BoardInterface;
|
||||||
class EngineFactory;
|
class EngineFactory;
|
||||||
|
class ConfigFile;
|
||||||
|
|
||||||
|
|
||||||
class Game {
|
class Game {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Game(GuiInterface*, int, int, int);
|
Game(ConfigFile*, GuiInterface*, int, int, int);
|
||||||
|
|
||||||
~Game();
|
~Game();
|
||||||
|
|
||||||
@@ -73,11 +76,14 @@ public:
|
|||||||
private:
|
private:
|
||||||
EngineFactory *myFactory;
|
EngineFactory *myFactory;
|
||||||
|
|
||||||
|
ConfigFile *myConfig;
|
||||||
|
|
||||||
GuiInterface *myGui;
|
GuiInterface *myGui;
|
||||||
HandInterface *actualHand;
|
HandInterface *actualHand;
|
||||||
BoardInterface *actualBoard;
|
BoardInterface *actualBoard;
|
||||||
PlayerInterface *playerArray[5];
|
PlayerInterface *playerArray[5];
|
||||||
|
|
||||||
|
|
||||||
//Startvariablen
|
//Startvariablen
|
||||||
int startQuantityPlayers;
|
int startQuantityPlayers;
|
||||||
int startCash;
|
int startCash;
|
||||||
|
|||||||
@@ -40,9 +40,6 @@ public:
|
|||||||
|
|
||||||
//get
|
//get
|
||||||
virtual int getMaxQuantityPlayers() const=0;
|
virtual int getMaxQuantityPlayers() const=0;
|
||||||
virtual std::string getPlayerName(int) const=0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//refresh-Funktionen
|
//refresh-Funktionen
|
||||||
virtual void refreshSet() const=0;
|
virtual void refreshSet() const=0;
|
||||||
|
|||||||
@@ -47,15 +47,6 @@ void GuiWrapper::setHand(HandInterface *lh) { myW->setHand(lh); }
|
|||||||
void GuiWrapper::setSession(Session *s) { myW->setSession(s); }
|
void GuiWrapper::setSession(Session *s) { myW->setSession(s); }
|
||||||
|
|
||||||
int GuiWrapper::getMaxQuantityPlayers() const { return myW->getMaxQuantityPlayers(); }
|
int GuiWrapper::getMaxQuantityPlayers() const { return myW->getMaxQuantityPlayers(); }
|
||||||
std::string GuiWrapper::getPlayerName(int id) const {
|
|
||||||
|
|
||||||
// if(id==0) {
|
|
||||||
// return myConfig->readConfigString("MyName", "Human Player") ;
|
|
||||||
// }
|
|
||||||
// else { return myConfig->readConfigString("Opponent"+QString::number(id)+"Name", "Player "+QString::number(id)) ; }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GuiWrapper::refreshSet() const { myW->refreshSet(); }
|
void GuiWrapper::refreshSet() const { myW->refreshSet(); }
|
||||||
void GuiWrapper::refreshChangePlayer() const { myW->refreshChangePlayer(); }
|
void GuiWrapper::refreshChangePlayer() const { myW->refreshChangePlayer(); }
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ public:
|
|||||||
void setSession(Session*);
|
void setSession(Session*);
|
||||||
|
|
||||||
int getMaxQuantityPlayers() const;
|
int getMaxQuantityPlayers() const;
|
||||||
std::string getPlayerName(int) const;
|
|
||||||
|
|
||||||
void refreshSet() const;
|
void refreshSet() const;
|
||||||
void refreshChangePlayer() const;
|
void refreshChangePlayer() const;
|
||||||
@@ -86,12 +85,10 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
Log *myLog;
|
Log *myLog;
|
||||||
mainWindowImpl *myW;
|
mainWindowImpl *myW;
|
||||||
ConfigFile *myConfig;
|
ConfigFile *myConfig;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent, const char *name)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
//Toolbox verstecken?
|
//Toolbox verstecken?
|
||||||
// if (!myConfig->readConfigInt("ShowToolBox", 1)) { groupBox_tools->hide(); }
|
if (!myConfig->readConfigInt("ShowToolBox", 1)) { groupBox_tools->hide(); }
|
||||||
|
|
||||||
|
|
||||||
pushButton_raise->setDisabled(TRUE);
|
pushButton_raise->setDisabled(TRUE);
|
||||||
@@ -196,7 +196,7 @@ void mainWindowImpl::callNewGameDialog() {
|
|||||||
|
|
||||||
//wenn Dialogfenster gezeigt werden soll
|
//wenn Dialogfenster gezeigt werden soll
|
||||||
|
|
||||||
// if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame", 1)){
|
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame", 1)){
|
||||||
|
|
||||||
newGameDialogImpl *v = new newGameDialogImpl();
|
newGameDialogImpl *v = new newGameDialogImpl();
|
||||||
v->exec();
|
v->exec();
|
||||||
@@ -254,7 +254,7 @@ void mainWindowImpl::callNewGameDialog() {
|
|||||||
label_Pot->setText("<p align='center'><span style='font-size:x-large; font-weight:bold'>Pot Total</span></p>");
|
label_Pot->setText("<p align='center'><span style='font-size:x-large; font-weight:bold'>Pot Total</span></p>");
|
||||||
label_Sets->setText("<p align='center'><span style='font-size:medium; font-weight:bold'>Sets:</span></p>");
|
label_Sets->setText("<p align='center'><span style='font-size:medium; font-weight:bold'>Sets:</span></p>");
|
||||||
|
|
||||||
guiGameSpeed = 4/*myConfig->readConfigInt("GameSpeed",4)*/;
|
guiGameSpeed = myConfig->readConfigInt("GameSpeed",4);
|
||||||
// debugMode = v->checkBox_debugMode->isChecked();
|
// debugMode = v->checkBox_debugMode->isChecked();
|
||||||
|
|
||||||
//Tools und Board aufhellen und enablen
|
//Tools und Board aufhellen und enablen
|
||||||
@@ -271,11 +271,10 @@ void mainWindowImpl::callNewGameDialog() {
|
|||||||
|
|
||||||
|
|
||||||
//Start Game!!!
|
//Start Game!!!
|
||||||
// mySession->startGame(myConfig->readConfigInt("NumberOfPlayers",5), myConfig->readConfigInt("StartCash",2000), myConfig->readConfigInt("SmallBlind",10));
|
mySession->startGame(myConfig->readConfigInt("NumberOfPlayers",5), myConfig->readConfigInt("StartCash",2000), myConfig->readConfigInt("SmallBlind",10));
|
||||||
mySession->startGame(5, 2000, 10);
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,8 +292,8 @@ void mainWindowImpl::callSettingsDialog() {
|
|||||||
if (v->result()) {
|
if (v->result()) {
|
||||||
|
|
||||||
//Toolbox verstecken?
|
//Toolbox verstecken?
|
||||||
// if (!myConfig->readConfigInt("ShowToolBox", 1)) { groupBox_tools->hide(); }
|
if (!myConfig->readConfigInt("ShowToolBox", 1)) { groupBox_tools->hide(); }
|
||||||
// else { groupBox_tools->show(); }
|
else { groupBox_tools->show(); }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,15 +27,13 @@ newGameDialogImpl::newGameDialogImpl(QWidget *parent, const char *name)
|
|||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
//Formulare Füllen
|
//Formulare Füllen
|
||||||
ConfigFile config;
|
ConfigFile myConfig;
|
||||||
|
|
||||||
bool ok=TRUE;
|
|
||||||
|
|
||||||
//Game Settings
|
//Game Settings
|
||||||
// spinBox_quantityPlayers->setValue(config.readConfig("numberofplayers", "5").toInt(&ok,10));
|
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NumberOfPlayers", 5));
|
||||||
// spinBox_startCash->setValue(config.readConfig("startcash", "2000").toInt(&ok,10));
|
spinBox_startCash->setValue(myConfig.readConfigInt("StartCash", 2000));
|
||||||
// spinBox_smallBlind->setValue(config.readConfig("smallblind", "10").toInt(&ok,10));
|
spinBox_smallBlind->setValue(myConfig.readConfigInt("SmallBlind", 10));
|
||||||
// spinBox_gameSpeed->setValue(config.readConfig("gamespeed", "4").toInt(&ok,10));
|
spinBox_gameSpeed->setValue(myConfig.readConfigInt("GameSpeed", 4));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,27 +29,24 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, const char *name)
|
|||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
//Formulare Füllen
|
//Formulare Füllen
|
||||||
ConfigFile config;
|
ConfigFile myConfig;
|
||||||
|
|
||||||
bool ok=TRUE;
|
|
||||||
|
|
||||||
//Player Nicks
|
//Player Nicks
|
||||||
// lineEdit_humanPlayerName->setText(config.readConfig("myname", "Human Player"));
|
lineEdit_humanPlayerName->setText(QString::fromStdString(myConfig.readConfigString("MyName", "Human Player")));
|
||||||
// lineEdit_Opponent1Name->setText(config.readConfig("opponent1name", "Player 1"));
|
lineEdit_Opponent1Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent1Name", "Player 1")));
|
||||||
// lineEdit_Opponent2Name->setText(config.readConfig("opponent2name", "Player 2"));
|
lineEdit_Opponent2Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent2Name", "Player 2")));
|
||||||
// lineEdit_Opponent3Name->setText(config.readConfig("opponent3name", "Player 3"));
|
lineEdit_Opponent3Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent3Name", "Player 3")));
|
||||||
// lineEdit_Opponent4Name->setText(config.readConfig("opponent4name", "Player 4"));
|
lineEdit_Opponent4Name->setText(QString::fromStdString(myConfig.readConfigString("Opponent4Name", "Player 4")));
|
||||||
|
|
||||||
//Game Settings
|
//Game Settings
|
||||||
// spinBox_quantityPlayers->setValue(config.readConfig("numberofplayers", "5").toInt(&ok,10));
|
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NumberOfPlayers", 5));
|
||||||
// spinBox_startCash->setValue(config.readConfig("startcash", "2000").toInt(&ok,10));
|
spinBox_startCash->setValue(myConfig.readConfigInt("StartCash", 2000));
|
||||||
// spinBox_smallBlind->setValue(config.readConfig("smallblind", "10").toInt(&ok,10));
|
spinBox_smallBlind->setValue(myConfig.readConfigInt("SmallBlind", 10));
|
||||||
// spinBox_gameSpeed->setValue(config.readConfig("gamespeed", "4").toInt(&ok,10));
|
spinBox_gameSpeed->setValue(myConfig.readConfigInt("GameSpeed", 4));
|
||||||
// checkBox_showGameSettingsDialogOnNewGame->setChecked(config.readConfig("showgamesettingsdialogonnewgame", "1").toInt(&ok,10));
|
checkBox_showGameSettingsDialogOnNewGame->setChecked(myConfig.readConfigInt("ShowGameSettingsDialogOnNewGame", 1));
|
||||||
|
|
||||||
//Interface
|
//Interface
|
||||||
// checkBox_showToolbox->setChecked(config.readConfig("showtoolbox", "1").toInt(&ok,10));
|
checkBox_showToolbox->setChecked(myConfig.readConfigInt("ShowToolBox", 1));
|
||||||
|
|
||||||
|
|
||||||
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) );
|
connect( buttonBox, SIGNAL( accepted() ), this, SLOT( isAccepted() ) );
|
||||||
|
|
||||||
@@ -59,23 +56,23 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, const char *name)
|
|||||||
void settingsDialogImpl::isAccepted() {
|
void settingsDialogImpl::isAccepted() {
|
||||||
|
|
||||||
//Daten speichern
|
//Daten speichern
|
||||||
ConfigFile config;
|
ConfigFile myConfig;
|
||||||
|
|
||||||
//Player Nicks
|
// Player Nicks
|
||||||
// config.writeConfig("myname", lineEdit_humanPlayerName->text());
|
myConfig.writeConfigString("MyName", lineEdit_humanPlayerName->text().toStdString());
|
||||||
// config.writeConfig("opponent1name", lineEdit_Opponent1Name->text());
|
myConfig.writeConfigString("Opponent1Name", lineEdit_Opponent1Name->text().toStdString());
|
||||||
// config.writeConfig("opponent2name", lineEdit_Opponent2Name->text());
|
myConfig.writeConfigString("Opponent2Name", lineEdit_Opponent2Name->text().toStdString());
|
||||||
// config.writeConfig("opponent3name", lineEdit_Opponent3Name->text());
|
myConfig.writeConfigString("Opponent3Name", lineEdit_Opponent3Name->text().toStdString());
|
||||||
// config.writeConfig("opponent4name", lineEdit_Opponent4Name->text());
|
myConfig.writeConfigString("Opponent4Name", lineEdit_Opponent4Name->text().toStdString());
|
||||||
|
|
||||||
//Game Settings
|
// Game Settings
|
||||||
// config.writeConfig("numberofplayers", QString::number(spinBox_quantityPlayers->value(),10));
|
myConfig.writeConfigInt("NumberOfPlayers", spinBox_quantityPlayers->value());
|
||||||
// config.writeConfig("startcash", QString::number(spinBox_startCash->value(),10));
|
myConfig.writeConfigInt("StartCash", spinBox_startCash->value());
|
||||||
// config.writeConfig("smallblind", QString::number(spinBox_smallBlind->value(),10));
|
myConfig.writeConfigInt("SmallBlind", spinBox_smallBlind->value());
|
||||||
// config.writeConfig("gamespeed", QString::number(spinBox_gameSpeed->value(),10));
|
myConfig.writeConfigInt("GameSpeed", spinBox_gameSpeed->value());
|
||||||
// config.writeConfig("showgamesettingsdialogonnewgame", QString::number(checkBox_showGameSettingsDialogOnNewGame->isChecked(),10));
|
myConfig.writeConfigInt("ShowGameSettingsDialogOnNewGame", checkBox_showGameSettingsDialogOnNewGame->isChecked());
|
||||||
|
|
||||||
//Interface
|
// Interface
|
||||||
// config.writeConfig("showtoolbox", QString::number(checkBox_showToolbox->isChecked(),10));
|
myConfig.writeConfigInt("ShowToolBox", checkBox_showToolbox->isChecked());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ Session::~Session()
|
|||||||
|
|
||||||
void Session::startGame(int qP, int sC, int sB) {
|
void Session::startGame(int qP, int sC, int sB) {
|
||||||
|
|
||||||
actualGame = new Game(myGui, qP, sC, sB);
|
actualGame = new Game(myConfig, myGui, qP, sC, sB);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user