mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
LibChess: Move inputs when creating chess Commands
This commit is contained in:
parent
29c41e953b
commit
8529e660ca
2 changed files with 9 additions and 9 deletions
|
@ -126,7 +126,7 @@ ErrorOr<NonnullOwnPtr<PositionCommand>> PositionCommand::from_string(StringView
|
||||||
for (size_t i = 3; i < tokens.size(); ++i) {
|
for (size_t i = 3; i < tokens.size(); ++i) {
|
||||||
TRY(moves.try_append(Move(tokens[i])));
|
TRY(moves.try_append(Move(tokens[i])));
|
||||||
}
|
}
|
||||||
return adopt_nonnull_own_or_enomem(new (nothrow) PositionCommand(fen, moves));
|
return adopt_nonnull_own_or_enomem(new (nothrow) PositionCommand(move(fen), move(moves)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> PositionCommand::to_string() const
|
ErrorOr<String> PositionCommand::to_string() const
|
||||||
|
|
|
@ -101,8 +101,8 @@ class SetOptionCommand : public Command {
|
||||||
public:
|
public:
|
||||||
explicit SetOptionCommand(String name, Optional<String> value = {})
|
explicit SetOptionCommand(String name, Optional<String> value = {})
|
||||||
: Command(Command::Type::SetOption)
|
: Command(Command::Type::SetOption)
|
||||||
, m_name(name)
|
, m_name(move(name))
|
||||||
, m_value(value)
|
, m_value(move(value))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,10 +120,10 @@ private:
|
||||||
|
|
||||||
class PositionCommand : public Command {
|
class PositionCommand : public Command {
|
||||||
public:
|
public:
|
||||||
explicit PositionCommand(Optional<String> const& fen, Vector<Chess::Move> const& moves)
|
explicit PositionCommand(Optional<String> fen, Vector<Move> moves)
|
||||||
: Command(Command::Type::Position)
|
: Command(Command::Type::Position)
|
||||||
, m_fen(fen)
|
, m_fen(move(fen))
|
||||||
, m_moves(moves)
|
, m_moves(move(moves))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ public:
|
||||||
explicit IdCommand(Type field_type, String value)
|
explicit IdCommand(Type field_type, String value)
|
||||||
: Command(Command::Type::Id)
|
: Command(Command::Type::Id)
|
||||||
, m_field_type(field_type)
|
, m_field_type(field_type)
|
||||||
, m_value(value)
|
, m_value(move(value))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,9 +228,9 @@ public:
|
||||||
|
|
||||||
class BestMoveCommand : public Command {
|
class BestMoveCommand : public Command {
|
||||||
public:
|
public:
|
||||||
explicit BestMoveCommand(Chess::Move const& move)
|
explicit BestMoveCommand(Chess::Move move)
|
||||||
: Command(Command::Type::BestMove)
|
: Command(Command::Type::BestMove)
|
||||||
, m_move(move)
|
, m_move(::move(move))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue