aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzedarider <ymherklotz@gmail.com>2016-11-06 20:28:39 +0000
committerzedarider <ymherklotz@gmail.com>2016-11-06 20:28:39 +0000
commitf39a4463efa9deeaa6ec1f7986964f5baad784c2 (patch)
tree32be81647a2decb85c401ab84655caea01dcdffb
parent4428e477ae27e8634715610649b68919810dd684 (diff)
downloadChessAI-f39a4463efa9deeaa6ec1f7986964f5baad784c2.tar.gz
ChessAI-f39a4463efa9deeaa6ec1f7986964f5baad784c2.zip
constructor is now default
-rw-r--r--Makefile2
-rwxr-xr-xbin/chess_aibin235664 -> 235848 bytes
-rw-r--r--include/chess_ai.hpp8
-rw-r--r--src/chess_piece.cpp7
4 files changed, 8 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 1612948..a3a4bfd 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ TARGET := bin/chess_ai
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name "*.$(SRCEXT)")
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
-CFLAGS := -g -Wall -Wextra -std=c++14
+CFLAGS := -g -Wall -Wextra -Wpedantic -std=c++14
LIB :=
INC := -I include
diff --git a/bin/chess_ai b/bin/chess_ai
index 6950f5d..17216ca 100755
--- a/bin/chess_ai
+++ b/bin/chess_ai
Binary files differ
diff --git a/include/chess_ai.hpp b/include/chess_ai.hpp
index c1496e3..524ddc8 100644
--- a/include/chess_ai.hpp
+++ b/include/chess_ai.hpp
@@ -113,7 +113,7 @@ namespace chess_ai {
public:
// Initialises the chess piece to an empty square on the board
- chess_piece();
+ chess_piece() : type(empty), colour(none), x(0), y(0) {}
// Otherwise initialise the chess piece to a king or queen where the
// location is alreay known
@@ -153,6 +153,12 @@ namespace chess_ai {
return *this;
}
+ chess_piece operator++(int) {
+ chess_piece tmp(*this);
+ operator++();
+ return tmp;
+ }
+
// return a printable version of the square
std::string str();
diff --git a/src/chess_piece.cpp b/src/chess_piece.cpp
index cd28ef8..5e23444 100644
--- a/src/chess_piece.cpp
+++ b/src/chess_piece.cpp
@@ -1,12 +1,5 @@
#include "../include/chess_ai.hpp"
-chess_ai::chess_piece::chess_piece() {
- type = empty;
- colour = none;
- x = -1;
- y = -1;
-}
-
chess_ai::chess_piece::chess_piece(piece_type type, piece_colour colour) {
this->type = type;
this->colour = colour;