Exceptions are now derived from std::exception and tell source code file and line.
This commit is contained in:
@@ -40,7 +40,7 @@ LocalBeRo::LocalBeRo(HandInterface* hi, int id, unsigned dP, int sB, GameState g
|
||||
}
|
||||
}
|
||||
if(it_c == myHand->getActivePlayerList()->end()) {
|
||||
throw LocalException(ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
// determine smallBlindPosition
|
||||
@@ -51,7 +51,7 @@ LocalBeRo::LocalBeRo(HandInterface* hi, int id, unsigned dP, int sB, GameState g
|
||||
}
|
||||
}
|
||||
if(it_c == myHand->getActivePlayerList()->end()) {
|
||||
throw LocalException(ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ void LocalBeRo::nextPlayer() {
|
||||
|
||||
PlayerListConstIterator currentPlayersTurnConstIt = myHand->getRunningPlayerIt(currentPlayersTurnId);
|
||||
if(currentPlayersTurnConstIt == myHand->getRunningPlayerList()->end()) {
|
||||
throw LocalException(ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
(*currentPlayersTurnConstIt)->action();
|
||||
@@ -178,7 +178,7 @@ void LocalBeRo::run() {
|
||||
|
||||
it_1 = myHand->getActivePlayerIt(smallBlindPositionId);
|
||||
if(it_1 == myHand->getActivePlayerList()->end()) {
|
||||
throw LocalException(ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
for(i=0; i<myHand->getActivePlayerList()->size(); i++) {
|
||||
@@ -195,7 +195,7 @@ void LocalBeRo::run() {
|
||||
}
|
||||
}
|
||||
if(!formerRunningPlayerFound) {
|
||||
throw LocalException(ERR_FORMER_RUNNING_PLAYER_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_FORMER_RUNNING_PLAYER_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
// heads up: bigBlind begins -> dealer/smallBlind is running player before bigBlind
|
||||
@@ -343,7 +343,7 @@ void LocalBeRo::run() {
|
||||
// determine next running player
|
||||
PlayerListConstIterator currentPlayersTurnIt = myHand->getRunningPlayerIt( currentPlayersTurnId );
|
||||
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) {
|
||||
throw LocalException(ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
currentPlayersTurnIt++;
|
||||
@@ -386,7 +386,7 @@ void LocalBeRo::run() {
|
||||
|
||||
currentPlayersTurnIt = myHand->getRunningPlayerIt( currentPlayersTurnId );
|
||||
if(currentPlayersTurnIt == myHand->getRunningPlayerList()->end()) {
|
||||
throw LocalException(ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
(*currentPlayersTurnIt)->setMyTurn(true);
|
||||
|
||||
@@ -91,7 +91,7 @@ void LocalBeRoPreflop::run() {
|
||||
|
||||
it = getMyHand()->getActivePlayerIt(getSmallBlindPositionId());
|
||||
if(it == getMyHand()->getActivePlayerList()->end()) {
|
||||
throw LocalException(ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_ACTIVE_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
if(it == getMyHand()->getActivePlayerList()->begin()) it = getMyHand()->getActivePlayerList()->end();
|
||||
@@ -227,7 +227,7 @@ void LocalBeRoPreflop::run() {
|
||||
|
||||
PlayerListConstIterator currentPlayersTurnIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
|
||||
if(currentPlayersTurnIt == getMyHand()->getRunningPlayerList()->end()) {
|
||||
throw LocalException(ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
currentPlayersTurnIt++;
|
||||
@@ -353,7 +353,7 @@ void LocalBeRoPreflop::run() {
|
||||
|
||||
currentPlayersTurnIt = getMyHand()->getRunningPlayerIt( getCurrentPlayersTurnId() );
|
||||
if(currentPlayersTurnIt == getMyHand()->getRunningPlayerList()->end()) {
|
||||
throw LocalException(ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_RUNNING_PLAYER_NOT_FOUND);
|
||||
}
|
||||
(*currentPlayersTurnIt)->setMyTurn(true);
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ void LocalBoard::distributePot() {
|
||||
// determine the number of level winners
|
||||
winnerCount = potLevel.size()-2;
|
||||
if (!winnerCount) {
|
||||
throw LocalException(ERR_NO_WINNER);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_NO_WINNER);
|
||||
}
|
||||
|
||||
// distribute the pot level sum to level winners
|
||||
@@ -176,7 +176,7 @@ void LocalBoard::distributePot() {
|
||||
for(j=2; j<potLevel.size(); j++) {
|
||||
it = currentHand->getSeatIt(potLevel[j]);
|
||||
if(it == seatsList->end()) {
|
||||
throw LocalException(ERR_SEAT_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||
}
|
||||
(*it)->setMyCash( (*it)->getMyCash() + ((potLevel[1])/winnerCount));
|
||||
|
||||
@@ -216,7 +216,7 @@ void LocalBoard::distributePot() {
|
||||
|
||||
it = currentHand->getSeatIt(winnerPointer);
|
||||
if(it == seatsList->end()) {
|
||||
throw LocalException(ERR_SEAT_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||
}
|
||||
if(j<mod) {
|
||||
(*it)->setMyCash( (*it)->getMyCash() + (int)((potLevel[1])/winnerCount) + 1);
|
||||
|
||||
@@ -27,8 +27,8 @@ class LocalException : public PokerTHException
|
||||
{
|
||||
public:
|
||||
|
||||
LocalException(int errorId)
|
||||
: PokerTHException(errorId, 0) {}
|
||||
LocalException(const char *sourcefile, int sourceline, int errorId)
|
||||
: PokerTHException(sourcefile, sourceline, errorId, 0) {}
|
||||
virtual ~LocalException();
|
||||
};
|
||||
|
||||
|
||||
@@ -381,7 +381,7 @@ void LocalHand::assignButtons() {
|
||||
// DealerButton zuweisen
|
||||
it = getSeatIt(dealerPosition);
|
||||
if(it == seatsList->end()) {
|
||||
throw LocalException(ERR_SEAT_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||
}
|
||||
(*it)->setMyButton(BUTTON_DEALER);
|
||||
|
||||
@@ -417,7 +417,7 @@ void LocalHand::assignButtons() {
|
||||
bool nextActivePlayerFound = false;
|
||||
PlayerListIterator dealerPositionIt = getSeatIt(dealerPosition);
|
||||
if(dealerPositionIt == seatsList->end()) {
|
||||
throw LocalException(ERR_SEAT_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_SEAT_NOT_FOUND);
|
||||
}
|
||||
|
||||
for(i=0; i<seatsList->size(); i++) {
|
||||
@@ -442,7 +442,7 @@ void LocalHand::assignButtons() {
|
||||
|
||||
}
|
||||
if(!nextActivePlayerFound) {
|
||||
throw LocalException(ERR_NEXT_ACTIVE_PLAYER_NOT_FOUND);
|
||||
throw LocalException(__FILE__, __LINE__, ERR_NEXT_ACTIVE_PLAYER_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user