From 46a835df4b05a1284b5288c4f370610e818f6d75 Mon Sep 17 00:00:00 2001 From: Karma Riuk Date: Thu, 6 Feb 2025 20:11:11 +0100 Subject: [PATCH] moved some code around because it made more sense --- cpp/src/controller/manual.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cpp/src/controller/manual.cpp b/cpp/src/controller/manual.cpp index 86a00c7..8400052 100644 --- a/cpp/src/controller/manual.cpp +++ b/cpp/src/controller/manual.cpp @@ -25,13 +25,6 @@ void ManualController::on_tile_selected(int x, int y) { else reset_selection(); } - - Colour current_colour = board.white_to_play ? White : Black; - if (board.is_checkmate_for(current_colour)) - view.notify_checkmate(current_colour); - - if (board.is_stalemate_for(current_colour)) - view.notify_stalemate(current_colour); } void ManualController::reset_selection() { @@ -57,4 +50,11 @@ void ManualController::show_legal_moves(Coords xy) { void ManualController::make_move(Move move) { board = board.make_move(move); reset_selection(); + + Colour current_colour = board.white_to_play ? White : Black; + if (board.is_checkmate_for(current_colour)) + view.notify_checkmate(current_colour); + + if (board.is_stalemate_for(current_colour)) + view.notify_stalemate(current_colour); }