aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp13
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h3
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp7
3 files changed, 11 insertions, 12 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index d60ffaf1efe..46291efdb8b 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -51,6 +51,7 @@ GameObject::GameObject() : WorldObject(false), MapObject(),
m_cooldownTime = 0;
m_prevGoState = GO_STATE_ACTIVE;
m_goInfo = nullptr;
+ m_goTemplateAddon = nullptr;
m_goData = nullptr;
m_packedRotation = 0;
@@ -216,6 +217,7 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
Object::_Create(guidlow, goinfo->entry, HighGuid::GameObject);
m_goInfo = goinfo;
+ m_goTemplateAddon = sObjectMgr->GetGameObjectTemplateAddon(name_id);
if (goinfo->type >= MAX_GAMEOBJECT_TYPE)
{
@@ -235,10 +237,10 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
SetObjectScale(goinfo->size);
- if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
+ if (m_goTemplateAddon)
{
- SetUInt32Value(GAMEOBJECT_FACTION, addon->faction);
- SetUInt32Value(GAMEOBJECT_FLAGS, addon->flags);
+ SetUInt32Value(GAMEOBJECT_FACTION, m_goTemplateAddon->faction);
+ SetUInt32Value(GAMEOBJECT_FLAGS, m_goTemplateAddon->flags);
}
SetEntry(goinfo->entry);
@@ -681,11 +683,6 @@ void GameObject::Update(uint32 diff)
sScriptMgr->OnGameObjectUpdate(this, diff);
}
-GameObjectTemplateAddon const* GameObject::GetTemplateAddon() const
-{
- return sObjectMgr->GetGameObjectTemplateAddon(GetGOInfo()->entry);
-}
-
void GameObject::Refresh()
{
// Do not refresh despawned GO from spellcast (GO's from spellcast are destroyed after despawn)
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 1270d8f231a..842d5400fb2 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -687,7 +687,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, uint32 phaseMask, Position const& pos, G3D::Quat const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0);
void Update(uint32 p_time) override;
GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
- GameObjectTemplateAddon const* GetTemplateAddon() const;
+ GameObjectTemplateAddon const* GetTemplateAddon() const { return m_goTemplateAddon; }
GameObjectData const* GetGOData() const { return m_goData; }
GameObjectValue const* GetGOValue() const { return &m_goValue; }
@@ -914,6 +914,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
ObjectGuid::LowType m_spawnId; ///< For new or temporary gameobjects is 0 for saved it is lowguid
GameObjectTemplate const* m_goInfo;
+ GameObjectTemplateAddon const* m_goTemplateAddon;
GameObjectData const* m_goData;
GameObjectValue m_goValue;
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 991f1d06723..da9c713d5a9 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -64,6 +64,7 @@ bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid,
}
m_goInfo = goinfo;
+ m_goTemplateAddon = sObjectMgr->GetGameObjectTemplateAddon(entry);
TransportTemplate const* tInfo = sTransportMgr->GetTransportTemplate(entry);
if (!tInfo)
@@ -80,10 +81,10 @@ bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid,
_triggeredArrivalEvent = false;
_triggeredDepartureEvent = false;
- if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
+ if (m_goTemplateAddon)
{
- SetFaction(addon->faction);
- SetUInt32Value(GAMEOBJECT_FLAGS, addon->flags);
+ SetFaction(m_goTemplateAddon->faction);
+ SetUInt32Value(GAMEOBJECT_FLAGS, m_goTemplateAddon->flags);
}
m_goValue.Transport.PathProgress = 0;