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