فهرست منبع

LibChess: Move inputs when creating chess Commands

Sam Atkins 2 سال پیش
والد
کامیت
8529e660ca
2فایلهای تغییر یافته به همراه9 افزوده شده و 9 حذف شده
  1. 1 1
      Userland/Libraries/LibChess/UCICommand.cpp
  2. 8 8
      Userland/Libraries/LibChess/UCICommand.h

+ 1 - 1
Userland/Libraries/LibChess/UCICommand.cpp

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

+ 8 - 8
Userland/Libraries/LibChess/UCICommand.h

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