Move some grid object functions into one parent class
--HG-- branch : trunk
This commit is contained in:
+1
-4
@@ -48,7 +48,7 @@ enum CorpseFlags
|
||||
CORPSE_FLAG_LOOTABLE = 0x20
|
||||
};
|
||||
|
||||
class Corpse : public WorldObject
|
||||
class Corpse : public WorldObject, public GridObject<Corpse>
|
||||
{
|
||||
public:
|
||||
explicit Corpse( CorpseType type = CORPSE_BONES );
|
||||
@@ -88,10 +88,7 @@ class Corpse : public WorldObject
|
||||
void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); }
|
||||
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); }
|
||||
|
||||
GridReference<Corpse> &GetGridRef() { return m_gridRef; }
|
||||
private:
|
||||
GridReference<Corpse> m_gridRef;
|
||||
|
||||
CorpseType m_type;
|
||||
time_t m_time;
|
||||
GridPair m_grid; // gride for corpse position for fast search
|
||||
|
||||
+1
-4
@@ -397,7 +397,7 @@ typedef std::map<uint32,time_t> CreatureSpellCooldowns;
|
||||
|
||||
#define MAX_VENDOR_ITEMS 150 // Limitation in 3.x.x item count in SMSG_LIST_INVENTORY
|
||||
|
||||
class TRINITY_DLL_SPEC Creature : public Unit
|
||||
class TRINITY_DLL_SPEC Creature : public Unit, public GridObject<Creature>
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -607,7 +607,6 @@ class TRINITY_DLL_SPEC Creature : public Unit
|
||||
bool hasQuest(uint32 quest_id) const;
|
||||
bool hasInvolvedQuest(uint32 quest_id) const;
|
||||
|
||||
GridReference<Creature> &GetGridRef() { return m_gridRef; }
|
||||
bool isRegeneratingHealth() { return m_regenHealth; }
|
||||
virtual uint8 GetPetAutoSpellSize() const { return CREATURE_MAX_SPELLS; }
|
||||
virtual uint32 GetPetAutoSpellOnPos(uint8 pos) const
|
||||
@@ -711,8 +710,6 @@ class TRINITY_DLL_SPEC Creature : public Unit
|
||||
|
||||
//Formation var
|
||||
CreatureGroup *m_formation;
|
||||
|
||||
GridReference<Creature> m_gridRef;
|
||||
};
|
||||
|
||||
class AssistDelayEvent : public BasicEvent
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
class Unit;
|
||||
struct SpellEntry;
|
||||
|
||||
class DynamicObject : public WorldObject
|
||||
class DynamicObject : public WorldObject, public GridObject<DynamicObject>
|
||||
{
|
||||
public:
|
||||
typedef std::set<Unit*> AffectedSet;
|
||||
@@ -58,7 +58,6 @@ class DynamicObject : public WorldObject
|
||||
void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); }
|
||||
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); }
|
||||
|
||||
GridReference<DynamicObject> &GetGridRef() { return m_gridRef; }
|
||||
protected:
|
||||
uint32 m_spellId;
|
||||
uint32 m_effMask;
|
||||
@@ -66,7 +65,5 @@ class DynamicObject : public WorldObject
|
||||
uint32 m_updateTimer;
|
||||
float m_radius;
|
||||
AffectedSet m_affected;
|
||||
private:
|
||||
GridReference<DynamicObject> m_gridRef;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -581,7 +581,7 @@ class Unit;
|
||||
// 5 sec for bobber catch
|
||||
#define FISHING_BOBBER_READY_TIME 5
|
||||
|
||||
class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
class TRINITY_DLL_SPEC GameObject : public WorldObject, public GridObject<GameObject>
|
||||
{
|
||||
public:
|
||||
explicit GameObject();
|
||||
@@ -722,8 +722,6 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
|
||||
GameObject* LookupFishingHoleAround(float range);
|
||||
|
||||
GridReference<GameObject> &GetGridRef() { return m_gridRef; }
|
||||
|
||||
void CastSpell(Unit *target, uint32 spell);
|
||||
void SendCustomAnim();
|
||||
bool IsInRange(float x, float y, float z, float radius) const;
|
||||
@@ -759,7 +757,5 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
uint16 m_LootMode; // bitmask, default DEFAULT_LOOT_MODE, determines what loot will be lootable
|
||||
private:
|
||||
void SwitchDoorOrButton(bool activate, bool alternative = false);
|
||||
|
||||
GridReference<GameObject> m_gridRef;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -448,6 +448,15 @@ class WorldLocation : public Position
|
||||
uint32 m_mapId;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class GridObject
|
||||
{
|
||||
public:
|
||||
GridReference<T> &GetGridRef() { return m_gridRef; }
|
||||
protected:
|
||||
GridReference<T> m_gridRef;
|
||||
};
|
||||
|
||||
class TRINITY_DLL_SPEC WorldObject : public Object, public WorldLocation
|
||||
{
|
||||
public:
|
||||
|
||||
+1
-3
@@ -960,7 +960,7 @@ struct BGData
|
||||
bool HasTaxiPath() const { return taxiPath[0] && taxiPath[1]; }
|
||||
};
|
||||
|
||||
class TRINITY_DLL_SPEC Player : public Unit
|
||||
class TRINITY_DLL_SPEC Player : public Unit, public GridObject<Player>
|
||||
{
|
||||
friend class WorldSession;
|
||||
friend void Item::AddToUpdateQueueOf(Player *player);
|
||||
@@ -2238,7 +2238,6 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); }
|
||||
void SetOriginalGroup(Group *group, int8 subgroup = -1);
|
||||
|
||||
GridReference<Player> &GetGridRef() { return m_gridRef; }
|
||||
MapReference &GetMapRef() { return m_mapRef; }
|
||||
|
||||
// Set map to player and add reference
|
||||
@@ -2531,7 +2530,6 @@ Spell * m_spellModTakingSpell;
|
||||
m_DelayedOperations |= operation;
|
||||
}
|
||||
|
||||
GridReference<Player> m_gridRef;
|
||||
MapReference m_mapRef;
|
||||
|
||||
void UpdateCharmedAI();
|
||||
|
||||
Reference in New Issue
Block a user