From fa57dcfc30272626878bf542f362d499439d5a0b Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Mon, 3 Feb 2025 00:08:13 +0100 Subject: [PATCH] apparently the default value of a paramter goes in the declaration and not the defintion, i didn't know that --- cpp/src/pieces/piece.cpp | 5 ++--- cpp/src/pieces/piece.hpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cpp/src/pieces/piece.cpp b/cpp/src/pieces/piece.cpp index 9c192cc..422b2a1 100644 --- a/cpp/src/pieces/piece.cpp +++ b/cpp/src/pieces/piece.cpp @@ -18,9 +18,8 @@ keep_only_blocking(const std::vector candidates, const Board& board) { return ret; } -std::vector legal_moves( - int8_t p, const Board& b, const Coords xy, bool looking_for_check = false -) { +std::vector +legal_moves(int8_t p, const Board& b, const Coords xy, bool looking_for_check) { std::vector ret; switch (p) { case Piece::Pawn: diff --git a/cpp/src/pieces/piece.hpp b/cpp/src/pieces/piece.hpp index 0e51010..a89568e 100644 --- a/cpp/src/pieces/piece.hpp +++ b/cpp/src/pieces/piece.hpp @@ -24,7 +24,7 @@ enum Colour : int8_t { class Board; struct Coords; -std::vector legal_moves(int8_t, const Board&, const Coords, bool); +std::vector legal_moves(int8_t, const Board&, const Coords, bool = false); std::vector keep_only_blocking(const std::vector, const Board&); std::optional move_for_position(const Board&, const Coords, const Coords); std::vector look_direction(const Board&, const Coords, int, int);