Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config for length player name #3760

Merged
merged 4 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ Player* Game::getPlayerByGUID(const uint32_t& guid)
ReturnValue Game::getPlayerByNameWildcard(const std::string& s, Player*& player)
{
size_t strlen = s.length();
if (strlen == 0 || strlen > 20) {
if (strlen == 0 || strlen > PLAYER_NAME_LENGTH) {
return RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE;
}

Expand Down Expand Up @@ -3228,7 +3228,7 @@ void Game::playerSetFightModes(uint32_t playerId, fightMode_t fightMode, bool ch

void Game::playerRequestAddVip(uint32_t playerId, const std::string& name)
{
if (name.length() > 20) {
if (name.length() > PLAYER_NAME_LENGTH) {
return;
}

Expand Down
2 changes: 2 additions & 0 deletions src/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ enum GameState_t {
GAME_STATE_MAINTAIN,
};

static constexpr int32_t PLAYER_NAME_LENGTH = 25;

static constexpr int32_t EVENT_LIGHTINTERVAL = 10000;
static constexpr int32_t EVENT_WORLDTIMEINTERVAL = 2500;
static constexpr int32_t EVENT_DECAYINTERVAL = 250;
Expand Down