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

LibChess: Move inputs when creating chess Commands

This commit is contained in:
Sam Atkins 2023-04-21 15:52:17 +01:00 committed by Andreas Kling
parent 29c41e953b
commit 8529e660ca
2 changed files with 9 additions and 9 deletions

View file

@ -126,7 +126,7 @@ ErrorOr<NonnullOwnPtr<PositionCommand>> PositionCommand::from_string(StringView
for (size_t i = 3; i < tokens.size(); ++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

View file

@ -101,8 +101,8 @@ class SetOptionCommand : public Command {
public:
explicit SetOptionCommand(String name, Optional<String> value = {})
: Command(Command::Type::SetOption)
, m_name(name)
, m_value(value)
, m_name(move(name))
, m_value(move(value))
{
}
@ -120,10 +120,10 @@ private:
class PositionCommand : public Command {
public:
explicit PositionCommand(Optional<String> const& fen, Vector<Chess::Move> const& moves)
explicit PositionCommand(Optional<String> fen, Vector<Move> moves)
: Command(Command::Type::Position)
, m_fen(fen)
, m_moves(moves)
, m_fen(move(fen))
, m_moves(move(moves))
{
}
@ -186,7 +186,7 @@ public:
explicit IdCommand(Type field_type, String value)
: Command(Command::Type::Id)
, m_field_type(field_type)
, m_value(value)
, m_value(move(value))
{
}
@ -228,9 +228,9 @@ public:
class BestMoveCommand : public Command {
public:
explicit BestMoveCommand(Chess::Move const& move)
explicit BestMoveCommand(Chess::Move move)
: Command(Command::Type::BestMove)
, m_move(move)
, m_move(::move(move))
{
}