ConfigFile runs with tinyXml; NewRoundTimerBlock commented. Menu->actionNewGame disabled while running Hand
This commit is contained in:
+12
-12
@@ -76,7 +76,7 @@ void ConfigFile::createDefaultConfig() {
|
|||||||
TiXmlElement * confElement1 = new TiXmlElement( "NumberOfPlayers" );
|
TiXmlElement * confElement1 = new TiXmlElement( "NumberOfPlayers" );
|
||||||
config->LinkEndChild( confElement1 );
|
config->LinkEndChild( confElement1 );
|
||||||
confElement1->SetAttribute("value", 5);
|
confElement1->SetAttribute("value", 5);
|
||||||
TiXmlElement * confElement2 = new TiXmlElement( "StartChash" );
|
TiXmlElement * confElement2 = new TiXmlElement( "StartCash" );
|
||||||
config->LinkEndChild( confElement2 );
|
config->LinkEndChild( confElement2 );
|
||||||
confElement2->SetAttribute("value", 2000);
|
confElement2->SetAttribute("value", 2000);
|
||||||
TiXmlElement * confElement3 = new TiXmlElement( "SmallBlind" );
|
TiXmlElement * confElement3 = new TiXmlElement( "SmallBlind" );
|
||||||
@@ -121,9 +121,9 @@ string ConfigFile::readConfigString(string varName, string defaultValue)
|
|||||||
|
|
||||||
TiXmlElement* conf = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( varName ).ToElement();
|
TiXmlElement* conf = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( varName ).ToElement();
|
||||||
if ( conf ) {
|
if ( conf ) {
|
||||||
tempString = conf->Attribute("value");
|
const char *tmpStr = conf->Attribute("value");
|
||||||
cout << tempString << "\n";
|
if (tmpStr) tempString = tmpStr;
|
||||||
} else {
|
} /*else {
|
||||||
//Wenn nicht gefunden eines neues Anlegen
|
//Wenn nicht gefunden eines neues Anlegen
|
||||||
TiXmlElement* config = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).ToElement();
|
TiXmlElement* config = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).ToElement();
|
||||||
if ( config ) {
|
if ( config ) {
|
||||||
@@ -134,7 +134,7 @@ string ConfigFile::readConfigString(string varName, string defaultValue)
|
|||||||
|
|
||||||
return readConfigString(varName, defaultValue);
|
return readConfigString(varName, defaultValue);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return tempString;
|
return tempString;
|
||||||
}
|
}
|
||||||
@@ -142,18 +142,18 @@ string ConfigFile::readConfigString(string varName, string defaultValue)
|
|||||||
int ConfigFile::readConfigInt(string varName, int defaultValue)
|
int ConfigFile::readConfigInt(string varName, int defaultValue)
|
||||||
{
|
{
|
||||||
int tempInt=0;
|
int tempInt=0;
|
||||||
|
// cout << varName << " : " << tempInt << "\n";
|
||||||
TiXmlDocument doc(configFileName);
|
TiXmlDocument doc(configFileName);
|
||||||
|
|
||||||
if(!doc.LoadFile()) { cout << "Could Not Load Config-File!!! " << configFileName << "\n"; }
|
if(!doc.LoadFile()) { cout << "Could Not Load Config-File!!! " << configFileName << "\n"; }
|
||||||
|
|
||||||
TiXmlHandle docHandle( &doc );
|
TiXmlHandle docHandle( &doc );
|
||||||
|
|
||||||
TiXmlElement* conf = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( varName ).ToElement();
|
TiXmlElement* conf = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).FirstChild( varName ).ToElement();
|
||||||
if ( conf ) {
|
if ( conf ) {
|
||||||
conf->QueryValueAttribute("value", &tempInt );
|
// cout << varName << " : " << tempInt << "\n";
|
||||||
} else {
|
conf->QueryIntAttribute("value", &tempInt );
|
||||||
//Wenn nicht gefunden eines neues Anlegen
|
// cout << varName << " : " << tempInt << "\n";
|
||||||
|
} /*else {
|
||||||
|
// Wenn nicht gefunden eines neues Anlegen
|
||||||
TiXmlElement* config = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).ToElement();
|
TiXmlElement* config = docHandle.FirstChild( "PokerTH" ).FirstChild( "Configuration" ).ToElement();
|
||||||
if ( config ) {
|
if ( config ) {
|
||||||
TiXmlElement * confElement1 = new TiXmlElement( varName );
|
TiXmlElement * confElement1 = new TiXmlElement( varName );
|
||||||
@@ -163,7 +163,7 @@ int ConfigFile::readConfigInt(string varName, int defaultValue)
|
|||||||
|
|
||||||
return readConfigInt(varName, defaultValue);
|
return readConfigInt(varName, defaultValue);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return tempInt;
|
return tempInt;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ using namespace std;
|
|||||||
|
|
||||||
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)
|
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)
|
||||||
{
|
{
|
||||||
|
// cout << "Create Game Object" << "\n";
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
|
for(i=0; i<myGui->getMaxQuantityPlayers(); i++) {
|
||||||
@@ -87,6 +88,7 @@ Game::Game(ConfigFile* c, GuiInterface* g, int qP, int sC, int sB) : myConfig(c)
|
|||||||
|
|
||||||
Game::~Game()
|
Game::~Game()
|
||||||
{
|
{
|
||||||
|
// cout << "Delete Game Object" << "\n";
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
delete actualBoard;
|
delete actualBoard;
|
||||||
|
|||||||
@@ -209,17 +209,19 @@ void mainWindowImpl::callNewGameDialog() {
|
|||||||
actualGame = 0;
|
actualGame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//restliche Singleshots abfangen!!!
|
guiGameSpeed = v->spinBox_gameSpeed->value();
|
||||||
if (firstCallNewGame) { firstCallNewGame = FALSE; }
|
// debugMode = v->checkBox_debugMode->isChecked();
|
||||||
else { newRoundTimerBlock = TRUE; }
|
//Speeds
|
||||||
QTimer::singleShot(40*gameSpeed, this, SLOT( timerBlockerFalse() ));
|
setSpeeds();
|
||||||
|
|
||||||
|
//restliche Singleshots abfangen!!!
|
||||||
|
// if (firstCallNewGame) { firstCallNewGame = FALSE; }
|
||||||
|
// else { newRoundTimerBlock = TRUE; }
|
||||||
|
// QTimer::singleShot(400*gameSpeed, this, SLOT( timerBlockerFalse() ));
|
||||||
|
|
||||||
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 = v->spinBox_gameSpeed->value();
|
|
||||||
// debugMode = v->checkBox_debugMode->isChecked();
|
|
||||||
|
|
||||||
//Tools und Board aufhellen und enablen
|
//Tools und Board aufhellen und enablen
|
||||||
QPalette tempPalette = groupBox_board->palette();
|
QPalette tempPalette = groupBox_board->palette();
|
||||||
@@ -227,8 +229,6 @@ void mainWindowImpl::callNewGameDialog() {
|
|||||||
groupBox_board->setPalette(tempPalette);
|
groupBox_board->setPalette(tempPalette);
|
||||||
groupBox_tools->setDisabled(FALSE);
|
groupBox_tools->setDisabled(FALSE);
|
||||||
|
|
||||||
//Speeds
|
|
||||||
setSpeeds();
|
|
||||||
//positioning Slider
|
//positioning Slider
|
||||||
horizontalSlider_speed->setValue(guiGameSpeed);
|
horizontalSlider_speed->setValue(guiGameSpeed);
|
||||||
|
|
||||||
@@ -236,25 +236,29 @@ void mainWindowImpl::callNewGameDialog() {
|
|||||||
mySession->startGame(v->spinBox_quantityPlayers->value(), v->spinBox_startCash->value(), v->spinBox_smallBlind->value());
|
mySession->startGame(v->spinBox_quantityPlayers->value(), v->spinBox_startCash->value(), v->spinBox_smallBlind->value());
|
||||||
|
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
// sonst mit gespeicherten Werten starten
|
// sonst mit gespeicherten Werten starten
|
||||||
// else {
|
else {
|
||||||
|
|
||||||
if(actualGame) {
|
if(actualGame) {
|
||||||
mySession->deleteGame();
|
mySession->deleteGame();
|
||||||
actualGame = 0;
|
actualGame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guiGameSpeed = myConfig->readConfigInt("GameSpeed",4);
|
||||||
|
//Speeds
|
||||||
|
setSpeeds();
|
||||||
|
|
||||||
//restliche Singleshots abfangen!!!
|
//restliche Singleshots abfangen!!!
|
||||||
if (firstCallNewGame) { firstCallNewGame = FALSE; }
|
// if (firstCallNewGame) { firstCallNewGame = FALSE; }
|
||||||
else { newRoundTimerBlock = TRUE; }
|
// else { newRoundTimerBlock = TRUE; }
|
||||||
QTimer::singleShot(40*gameSpeed, this, SLOT( timerBlockerFalse() ));
|
// QTimer::singleShot(40*gameSpeed, this, SLOT( timerBlockerFalse() ));
|
||||||
|
|
||||||
|
|
||||||
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 = 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
|
||||||
@@ -263,8 +267,6 @@ void mainWindowImpl::callNewGameDialog() {
|
|||||||
groupBox_board->setPalette(tempPalette);
|
groupBox_board->setPalette(tempPalette);
|
||||||
groupBox_tools->setDisabled(FALSE);
|
groupBox_tools->setDisabled(FALSE);
|
||||||
|
|
||||||
//Speeds
|
|
||||||
setSpeeds();
|
|
||||||
|
|
||||||
//positioning Slider
|
//positioning Slider
|
||||||
horizontalSlider_speed->setValue(guiGameSpeed);
|
horizontalSlider_speed->setValue(guiGameSpeed);
|
||||||
@@ -276,6 +278,8 @@ void mainWindowImpl::callNewGameDialog() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actionNewGame->setDisabled(TRUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowImpl::callAboutPokerthDialog() {
|
void mainWindowImpl::callAboutPokerthDialog() {
|
||||||
@@ -740,6 +744,8 @@ else { newRoundTimerBlock=FALSE; }
|
|||||||
|
|
||||||
void mainWindowImpl::meInAction() {
|
void mainWindowImpl::meInAction() {
|
||||||
|
|
||||||
|
actionNewGame->setDisabled(FALSE);
|
||||||
|
|
||||||
|
|
||||||
switch (actualHand->getActualRound()) {
|
switch (actualHand->getActualRound()) {
|
||||||
|
|
||||||
@@ -1035,6 +1041,8 @@ void mainWindowImpl::myAllIn(){
|
|||||||
|
|
||||||
void mainWindowImpl::nextPlayerAnimation() {
|
void mainWindowImpl::nextPlayerAnimation() {
|
||||||
|
|
||||||
|
actionNewGame->setDisabled(TRUE);
|
||||||
|
|
||||||
refreshChangePlayer();
|
refreshChangePlayer();
|
||||||
|
|
||||||
//weiter mit switchrounds in Hand
|
//weiter mit switchrounds in Hand
|
||||||
@@ -1275,7 +1283,10 @@ else {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowImpl::handSwitchRounds() { actualHand->switchRounds(); }
|
void mainWindowImpl::handSwitchRounds() {
|
||||||
|
if( !newRoundTimerBlock ){ actualHand->switchRounds(); }
|
||||||
|
else { newRoundTimerBlock=FALSE; }
|
||||||
|
}
|
||||||
|
|
||||||
void mainWindowImpl::nextRoundCleanGui() {
|
void mainWindowImpl::nextRoundCleanGui() {
|
||||||
|
|
||||||
@@ -1334,11 +1345,7 @@ void mainWindowImpl::userWidgetsBackgroudColor() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mainWindowImpl::timerBlockerFalse() {
|
void mainWindowImpl::timerBlockerFalse() { newRoundTimerBlock=FALSE; }
|
||||||
|
|
||||||
newRoundTimerBlock=FALSE;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void mainWindowImpl::setSpeeds() {
|
void mainWindowImpl::setSpeeds() {
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ newGameDialogImpl::newGameDialogImpl(QWidget *parent, const char *name)
|
|||||||
ConfigFile myConfig;
|
ConfigFile myConfig;
|
||||||
|
|
||||||
//Game Settings
|
//Game Settings
|
||||||
|
|
||||||
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NumberOfPlayers", 5));
|
spinBox_quantityPlayers->setValue(myConfig.readConfigInt("NumberOfPlayers", 5));
|
||||||
spinBox_startCash->setValue(myConfig.readConfigInt("StartCash", 2000));
|
spinBox_startCash->setValue(myConfig.readConfigInt("StartCash", 2000));
|
||||||
spinBox_smallBlind->setValue(myConfig.readConfigInt("SmallBlind", 10));
|
spinBox_smallBlind->setValue(myConfig.readConfigInt("SmallBlind", 10));
|
||||||
|
|||||||
Reference in New Issue
Block a user