dev: Pile of updates and formatting fixes.
This commit is contained in:
parent
47043a7869
commit
68ed9ce922
9 changed files with 182 additions and 166 deletions
38
Piece.hpp
38
Piece.hpp
|
|
@ -1,10 +1,10 @@
|
|||
// © 2025 A.M. Rowsell <amr@frzn.dev>
|
||||
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
// defined by the Mozilla Public License, v. 2.0.
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
// defined by the Mozilla Public License, v. 2.0.
|
||||
|
||||
#ifndef PIECE_HPP
|
||||
#define PIECE_HPP
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "Board.hpp"
|
||||
|
|
@ -48,15 +49,16 @@ struct Move {
|
|||
};
|
||||
|
||||
class Piece {
|
||||
private:
|
||||
friend class Board;
|
||||
protected:
|
||||
protected:
|
||||
PieceColour colour;
|
||||
PieceType pieceType;
|
||||
std::string pieceName;
|
||||
char pieceSymbol;
|
||||
char pieceSymbol;
|
||||
bool hasMoved = false;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
Piece(PieceColour pColour) : colour(pColour) {
|
||||
}
|
||||
|
|
@ -66,15 +68,15 @@ public:
|
|||
PieceColour getColour() const {
|
||||
return colour;
|
||||
}
|
||||
|
||||
|
||||
std::string getPieceName() const {
|
||||
return pieceName;
|
||||
}
|
||||
|
||||
|
||||
char getPieceSymbol() const {
|
||||
return pieceSymbol;
|
||||
}
|
||||
|
||||
|
||||
PieceType getPieceType() const {
|
||||
return pieceType;
|
||||
}
|
||||
|
|
@ -86,7 +88,7 @@ public:
|
|||
|
||||
class King : public Piece {
|
||||
friend class Board;
|
||||
public:
|
||||
public:
|
||||
|
||||
King(PieceColour colour) : Piece(colour) {
|
||||
pieceName = "King";
|
||||
|
|
@ -102,14 +104,14 @@ public:
|
|||
bool checkForCastle() const {
|
||||
return canCastle;
|
||||
}
|
||||
protected:
|
||||
protected:
|
||||
bool canCastle = true;
|
||||
bool inCheck = false;
|
||||
};
|
||||
|
||||
class Rook : public Piece {
|
||||
friend class Board;
|
||||
public:
|
||||
public:
|
||||
|
||||
Rook(PieceColour colour) : Piece(colour) {
|
||||
pieceName = "Rook";
|
||||
|
|
@ -121,7 +123,7 @@ public:
|
|||
|
||||
class Queen : public Piece {
|
||||
friend class Board;
|
||||
public:
|
||||
public:
|
||||
|
||||
Queen(PieceColour colour) : Piece(colour) {
|
||||
pieceName = "Queen";
|
||||
|
|
@ -133,7 +135,7 @@ public:
|
|||
|
||||
class Knight : public Piece {
|
||||
friend class Board;
|
||||
public:
|
||||
public:
|
||||
|
||||
Knight(PieceColour colour) : Piece(colour) {
|
||||
pieceName = "Knight";
|
||||
|
|
@ -145,7 +147,7 @@ public:
|
|||
|
||||
class Bishop : public Piece {
|
||||
friend class Board;
|
||||
public:
|
||||
public:
|
||||
|
||||
Bishop(PieceColour colour) : Piece(colour) {
|
||||
pieceName = "Bishop";
|
||||
|
|
@ -157,7 +159,7 @@ public:
|
|||
|
||||
class Pawn : public Piece {
|
||||
friend class Board;
|
||||
public:
|
||||
public:
|
||||
|
||||
Pawn(PieceColour colour) : Piece(colour) {
|
||||
pieceName = "Pawn";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue