From 2b806c41b4c07f924cf1dfae89772161e8c4a0eb Mon Sep 17 00:00:00 2001 From: David Meybohm Date: Fri, 13 Sep 2024 11:26:08 -0400 Subject: [PATCH] Uninline needPawnPromotion function --- engine/src/generate.cpp | 17 ++++++++++++++++- engine/src/generate.hpp | 16 ++-------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/engine/src/generate.cpp b/engine/src/generate.cpp index de0cbc667..b96f86c7e 100644 --- a/engine/src/generate.cpp +++ b/engine/src/generate.cpp @@ -281,7 +281,7 @@ namespace wisdom appendMove (knight_move); } - auto + auto eligibleEnPassantColumn (const Board& board, int row, int column, Color who) -> optional { @@ -581,4 +581,19 @@ namespace wisdom return non_checks; } + auto + needPawnPromotion (int row, Color who) + -> bool + { + assert (isColorValid (who)); + switch (who) + { + case Color::White: + return 0 == row; + case Color::Black: + return 7 == row; + default: + throw Error { "Invalid color in needPawnPromotion()" }; + } + } } diff --git a/engine/src/generate.hpp b/engine/src/generate.hpp index 2bdfe185e..4911e5fc5 100644 --- a/engine/src/generate.hpp +++ b/engine/src/generate.hpp @@ -15,21 +15,9 @@ namespace wisdom generateLegalMoves (const Board& board, Color who) -> MoveList; - [[nodiscard]] inline auto + [[nodiscard]] auto needPawnPromotion (int row, Color who) - -> bool - { - assert (isColorValid (who)); - switch (who) - { - case Color::White: - return 0 == row; - case Color::Black: - return 7 == row; - default: - throw Error { "Invalid color in needPawnPromotion()" }; - } - } + -> bool; // Return en passant column if the board is the player is eligible. [[nodiscard]] auto