aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/Map.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Maps/Map.h')
-rw-r--r--src/server/game/Maps/Map.h58
1 files changed, 54 insertions, 4 deletions
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 1e6f6d45b80..86310bdb67e 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -34,6 +34,7 @@
#include <bitset>
#include <list>
+#include <memory>
class Unit;
class WorldPacket;
@@ -444,10 +445,21 @@ class Map : public GridRefManager<NGridType>
TempSummon* SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties = NULL, uint32 duration = 0, Unit* summoner = NULL, uint32 spellId = 0, uint32 vehId = 0);
void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = NULL);
- Creature* GetCreature(ObjectGuid guid);
- GameObject* GetGameObject(ObjectGuid guid);
- Transport* GetTransport(ObjectGuid guid);
- DynamicObject* GetDynamicObject(ObjectGuid guid);
+ AreaTrigger* GetAreaTrigger(ObjectGuid const& guid);
+ Corpse* GetCorpse(ObjectGuid const& guid);
+ Creature* GetCreature(ObjectGuid const& guid);
+ DynamicObject* GetDynamicObject(ObjectGuid const& guid);
+ GameObject* GetGameObject(ObjectGuid const& guid);
+ Pet* GetPet(ObjectGuid const& guid);
+ Transport* GetTransport(ObjectGuid const& guid);
+
+ MapStoredObjectTypesContainer& GetObjectsStore() { return _objectsStore; }
+
+ typedef std::unordered_multimap<ObjectGuid::LowType, Creature*> CreatureBySpawnIdContainer;
+ CreatureBySpawnIdContainer& GetCreatureBySpawnIdStore() { return _creatureBySpawnIdStore; }
+
+ typedef std::unordered_multimap<ObjectGuid::LowType, GameObject*> GameObjectBySpawnIdContainer;
+ GameObjectBySpawnIdContainer& GetGameObjectBySpawnIdStore() { return _gameobjectBySpawnIdStore; }
MapInstanced* ToMapInstanced() { if (Instanceable()) return reinterpret_cast<MapInstanced*>(this); return NULL; }
MapInstanced const* ToMapInstanced() const { if (Instanceable()) return reinterpret_cast<MapInstanced const*>(this); return NULL; }
@@ -496,6 +508,8 @@ class Map : public GridRefManager<NGridType>
void RemoveGORespawnTime(ObjectGuid::LowType dbGuid);
void LoadRespawnTimes();
void DeleteRespawnTimes();
+ void LoadCorpseData();
+ void DeleteCorpseData();
static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId);
@@ -510,6 +524,23 @@ class Map : public GridRefManager<NGridType>
void UpdateAreaDependentAuras();
+ template<HighGuid high>
+ inline ObjectGuid::LowType GenerateLowGuid()
+ {
+ static_assert(ObjectGuidTraits<high>::MapSpecific, "Only map specific guid can be generated in Map context");
+ return GetGuidSequenceGenerator<high>().Generate();
+ }
+
+ void AddUpdateObject(Object* obj)
+ {
+ _updateObjects.insert(obj);
+ }
+
+ void RemoveUpdateObject(Object* obj)
+ {
+ _updateObjects.erase(obj);
+ }
+
private:
void LoadMapAndVMap(int gx, int gy);
void LoadVMap(int gx, int gy);
@@ -564,6 +595,8 @@ class Map : public GridRefManager<NGridType>
void UpdateActiveCells(const float &x, const float &y, const uint32 t_diff);
+ void SendObjectUpdates();
+
protected:
void SetUnloadReferenceLock(const GridCoord &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadReferenceLock(on); }
@@ -656,6 +689,23 @@ class Map : public GridRefManager<NGridType>
ZoneDynamicInfoMap _zoneDynamicInfo;
uint32 _defaultLight;
+
+ template<HighGuid high>
+ inline ObjectGuidGeneratorBase& GetGuidSequenceGenerator()
+ {
+ auto itr = _guidGenerators.find(high);
+ if (itr == _guidGenerators.end())
+ itr = _guidGenerators.insert(std::make_pair(high, std::unique_ptr<ObjectGuidGenerator<high>>(new ObjectGuidGenerator<high>()))).first;
+
+ return *itr->second;
+ }
+
+ std::map<HighGuid, std::unique_ptr<ObjectGuidGeneratorBase>> _guidGenerators;
+ MapStoredObjectTypesContainer _objectsStore;
+ CreatureBySpawnIdContainer _creatureBySpawnIdStore;
+ GameObjectBySpawnIdContainer _gameobjectBySpawnIdStore;
+
+ std::unordered_set<Object*> _updateObjects;
};
enum InstanceResetMethod