From 6c46383e2397c73f59c14f6cdf0e27e054f529a0 Mon Sep 17 00:00:00 2001 From: sin-ack Date: Mon, 11 Jul 2022 20:52:44 +0000 Subject: [PATCH] LibChess: Add convenience constructor for Chess::Square It didn't feel right to add sv suffixes to 2-character strings, so I added this convenience constructor. --- Userland/Libraries/LibChess/Chess.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Userland/Libraries/LibChess/Chess.h b/Userland/Libraries/LibChess/Chess.h index c73bdc5cce..a67e173a93 100644 --- a/Userland/Libraries/LibChess/Chess.h +++ b/Userland/Libraries/LibChess/Chess.h @@ -57,7 +57,14 @@ constexpr Piece EmptyPiece = { Color::None, Type::None }; struct Square { i8 rank; // zero indexed; i8 file; + Square(StringView name); + + Square(char const name[3]) + : Square({ name, 2 }) + { + } + Square(int const& rank, int const& file) : rank(rank) , file(file)