1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:34:59 +00:00

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.
This commit is contained in:
sin-ack 2022-07-11 20:52:44 +00:00 committed by Andreas Kling
parent 7456904a39
commit 6c46383e23

View file

@ -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)