mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
fix(Core): Fix indexing in UpdatePlayerSetting (#12375)
* fix(Core): Fix indexing in UpdatePlayerSetting * Fix integer signing
This commit is contained in:
@@ -108,12 +108,11 @@ void Player::_SavePlayerSettings(CharacterDatabaseTransaction trans)
|
|||||||
void Player::UpdatePlayerSetting(std::string source, uint8 index, uint32 value)
|
void Player::UpdatePlayerSetting(std::string source, uint8 index, uint32 value)
|
||||||
{
|
{
|
||||||
auto itr = m_charSettingsMap.find(source);
|
auto itr = m_charSettingsMap.find(source);
|
||||||
|
uint8 size = index + 1;
|
||||||
|
|
||||||
if (itr == m_charSettingsMap.end())
|
if (itr == m_charSettingsMap.end())
|
||||||
{
|
{
|
||||||
// Settings not found, initialize a new entry.
|
// Settings not found, initialize a new entry.
|
||||||
uint8 size = index ? index : index + 1;
|
|
||||||
|
|
||||||
PlayerSettingVector setting;
|
PlayerSettingVector setting;
|
||||||
setting.resize(size);
|
setting.resize(size);
|
||||||
|
|
||||||
@@ -129,6 +128,10 @@ void Player::UpdatePlayerSetting(std::string source, uint8 index, uint32 value)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (size > itr->second.size())
|
||||||
|
{
|
||||||
|
itr->second.resize(size);
|
||||||
|
}
|
||||||
itr->second[index].value = value;
|
itr->second[index].value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user