aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorn0n4m3 <none@none>2009-12-26 11:38:30 +0100
committern0n4m3 <none@none>2009-12-26 11:38:30 +0100
commit2fa14abf42ab4a094405b5407b39faaf018d9072 (patch)
tree3f5e67b7416caf617c84a4391d2431839c2b1df1
parent25c28cae98c519a267c3a00002f649e26874dfb0 (diff)
Move some grid object functions into one parent class
--HG-- branch : trunk
-rw-r--r--src/game/Corpse.h5
-rw-r--r--src/game/Creature.h5
-rw-r--r--src/game/DynamicObject.h5
-rw-r--r--src/game/GameObject.h6
-rw-r--r--src/game/Object.h9
-rw-r--r--src/game/Player.h4
6 files changed, 14 insertions, 20 deletions
diff --git a/src/game/Corpse.h b/src/game/Corpse.h
index e0374a03470..e9088e17b8b 100644
--- a/src/game/Corpse.h
+++ b/src/game/Corpse.h
@@ -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
diff --git a/src/game/Creature.h b/src/game/Creature.h
index 6470af4bb71..b3e3a8a4555 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -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
diff --git a/src/game/DynamicObject.h b/src/game/DynamicObject.h
index 89b227e64ff..11cf030a6c6 100644
--- a/src/game/DynamicObject.h
+++ b/src/game/DynamicObject.h
@@ -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
diff --git a/src/game/GameObject.h b/src/game/GameObject.h
index 358af95a9be..8d378d5a96f 100644
--- a/src/game/GameObject.h
+++ b/src/game/GameObject.h
@@ -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
diff --git a/src/game/Object.h b/src/game/Object.h
index 93cf0d40e85..684e542335d 100644
--- a/src/game/Object.h
+++ b/src/game/Object.h
@@ -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:
diff --git a/src/game/Player.h b/src/game/Player.h
index db6e72b5768..cdc19d47408 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -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();