Commit 7ce0af72 authored by Ömer Fadıl Usta's avatar Ömer Fadıl Usta 😊
Browse files

Fix to have c++17 compatibility

Dynamic throw is not acceptable in c++17
ISO C++17 does not allow dynamic exception specifications
parent 949bc984
......@@ -64,14 +64,14 @@ AiBoard::~AiBoard() {
delete m_dimension;
}
bool AiBoard::empty(const Coord& c) const throw(outOfBounds) {
bool AiBoard::empty(const Coord& c) const {
if (!m_dimension->ok(c)) {
throw outOfBounds();
}
return m_board[c.x()][c.y()].empty();
}
bool AiBoard::empty(const usi x, const usi y) const throw(outOfBounds) {
bool AiBoard::empty(const usi x, const usi y) const {
return empty(Coord(x, y));
}
......@@ -106,19 +106,18 @@ Coord* AiBoard::moves() {
return new Coord();
}
Player AiBoard::player(const Coord& c) const throw(outOfBounds) {
Player AiBoard::player(const Coord& c) const {
if (!m_dimension->ok(c)) {
throw outOfBounds();
}
return m_board[c.x()][c.y()].player();
}
Player AiBoard::player(const usi x, const usi y) const throw(outOfBounds) {
Player AiBoard::player(const usi x, const usi y) const {
return player(Coord(x, y));
}
bool AiBoard::setPlayer(const Move& move)
throw(busy, gameover, notValidPlayer) {
bool AiBoard::setPlayer(const Move& move) {
m_cleanBoard = false;
zero(move.coord());
m_board[move.coord().x()][move.coord().y()].setPlayer(move.player());
......@@ -240,21 +239,21 @@ Coord AiBoard::evaluate() const {
return v3.begin()->second;
}
uli AiBoard::points(const Coord& c) const throw(outOfBounds) {
uli AiBoard::points(const Coord& c) const {
if (!m_dimension->ok(c)) {
throw outOfBounds();
}
return m_board[c.x()][c.y()].points();
}
void AiBoard::addPoints(const Coord& c, uli points) throw(outOfBounds) {
void AiBoard::addPoints(const Coord& c, uli points) {
if (!m_dimension->ok(c)) {
throw outOfBounds();
}
m_board[c.x()][c.y()].setPoints(m_board[c.x()][c.y()].points() + points);
}
void AiBoard::setPoints(const Coord& c, uli points) throw(outOfBounds) {
void AiBoard::setPoints(const Coord& c, uli points) {
if (!m_dimension->ok(c)) {
throw outOfBounds();
}
......
......@@ -109,7 +109,7 @@ public:
* @param coord Coord to check
* @return @c true if coord is empty, @c false otherwise
*/
bool empty(const Coord&) const throw(outOfBounds);
bool empty(const Coord&) const;
/**
* @brief is a Coord empty or set?
......@@ -120,7 +120,7 @@ public:
* @param y X-part of coordinate to check
* @return @c true if coord is empty, @c false otherwise
*/
bool empty(const usi x, const usi y) const throw(outOfBounds);
bool empty(const usi x, const usi y) const;
/**
* @brief height of AiBoard
......@@ -153,7 +153,7 @@ public:
* @return @c X if player 1, @c O if player 2, @c No if empty
* @throw outOfBounds if coord isn't on the playing board
*/
Player player(const Coord&) const throw(outOfBounds);
Player player(const Coord&) const;
/**
* @brief the player occupying a Coord
......@@ -163,7 +163,7 @@ public:
* @return @c X if player 1, @c O if player 2, @c No if empty
* @throw outOfBounds if coord isn't on the playing board
*/
Player player(const usi x, const usi y) const throw(outOfBounds);
Player player(const usi x, const usi y) const;
/**
* @brief set the player of a Coord
......@@ -177,7 +177,7 @@ public:
* @throw gameOver if game was already over
* @throw notValidPlayer if player wasn't X or O
*/
bool setPlayer(const Move& move) throw(busy, gameover, notValidPlayer);
bool setPlayer(const Move& move);
/**
* @brief change Skill
......@@ -216,9 +216,9 @@ private:
Coord evaluate() const;
/* returns, adds och sets points on a given square. */
uli points(const Coord&) const throw(outOfBounds);
void addPoints(const Coord&, const uli points) throw(outOfBounds);
void setPoints(const Coord&, const uli points) throw(outOfBounds);
uli points(const Coord&) const;
void addPoints(const Coord&, const uli points);
void setPoints(const Coord&, const uli points);
/* initialize this class */
void setup();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment