From 1af5acba3fff09f89b6c8ae69b7cfd8b3a543067 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 18 Mar 2026 08:49:16 -0700 Subject: [PATCH] fix: show real player names on nameplates instead of "Player" Player class declared its own 'name' member and getName()/setName() that shadowed the inherited Unit::name. Since getName() is non-virtual, code using Unit* pointers (nameplates, target frame, entity list) read Unit::name (always empty) while Player::setName() wrote to the shadowed Player::name. Removed the redundant declaration so Player inherits name storage from Unit. --- include/game/entity.hpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/include/game/entity.hpp b/include/game/entity.hpp index a05ff782..a608f6f5 100644 --- a/include/game/entity.hpp +++ b/include/game/entity.hpp @@ -284,18 +284,14 @@ protected: /** * Player entity + * Name is inherited from Unit — do NOT redeclare it here or the + * shadowed field will diverge from Unit::name, causing nameplates + * and other Unit*-based lookups to read an empty string. */ class Player : public Unit { public: Player() { type = ObjectType::PLAYER; } explicit Player(uint64_t guid) : Unit(guid) { type = ObjectType::PLAYER; } - - // Name - const std::string& getName() const { return name; } - void setName(const std::string& n) { name = n; } - -protected: - std::string name; }; /**