31 std::array<char, k_maxLen + 1>
name{};
36 void set(
const char* src)
43 for (; i <
k_maxLen && src[i] !=
'\0'; ++i)
49 [[nodiscard]]
const char*
c_str()
const {
return name.data(); }
52 [[nodiscard]]
bool empty()
const {
return name[0] ==
'\0'; }
55static_assert(std::is_trivially_copyable_v<PlayerName>,
56 "PlayerName must stay trivially copyable for the existing snapshot serializer.");
Replicated player display name.
Definition PlayerName.hpp:28
static constexpr std::size_t k_maxLen
Definition PlayerName.hpp:29
void set(const char *src)
Copy a NUL-terminated source into the bounded buffer.
Definition PlayerName.hpp:36
bool isCustom
True once the player picks their own name.
Definition PlayerName.hpp:32
std::array< char, k_maxLen+1 > name
NUL-terminated UTF-8. All zeros = unset.
Definition PlayerName.hpp:31
const char * c_str() const
Read the name as a C string. Always NUL-terminated.
Definition PlayerName.hpp:49
bool empty() const
Whether this nickname slot has any text in it.
Definition PlayerName.hpp:52