/// <summary> /// The line threatened by. /// </summary> /// <param name="player"> /// The player. /// </param> /// <param name="squares"> /// The squares. /// </param> /// <param name="squareStart"> /// The square start. /// </param> /// <param name="offset"> /// The offset. /// </param> public static void LineThreatenedBy(Player player, Squares squares, Square squareStart, int offset) { int intOrdinal = squareStart.Ordinal; Square square; intOrdinal += offset; while ((square = GetSquare(intOrdinal)) != null) { if (square.Piece == null) { squares.Add(square); } else if (square.Piece.Player.Colour != player.Colour && square.Piece.IsCapturable) { squares.Add(square); break; } else { break; } intOrdinal += offset; } }