Additional LocalExceptions.

This commit is contained in:
lotodore
2007-10-14 17:49:15 +00:00
parent 6822e60805
commit c5c9ce262a
2 changed files with 6 additions and 4 deletions
+2
View File
@@ -24,6 +24,8 @@
#define ERR_SEAT_NOT_FOUND 10001 #define ERR_SEAT_NOT_FOUND 10001
#define ERR_ACTIVE_PLAYER_NOT_FOUND 10002 #define ERR_ACTIVE_PLAYER_NOT_FOUND 10002
#define ERR_RUNNING_PLAYER_NOT_FOUND 10003 #define ERR_RUNNING_PLAYER_NOT_FOUND 10003
#define ERR_DEALER_NOT_FOUND 10004
#define ERR_CURRENT_PLAYER_NOT_FOUND 10005
#define ERR_NEXT_DEALER_NOT_FOUND 10010 #define ERR_NEXT_DEALER_NOT_FOUND 10010
#define ERR_NEXT_ACTIVE_PLAYER_NOT_FOUND 10011 #define ERR_NEXT_ACTIVE_PLAYER_NOT_FOUND 10011
+4 -4
View File
@@ -66,7 +66,8 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
break; break;
++player_i; ++player_i;
} }
assert(player_i != player_end); if (player_i == player_end)
throw LocalException(ERR_DEALER_NOT_FOUND);
dealerPosition = startData.startDealerPlayerId; dealerPosition = startData.startDealerPlayerId;
// Board erstellen // Board erstellen
@@ -228,8 +229,6 @@ void Game::initHand()
void Game::startHand() void Game::startHand()
{ {
assert(actualHand);
//GUI bereinigen //GUI bereinigen
myGui->nextRoundCleanGui(); myGui->nextRoundCleanGui();
@@ -260,7 +259,8 @@ boost::shared_ptr<PlayerInterface> Game::getPlayerByUniqueId(unsigned id)
boost::shared_ptr<PlayerInterface> Game::getCurrentPlayer() boost::shared_ptr<PlayerInterface> Game::getCurrentPlayer()
{ {
boost::shared_ptr<PlayerInterface> tmpPlayer = getPlayerByUniqueId(getCurrentHand()->getCurrentBeRo()->getCurrentPlayersTurnId()); boost::shared_ptr<PlayerInterface> tmpPlayer = getPlayerByUniqueId(getCurrentHand()->getCurrentBeRo()->getCurrentPlayersTurnId());
assert(tmpPlayer.get()); if (!tmpPlayer.get())
throw LocalException(ERR_CURRENT_PLAYER_NOT_FOUND);
return tmpPlayer; return tmpPlayer;
} }