From 5023b411f91fe6194cfc9782c572c0bc4f857ac3 Mon Sep 17 00:00:00 2001 From: Ramon Bernardo Date: Mon, 29 Nov 2021 02:00:41 -0300 Subject: [PATCH] Moved player name length to a config and raised it to 25 (#3760) --- src/game.cpp | 4 ++-- src/game.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index f0f60eaede..c76c9589e7 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -487,7 +487,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; } @@ -3250,7 +3250,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; } diff --git a/src/game.h b/src/game.h index 71bc7e4aba..348a21106b 100644 --- a/src/game.h +++ b/src/game.h @@ -41,6 +41,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;