summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2022-07-11 20:52:44 +0000
committerAndreas Kling <kling@serenityos.org>2022-07-12 23:11:35 +0200
commit6c46383e2397c73f59c14f6cdf0e27e054f529a0 (patch)
treed2fda70d84a7c6f7cccb9fa6010b2515803f8fef /Userland
parent7456904a398c62cb87349fb4b47dd3e507fd634e (diff)
downloadserenity-6c46383e2397c73f59c14f6cdf0e27e054f529a0.zip
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.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibChess/Chess.h7
1 files changed, 7 insertions, 0 deletions
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)