From 096676fc364314d0f58c30ca7cba771ff3581ab1 Mon Sep 17 00:00:00 2001 From: Tait Hoyem <44244401+TTWNO@users.noreply.github.com> Date: Sun, 28 Apr 2019 20:11:05 +0000 Subject: [PATCH] Fix warnings --- src/chess.cpp | 8 ++++---- src/functions.cpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/chess.cpp b/src/chess.cpp index 3fe13d8..f0166e5 100644 --- a/src/chess.cpp +++ b/src/chess.cpp @@ -175,18 +175,18 @@ int main(){ } if (moving_piece == W_ROOK){ if (moving_from_pos == Position::A1 && - (castle_perms & CastlePerms::WQS == 1)){ + ((castle_perms & CastlePerms::WQS) == CastlePerms::WQS)){ castle_perms -= CastlePerms::WQS; } else if (moving_from_pos == Position::H1 && - (castle_perms & CastlePerms::WKS == 1)){ + ((castle_perms & CastlePerms::WKS) == CastlePerms::WKS)){ castle_perms -= CastlePerms::WKS; } } else if (moving_piece == B_ROOK){ if (moving_from_pos == Position::H8 && - (castle_perms & CastlePerms::BKS == 1)){ + ((castle_perms & CastlePerms::BKS) == CastlePerms::BKS)){ castle_perms -= CastlePerms::BKS; } else if (moving_from_pos == Position::A8 && - (castle_perms & CastlePerms::BQS == 1)){ + ((castle_perms & CastlePerms::BQS) == CastlePerms::BQS)){ castle_perms -= CastlePerms::BQS; } } diff --git a/src/functions.cpp b/src/functions.cpp index fd438aa..0b193d3 100644 --- a/src/functions.cpp +++ b/src/functions.cpp @@ -136,7 +136,6 @@ void add_checked_flags(PieceType pt, std::array *board, std::vec void filter_checked_moves(PieceType pt, std::array *board, std::vector *pns){ PieceType my_king = is_white(pt)?PieceType::W_KING:PieceType::B_KING; int my_king_pos = get_pos_of(my_king, board); - int attackers = 0; bool remove_all_castles = false; for (auto p_pn= pns->begin(); p_pn!=pns->end();){ if (get_castle_flag(*p_pn) == 1){ @@ -148,6 +147,8 @@ void filter_checked_moves(PieceType pt, std::array *board, std:: ++p_pn; break; } + // TODO: Make this more effecient. + // There is no way in hell, this is as complicated as it seems. // If moved left // Queenside if ((get_from_sq(*p_pn) - get_to_sq(*p_pn)) > 0){