From 375abeb2bbf21e4da701d4d4ab32b56eba594695 Mon Sep 17 00:00:00 2001 From: Kieran Kihn <114803508+kierankihn@users.noreply.github.com> Date: Sun, 16 Nov 2025 22:06:42 +0800 Subject: [PATCH] fix(game): update `Player` constructor to take `std::string` by value instead of reference --- src/game/Player.cpp | 2 +- src/game/Player.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5921ea1..2495fe7 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -45,7 +45,7 @@ namespace UNO::GAME { return cards_.empty(); } - Player::Player(std::string &name) : name_(std::move(name)), handCard(nullptr) {} + Player::Player(std::string name) : name_(std::move(name)), handCard(nullptr) {} const std::string &Player::getName() const { diff --git a/src/game/Player.h b/src/game/Player.h index fe8f1ec..3801693 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -66,7 +66,7 @@ namespace UNO::GAME { public: HandCard *handCard; - explicit Player(std::string &name); + explicit Player(std::string name); /** * @return 返回玩家名字