From ff34e052dc3596ceb52aacc7dc365b962b8acb7f Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 9 Jan 2024 12:48:25 +0100 Subject: [PATCH] Fix bug that would not allow a piece move if you tried to take an opponents piece. --- lib/chess_bloc/tap_bloc.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/chess_bloc/tap_bloc.dart b/lib/chess_bloc/tap_bloc.dart index 7e9e4cd..cf343f9 100644 --- a/lib/chess_bloc/tap_bloc.dart +++ b/lib/chess_bloc/tap_bloc.dart @@ -27,12 +27,12 @@ class TapBloc extends Bloc { ChessPiece? piece; if (ChessBloc.myColor != ChessBloc.turnColor) return; - if (event.pieceOnSquare != null && - ChessBloc.myColor != event.pieceOnSquare!.color) return; if (state.firstSquareTapped == null) { //first tap if (event.pieceOnSquare == null) return; + if (event.pieceOnSquare != null && + ChessBloc.myColor != event.pieceOnSquare!.color) return; firstTappedSquare = event.tapped; piece = event.pieceOnSquare; } else {