diff options
author | megamage <none@none> | 2009-05-31 21:04:04 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-31 21:04:04 -0500 |
commit | 76e4dfe8dda50e61dd2ca5a9a241f14d8823cfeb (patch) | |
tree | c0975adb9df19c04f2cd26baa17ba1cff3760139 /src | |
parent | 5034078d49f9a29d9a7e7d891b12d1706ddab44a (diff) |
*Store creatureData and goData for creatures and gos.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Creature.cpp | 6 | ||||
-rw-r--r-- | src/game/Creature.h | 2 | ||||
-rw-r--r-- | src/game/GameObject.cpp | 11 | ||||
-rw-r--r-- | src/game/GameObject.h | 4 | ||||
-rw-r--r-- | src/game/Object.cpp | 1 | ||||
-rw-r--r-- | src/game/Object.h | 2 |
6 files changed, 11 insertions, 15 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 72d7f0212d5..76bc87cf470 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -140,6 +140,7 @@ m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_A m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_creatureInfo(NULL), m_reactState(REACT_AGGRESSIVE), m_formation(NULL), m_summonMask(SUMMON_MASK_NONE) , m_AlreadySearchedAssistance(false) +, m_creatureData(NULL) { m_regenTimer = 200; m_valuesCount = UNIT_END; @@ -1532,8 +1533,7 @@ bool Creature::LoadFromDB(uint32 guid, Map *map) // checked at creature_template loading m_defaultMovementType = MovementGeneratorType(data->movementType); - if(!data->dbData) - SetInternallyAdded(); + m_creatureData = data; return true; } @@ -2082,7 +2082,7 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction / void Creature::SaveRespawnTime() { - if(isSummon() || !m_DBTableGuid || m_isInternallyAdded) + if(isSummon() || !m_DBTableGuid || m_creatureData && !m_creatureData->dbData) return; if(m_respawnTime > time(NULL)) // dead (no corpse) diff --git a/src/game/Creature.h b/src/game/Creature.h index be62ad66493..76072f124d9 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -579,6 +579,7 @@ class TRINITY_DLL_SPEC Creature : public Unit TrainerSpellData const* GetTrainerSpells() const; CreatureInfo const *GetCreatureInfo() const { return m_creatureInfo; } + CreatureData const *GetCreatureData() const { return m_creatureData; } CreatureDataAddon const* GetCreatureAddon() const; std::string GetAIName() const; @@ -777,6 +778,7 @@ class TRINITY_DLL_SPEC Creature : public Unit GridReference<Creature> m_gridRef; CreatureInfo const* m_creatureInfo; // in heroic mode can different from ObjMgr::GetCreatureTemplate(GetEntry()) + CreatureData const* m_creatureData; }; class AssistDelayEvent : public BasicEvent diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index ea848e95a52..da6ab1ef12d 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -57,6 +57,7 @@ GameObject::GameObject() : WorldObject(), m_goValue(new GameObjectValue) m_charges = 5; m_cooldownTime = 0; m_goInfo = NULL; + m_goData = NULL; m_DBTableGuid = 0; } @@ -628,8 +629,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) } } - if(!data->dbData) - SetInternallyAdded(); + m_goData = data; return true; } @@ -647,11 +647,6 @@ GameObject* GameObject::GetGameObject(WorldObject& object, uint64 guid) return object.GetMap()->GetGameObject(guid); } -GameObjectInfo const *GameObject::GetGOInfo() const -{ - return m_goInfo; -} - uint32 GameObject::GetLootId(GameObjectInfo const* ginfo) { if (!ginfo) @@ -710,7 +705,7 @@ Unit* GameObject::GetOwner() const void GameObject::SaveRespawnTime() { - if(!m_isInternallyAdded && m_respawnTime > time(NULL) && m_spawnedByDefault) + if(m_goData && m_goData->dbData && m_respawnTime > time(NULL) && m_spawnedByDefault) objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime); } diff --git a/src/game/GameObject.h b/src/game/GameObject.h index e1693e0bdbe..7e42d0684c4 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -471,7 +471,8 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 ArtKit = 0); void Update(uint32 p_time); static GameObject* GetGameObject(WorldObject& object, uint64 guid); - GameObjectInfo const* GetGOInfo() const; + GameObjectInfo const* GetGOInfo() const { return m_goInfo; } + GameObjectData const* GetGOData() const { return m_goData; } bool IsTransport() const; @@ -663,6 +664,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid GameObjectInfo const* m_goInfo; + GameObjectData const* m_goData; GameObjectValue * const m_goValue; private: void SwitchDoorOrButton(bool activate, bool alternative = false); diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 8dd558ca42c..8c8c5772da7 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1070,7 +1070,6 @@ WorldObject::WorldObject() m_positionX(0.0f), m_positionY(0.0f), m_positionZ(0.0f), m_orientation(0.0f) , m_map(NULL), m_zoneScript(NULL) , m_isActive(false), IsTempWorldObject(false) - , m_isInternallyAdded(false) , m_name("") { } diff --git a/src/game/Object.h b/src/game/Object.h index d710e34ef36..50533e4a509 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -548,7 +548,6 @@ class TRINITY_DLL_SPEC WorldObject : public Object bool isActiveObject() const { return m_isActive; } void setActive(bool isActiveObject); - void SetInternallyAdded() { m_isInternallyAdded = true; } void SetWorldObject(bool apply); template<class NOTIFIER> void VisitNearbyObject(const float &radius, NOTIFIER ¬ifier) const { GetMap()->VisitAll(GetPositionX(), GetPositionY(), radius, notifier); } template<class NOTIFIER> void VisitNearbyGridObject(const float &radius, NOTIFIER ¬ifier) const { GetMap()->VisitGrid(GetPositionX(), GetPositionY(), radius, notifier); } @@ -567,7 +566,6 @@ class TRINITY_DLL_SPEC WorldObject : public Object explicit WorldObject(); std::string m_name; bool m_isActive; - bool m_isInternallyAdded; ZoneScript *m_zoneScript; private: |