mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-24 15:40:28 -04:00
Core/Entities: Fixed m_stringIds[0] invalidation when reloading creature_template with a gm command
(cherry picked from commit bec5bdb61b)
This commit is contained in:
@@ -811,7 +811,7 @@ void SetControlZoneValue::Execute(GameObjectTypeBase& type) const
|
||||
}
|
||||
|
||||
GameObject::GameObject() : WorldObject(false), MapObject(),
|
||||
m_model(nullptr), m_goValue(), m_AI(nullptr), m_respawnCompatibilityMode(false), _animKitId(0), _worldEffectID(0)
|
||||
m_model(nullptr), m_goValue(), m_stringIds(), m_AI(nullptr), m_respawnCompatibilityMode(false), _animKitId(0), _worldEffectID(0)
|
||||
{
|
||||
m_objectType |= TYPEMASK_GAMEOBJECT;
|
||||
m_objectTypeId = TYPEID_GAMEOBJECT;
|
||||
@@ -1158,7 +1158,7 @@ bool GameObject::Create(uint32 entry, Map* map, Position const& pos, QuaternionD
|
||||
|
||||
LastUsedScriptID = GetGOInfo()->ScriptId;
|
||||
|
||||
m_stringIds[AsUnderlyingType(StringIdType::Template)] = goInfo->StringId;
|
||||
m_stringIds[AsUnderlyingType(StringIdType::Template)] = &goInfo->StringId;
|
||||
|
||||
AIM_Initialize();
|
||||
|
||||
@@ -1978,7 +1978,7 @@ bool GameObject::LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap
|
||||
|
||||
m_goData = data;
|
||||
|
||||
m_stringIds[AsUnderlyingType(StringIdType::Spawn)] = data->StringId;
|
||||
m_stringIds[AsUnderlyingType(StringIdType::Spawn)] = &data->StringId;
|
||||
|
||||
if (addToMap && !GetMap()->AddToMap(this))
|
||||
return false;
|
||||
@@ -3494,7 +3494,7 @@ void GameObject::InheritStringIds(GameObject const* parent)
|
||||
|
||||
bool GameObject::HasStringId(std::string_view id) const
|
||||
{
|
||||
return std::find(m_stringIds.begin(), m_stringIds.end(), id) != m_stringIds.end();
|
||||
return std::ranges::any_of(m_stringIds, [id](std::string const* stringId) { return stringId && *stringId == id; });
|
||||
}
|
||||
|
||||
void GameObject::SetScriptStringId(std::string id)
|
||||
@@ -3502,12 +3502,12 @@ void GameObject::SetScriptStringId(std::string id)
|
||||
if (!id.empty())
|
||||
{
|
||||
m_scriptStringId.emplace(std::move(id));
|
||||
m_stringIds[AsUnderlyingType(StringIdType::Script)] = *m_scriptStringId;
|
||||
m_stringIds[AsUnderlyingType(StringIdType::Script)] = &*m_scriptStringId;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_scriptStringId.reset();
|
||||
m_stringIds[AsUnderlyingType(StringIdType::Script)] = {};
|
||||
m_stringIds[AsUnderlyingType(StringIdType::Script)] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user