Skip to content

Commit 32a89db

Browse files
author
Stephen Hall
committed
Resolved some compiler warnings
chesspp::exception::what was hiding std::exception::what. Fixed initialization list order in Piece ctor, and gave Piece a virtual destructor because it's an abstract class.
1 parent 696c9a3 commit 32a89db

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/Exception.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
namespace chesspp
88
{
99
class exception : public std::exception
10-
{
10+
{
11+
using std::exception::what;
1112
public:
1213
exception() throw() {}
1314
virtual ~exception() throw() {};

src/board/Piece.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace chesspp
44
{
55
Piece::Piece(const Position& bPos, const Position& tPos, Color c, Type t)
6-
:boardPos(bPos), color(c), type(t)
6+
: color(c), type(t), boardPos(bPos)
77
{
88
int tX = tPos.getX();
99
int tY = tPos.getY() + ( c == WHITE ? 0 : 80 );

src/board/Piece.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ namespace chesspp
4242
const Type type; // What type this piece is.
4343

4444
protected:
45-
45+
4646
posList trajectory; // The list of possible Positions (see OnValidity.txt)
4747
Position boardPos; // The position on the baord this piece is
4848

4949
public:
5050

5151
Piece(const Position& bPos, const Position& tPos, Color c, Type t);
52+
virtual ~Piece() {}
5253

5354
// Standard Accesors
5455
const Position& getBoardPos(void) const;

0 commit comments

Comments
 (0)