chore(Core/Player): Change player setting index type from uint8 to ui… (#22716)

This commit is contained in:
Andrew
2025-08-22 22:25:15 -03:00
committed by GitHub
parent c67d4efa4a
commit 82d98f9fb7
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -2641,8 +2641,8 @@ public:
std::string GetPlayerName(); std::string GetPlayerName();
// Settings // Settings
[[nodiscard]] PlayerSetting GetPlayerSetting(std::string const& source, uint8 index); [[nodiscard]] PlayerSetting GetPlayerSetting(std::string const& source, uint32 index);
void UpdatePlayerSetting(std::string const& source, uint8 index, uint32 value); void UpdatePlayerSetting(std::string const& source, uint32 index, uint32 value);
void SendSystemMessage(std::string_view msg, bool escapeCharacters = false); void SendSystemMessage(std::string_view msg, bool escapeCharacters = false);
@@ -80,7 +80,7 @@ namespace PlayerSettingsStore
return result; return result;
} }
void UpdateSetting(uint32 playerLowGuid, std::string const& source, uint8 index, uint32 value) void UpdateSetting(uint32 playerLowGuid, std::string const& source, uint32 index, uint32 value)
{ {
if (!sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED)) if (!sWorld->getBoolConfig(CONFIG_PLAYER_SETTINGS_ENABLED))
return; return;
@@ -129,7 +129,7 @@ void Player::_LoadCharacterSettings(PreparedQueryResult result)
} while (result->NextRow()); } while (result->NextRow());
} }
PlayerSetting Player::GetPlayerSetting(std::string const& source, uint8 index) PlayerSetting Player::GetPlayerSetting(std::string const& source, uint32 index)
{ {
auto it = m_charSettingsMap.find(source); auto it = m_charSettingsMap.find(source);
if (it == m_charSettingsMap.end() || static_cast<size_t>(index) >= it->second.size()) if (it == m_charSettingsMap.end() || static_cast<size_t>(index) >= it->second.size())
@@ -156,7 +156,7 @@ void Player::_SavePlayerSettings(CharacterDatabaseTransaction trans)
} }
} }
void Player::UpdatePlayerSetting(std::string const& source, uint8 index, uint32 value) void Player::UpdatePlayerSetting(std::string const& source, uint32 index, uint32 value)
{ {
auto it = m_charSettingsMap.find(source); auto it = m_charSettingsMap.find(source);
size_t const requiredSize = static_cast<size_t>(index) + 1; size_t const requiredSize = static_cast<size_t>(index) + 1;
@@ -57,7 +57,7 @@ namespace PlayerSettingsStore
{ {
// Update a single setting value for any player by GUID (works for online or offline players). // Update a single setting value for any player by GUID (works for online or offline players).
// This reads the existing "source" row from character_settings, adjusts the index, and REPLACE's it back. // This reads the existing "source" row from character_settings, adjusts the index, and REPLACE's it back.
void UpdateSetting(uint32 playerLowGuid, std::string const& source, uint8 index, uint32 value); void UpdateSetting(uint32 playerLowGuid, std::string const& source, uint32 index, uint32 value);
// Common helpers for parsing and serializing settings data // Common helpers for parsing and serializing settings data
PlayerSettingVector ParseSettingsData(std::string const& data); PlayerSettingVector ParseSettingsData(std::string const& data);