diff options
| author | Shauren <shauren.trinity@gmail.com> | 2013-10-16 18:37:29 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2013-10-16 18:37:29 +0200 |
| commit | ce55647c415b710c6b440d96c2f26ebbc06c1d6e (patch) | |
| tree | 515af245894c37aa76c590b6e602eb4e398d68be /src/server/game/Maps/Map.h | |
| parent | 53cc37bceca9ce7de1b9839251ccc809ebf768b6 (diff) | |
Core/Transports
* Rewritten path generation, now uses splines - timers are a lot more accurate now
* Implemented stopping transports
* Implemented spawning transports in instances
* Implemented spawning gameobjects as transport passengers
* Transport passengers are now stored in creature/gameobject table using gameobject_template.data6 from transport's template as map id
Diffstat (limited to 'src/server/game/Maps/Map.h')
| -rw-r--r-- | src/server/game/Maps/Map.h | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 3deeb4e04b1..c57f7d36bc6 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -52,6 +52,7 @@ struct Position; class Battleground; class MapInstanced; class InstanceMap; +class Transport; namespace Trinity { struct ObjectUpdater; } struct ScriptAction @@ -278,6 +279,7 @@ class Map : public GridRefManager<NGridType> void PlayerRelocation(Player*, float x, float y, float z, float orientation); void CreatureRelocation(Creature* creature, float x, float y, float z, float ang, bool respawnRelocationOnFail = true); + void GameObjectRelocation(GameObject* go, float x, float y, float z, float orientation, bool respawnRelocationOnFail = true); template<class T, class CONTAINER> void Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor); @@ -350,11 +352,13 @@ class Map : public GridRefManager<NGridType> } void MoveAllCreaturesInMoveList(); + void MoveAllGameObjectsInMoveList(); void RemoveAllObjectsInRemoveList(); virtual void RemoveAllPlayers(); // used only in MoveAllCreaturesInMoveList and ObjectGridUnloader bool CreatureRespawnRelocation(Creature* c, bool diffGridOnly); + bool GameObjectRespawnRelocation(GameObject* go, bool diffGridOnly); // assert print helper bool CheckGridIntegrity(Creature* c, bool moved) const; @@ -415,17 +419,13 @@ class Map : public GridRefManager<NGridType> // must called with AddToWorld template<class T> - void AddToActive(T* obj) { AddToActiveHelper(obj); } - - void AddToActive(Creature* obj); + void AddToActive(T* obj); // must called with RemoveFromWorld template<class T> - void RemoveFromActive(T* obj) { RemoveFromActiveHelper(obj); } - - void RemoveFromActive(Creature* obj); + void RemoveFromActive(T* obj); - void SwitchGridContainers(Creature* creature, bool toWorldContainer); + template<class T> void SwitchGridContainers(T* obj, bool on); template<class NOTIFIER> void VisitAll(const float &x, const float &y, float radius, NOTIFIER ¬ifier); template<class NOTIFIER> void VisitFirstFound(const float &x, const float &y, float radius, NOTIFIER ¬ifier); template<class NOTIFIER> void VisitWorld(const float &x, const float &y, float radius, NOTIFIER ¬ifier); @@ -438,6 +438,7 @@ class Map : public GridRefManager<NGridType> void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = NULL); Creature* GetCreature(uint64 guid); GameObject* GetGameObject(uint64 guid); + Transport* GetTransport(uint64 guid); DynamicObject* GetDynamicObject(uint64 guid); MapInstanced* ToMapInstanced(){ if (Instanceable()) return reinterpret_cast<MapInstanced*>(this); else return NULL; } @@ -485,6 +486,9 @@ class Map : public GridRefManager<NGridType> static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId); + void SendInitTransports(Player* player); + void SendRemoveTransports(Player* player); + private: void LoadMapAndVMap(int gx, int gy); void LoadVMap(int gx, int gy); @@ -496,18 +500,21 @@ class Map : public GridRefManager<NGridType> void SendInitSelf(Player* player); - void SendInitTransports(Player* player); - void SendRemoveTransports(Player* player); - bool CreatureCellRelocation(Creature* creature, Cell new_cell); + bool GameObjectCellRelocation(GameObject* go, Cell new_cell); template<class T> void InitializeObject(T* obj); void AddCreatureToMoveList(Creature* c, float x, float y, float z, float ang); void RemoveCreatureFromMoveList(Creature* c); + void AddGameObjectToMoveList(GameObject* go, float x, float y, float z, float ang); + void RemoveGameObjectFromMoveList(GameObject* go); bool _creatureToMoveLock; std::vector<Creature*> _creaturesToMove; + bool _gameObjectsToMoveLock; + std::vector<GameObject*> _gameObjectsToMove; + bool IsGridLoaded(const GridCoord &) const; void EnsureGridCreated(const GridCoord &); void EnsureGridCreated_i(const GridCoord &); @@ -516,9 +523,6 @@ class Map : public GridRefManager<NGridType> void buildNGridLinkage(NGridType* pNGridType) { pNGridType->link(this); } - template<class T> void AddType(T *obj); - template<class T> void RemoveType(T *obj, bool); - NGridType* getNGrid(uint32 x, uint32 y) const { ASSERT(x < MAX_NUMBER_OF_GRIDS && y < MAX_NUMBER_OF_GRIDS); @@ -555,6 +559,11 @@ class Map : public GridRefManager<NGridType> ActiveNonPlayers m_activeNonPlayers; ActiveNonPlayers::iterator m_activeNonPlayersIter; + // Objects that must update even in inactive grids without activating them + typedef std::set<Transport*> TransportsContainer; + TransportsContainer _transports; + TransportsContainer::iterator _transportsUpdateIter; + private: Player* _GetScriptPlayerSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo) const; Creature* _GetScriptCreatureSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo, bool bReverse = false) const; @@ -589,10 +598,10 @@ class Map : public GridRefManager<NGridType> // Type specific code for add/remove to/from grid template<class T> - void AddToGrid(T* object, Cell const& cell); + void AddToGrid(T* object, Cell const& cell); template<class T> - void DeleteFromWorld(T*); + void DeleteFromWorld(T*); template<class T> void AddToActiveHelper(T* obj) |
