mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +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:
parent
7456904a39
commit
6c46383e23
1 changed files with 7 additions and 0 deletions
|
@ -57,7 +57,14 @@ constexpr Piece EmptyPiece = { Color::None, Type::None };
|
||||||
struct Square {
|
struct Square {
|
||||||
i8 rank; // zero indexed;
|
i8 rank; // zero indexed;
|
||||||
i8 file;
|
i8 file;
|
||||||
|
|
||||||
Square(StringView name);
|
Square(StringView name);
|
||||||
|
|
||||||
|
Square(char const name[3])
|
||||||
|
: Square({ name, 2 })
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Square(int const& rank, int const& file)
|
Square(int const& rank, int const& file)
|
||||||
: rank(rank)
|
: rank(rank)
|
||||||
, file(file)
|
, file(file)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue