exceptions & bugfixes

This commit is contained in:
doitux
2007-09-29 00:08:19 +00:00
parent eec7e6c097
commit fc435f2769
15 changed files with 260 additions and 120 deletions
+25
View File
@@ -0,0 +1,25 @@
/***************************************************************************
* Copyright (C) 2006 by FThauer FHammer *
* f.thauer@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "pokerthexception.h"
PokerTHException::~PokerTHException()
{
}
+41
View File
@@ -0,0 +1,41 @@
/***************************************************************************
* Copyright (C) 2007 by Lothar May *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/* Base exception class. */
#ifndef _POKERTHEXCEPTION_H_
#define _POKERTHEXCEPTION_H_
class PokerTHException
{
public:
PokerTHException(int errorId, int osErrorCode)
: m_errorId(errorId), m_osErrorCode(osErrorCode) {}
virtual ~PokerTHException();
int GetErrorId() const {return m_errorId;}
int GetOsErrorCode() const {return m_osErrorCode;}
private:
int m_errorId;
int m_osErrorCode;
};
#endif
+1
View File
@@ -21,6 +21,7 @@
#include "handinterface.h"
#include <game_defs.h>
#include "localexception.h"
using namespace std;
@@ -0,0 +1,26 @@
/***************************************************************************
* Copyright (C) 2007 by Lothar May *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "localexception.h"
LocalException::~LocalException()
{
}
+35
View File
@@ -0,0 +1,35 @@
/***************************************************************************
* Copyright (C) 2007 by Lothar May *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/* Exception class for engine errors. */
#ifndef _LOCALEXCEPTION_H_
#define _LOCALEXCEPTION_H_
#include "pokerthexception.h"
class LocalException : public PokerTHException
{
public:
LocalException(int errorId)
: PokerTHException(errorId, 0) {}
virtual ~LocalException();
};
#endif
+22 -22
View File
@@ -112,7 +112,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
case 1: {
tempBoardArray[0] = 27;
/* tempBoardArray[0] = 27;
tempBoardArray[1] = 37;
tempBoardArray[2] = 45;
tempBoardArray[3] = 51;
@@ -124,7 +124,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
tempPlayerAndBoardArray[3] = tempBoardArray[1];
tempPlayerAndBoardArray[4] = tempBoardArray[2];
tempPlayerAndBoardArray[5] = tempBoardArray[3];
tempPlayerAndBoardArray[6] = tempBoardArray[4];
tempPlayerAndBoardArray[6] = tempBoardArray[4];*/
// player0
it = seatsList->begin();
@@ -142,7 +142,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player1
it++;
tempPlayerArray[0] = 12;
/* tempPlayerArray[0] = 12;
tempPlayerArray[1] = 48;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
@@ -150,7 +150,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
(*it)->setMyCards(tempPlayerArray);
(*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
(*it)->setMyBestHandPosition(temp5Array);
(*it)->setMyBestHandPosition(temp5Array);*/
// player2
it++;
@@ -181,28 +181,28 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, BoardI
// player4
it++;
tempPlayerArray[0] = 25;
tempPlayerArray[1] = 16;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
(*it)->setMyCards(tempPlayerArray);
(*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
(*it)->setMyBestHandPosition(temp5Array);
// tempPlayerArray[0] = 25;
// tempPlayerArray[1] = 16;
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
//
// (*it)->setMyCards(tempPlayerArray);
// (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
//
// (*it)->setMyBestHandPosition(temp5Array);
// player5
it++;
tempPlayerArray[0] = 43;
tempPlayerArray[1] = 30;
tempPlayerAndBoardArray[0] = tempPlayerArray[0];
tempPlayerAndBoardArray[1] = tempPlayerArray[1];
(*it)->setMyCards(tempPlayerArray);
(*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
(*it)->setMyBestHandPosition(temp5Array);
// tempPlayerArray[0] = 43;
// tempPlayerArray[1] = 30;
// tempPlayerAndBoardArray[0] = tempPlayerArray[0];
// tempPlayerAndBoardArray[1] = tempPlayerArray[1];
//
// (*it)->setMyCards(tempPlayerArray);
// (*it)->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,temp5Array));
//
// (*it)->setMyBestHandPosition(temp5Array);
} break;
+18 -10
View File
@@ -860,22 +860,22 @@ LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniq
myCash=0;
} break;
case 1: {
myCash=2520;
myCash=0;
} break;
case 2: {
myCash=0;
myCash=180;
} break;
case 3: {
myCash=0;
myCash=3930;
} break;
case 4: {
myCash=14700;
myCash=0;
} break;
case 5: {
myCash=3780;
myCash=13590;
} break;
case 6: {
myCash=0;
myCash=3300;
} break;
default: {
}
@@ -1202,8 +1202,8 @@ void LocalPlayer::preflopEngine() {
switch(actualHand->getMyID()) {
case 1: {
myAction = PLAYER_ACTION_RAISE;
raise = 3000;
// myAction = PLAYER_ACTION_RAISE;
// raise = 3000;
}
break;
case 2: {
@@ -1246,7 +1246,7 @@ void LocalPlayer::preflopEngine() {
case 3: {
switch(actualHand->getMyID()) {
case 1: {
// myAction = PLAYER_ACTION_FOLD;
myAction = PLAYER_ACTION_FOLD;
// raise = 20;
// if(mySet >= 40) {
// myAction = PLAYER_ACTION_CALL;
@@ -1290,7 +1290,15 @@ void LocalPlayer::preflopEngine() {
}
break;
case 5: {
// myAction = PLAYER_ACTION_FOLD;
if(mySet == 0) {
myAction = PLAYER_ACTION_CALL;
}
}
break;
case 6: {
if(mySet == 160) {
myAction = PLAYER_ACTION_CALL;
}
}
break;
default: {}
+2 -2
View File
@@ -28,7 +28,7 @@
using namespace std;
Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
const PlayerDataList &playerDataList, const GameData gameData,
const PlayerDataList &playerDataList, const GameData &gameData,
const StartData &startData, int gameId)
: myFactory(factory), myGui(gui), actualHand(0), actualBoard(0),
startQuantityPlayers(startData.numberOfPlayers),
@@ -37,7 +37,7 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
myGameID(gameId), actualSmallBlind(gameData.smallBlind), actualHandID(0), dealerPosition(0), lastHandBlindsRaised(1), lastTimeBlindsRaised(0), myGameData(gameData)
{
if(DEBUG_MODE) {
startSmallBlind = 5120;
startSmallBlind = 160;
actualSmallBlind = startSmallBlind;
}
+1 -1
View File
@@ -45,7 +45,7 @@ class Game {
public:
Game(GuiInterface *gui, boost::shared_ptr<EngineFactory> factory,
const PlayerDataList &playerDataList, const GameData gameData,
const PlayerDataList &playerDataList, const GameData &gameData,
const StartData &startData, int gameId);
~Game();
+1 -1
View File
@@ -2522,7 +2522,7 @@
<x>0</x>
<y>0</y>
<width>1000</width>
<height>30</height>
<height>29</height>
</rect>
</property>
<widget class="QMenu" name="menuView" >
+2 -2
View File
@@ -805,7 +805,7 @@ void mainWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
startData.numberOfPlayers = gameData.maxNumberOfPlayers;
Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0);
if(DEBUG_MODE) {
tmpDealerPos = 4;
tmpDealerPos = 5;
}
startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos);
@@ -2944,7 +2944,7 @@ void mainWindowImpl::localGameModification() {
}
//Set the playing mode to "manual"
playingMode = 1;
playingMode = 0;
}
+3 -9
View File
@@ -21,21 +21,15 @@
#ifndef _NETEXCEPTION_H_
#define _NETEXCEPTION_H_
#include "pokerthexception.h"
class NetException
class NetException : public PokerTHException
{
public:
NetException(int errorId, int osErrorCode)
: m_errorId(errorId), m_osErrorCode(osErrorCode) {}
: PokerTHException(errorId, osErrorCode) {}
virtual ~NetException();
int GetErrorId() const {return m_errorId;}
int GetOsErrorCode() const {return m_osErrorCode;}
private:
int m_errorId;
int m_osErrorCode;
};
#endif
+1
View File
@@ -96,6 +96,7 @@ void Session::startLocalGame(const GameData &gameData, const StartData &startDat
currentGame->initHand();
currentGame->startHand();
// SPIEL-SCHLEIFE
}
void Session::startClientGame(boost::shared_ptr<Game> game)