fix(game): update Player constructor to take std::string by value instead of reference

This commit is contained in:
Kieran Kihn
2025-11-16 22:06:42 +08:00
parent 7740759f33
commit 375abeb2bb
2 changed files with 2 additions and 2 deletions

View File

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

View File

@@ -66,7 +66,7 @@ namespace UNO::GAME {
public:
HandCard *handCard;
explicit Player(std::string &name);
explicit Player(std::string name);
/**
* @return 返回玩家名字