TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Map.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef TRINITY_MAP_H
20 #define TRINITY_MAP_H
21 
22 #include "Define.h"
23 
24 #include "DBCStructure.h"
25 #include "GridDefines.h"
26 #include "Cell.h"
27 #include "Timer.h"
28 #include "SharedDefines.h"
29 #include "GridRefManager.h"
30 #include "MapRefManager.h"
31 #include "DynamicTree.h"
32 #include "GameObjectModel.h"
33 #include "ObjectGuid.h"
34 
35 #include <bitset>
36 #include <list>
37 #include <memory>
38 
39 class Unit;
40 class WorldPacket;
41 class InstanceScript;
42 class Group;
43 class InstanceSave;
44 class Object;
45 class WorldObject;
46 class TempSummon;
47 class Player;
48 class CreatureGroup;
49 struct ScriptInfo;
50 struct ScriptAction;
51 struct Position;
52 class Battleground;
53 class MapInstanced;
54 class BattlegroundMap;
55 class InstanceMap;
56 class Transport;
57 enum WeatherState : uint32;
58 
59 namespace Trinity { struct ObjectUpdater; }
60 
62 {
66  ScriptInfo const* script;
67 };
68 
71 {
72  char asChar[4];
74 };
75 
76 // ******************************************
77 // Map file format defines
78 // ******************************************
80 {
92 };
93 
94 #define MAP_AREA_NO_AREA 0x0001
95 
97 {
101 };
102 
103 #define MAP_HEIGHT_NO_HEIGHT 0x0001
104 #define MAP_HEIGHT_AS_INT16 0x0002
105 #define MAP_HEIGHT_AS_INT8 0x0004
106 #define MAP_HEIGHT_HAS_FLIGHT_BOUNDS 0x0008
107 
109 {
112  float gridHeight;
114 };
115 
116 #define MAP_LIQUID_NO_TYPE 0x0001
117 #define MAP_LIQUID_NO_HEIGHT 0x0002
118 
120 {
128  float liquidLevel;
129 };
130 
132 {
133  LIQUID_MAP_NO_WATER = 0x00000000,
135  LIQUID_MAP_WATER_WALK = 0x00000002,
136  LIQUID_MAP_IN_WATER = 0x00000004,
138 };
139 
140 #define MAP_LIQUID_TYPE_NO_WATER 0x00
141 #define MAP_LIQUID_TYPE_WATER 0x01
142 #define MAP_LIQUID_TYPE_OCEAN 0x02
143 #define MAP_LIQUID_TYPE_MAGMA 0x04
144 #define MAP_LIQUID_TYPE_SLIME 0x08
145 
146 #define MAP_ALL_LIQUIDS (MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN | MAP_LIQUID_TYPE_MAGMA | MAP_LIQUID_TYPE_SLIME)
147 
148 #define MAP_LIQUID_TYPE_DARK_WATER 0x10
149 #define MAP_LIQUID_TYPE_WMO_WATER 0x20
150 
152 {
155  float level;
156  float depth_level;
157 };
158 
160 {
162  union{
163  float* m_V9;
166  };
167  union{
168  float* m_V8;
171  };
174  // Height level data
175  float _gridHeight;
177 
178  // Area data
180 
181  // Liquid data
185  float* _liquidMap;
192 
193 
194  bool loadAreaData(FILE* in, uint32 offset, uint32 size);
195  bool loadHeightData(FILE* in, uint32 offset, uint32 size);
196  bool loadLiquidData(FILE* in, uint32 offset, uint32 size);
197 
198  // Get height functions and pointers
199  typedef float (GridMap::*GetHeightPtr) (float x, float y) const;
200  GetHeightPtr _gridGetHeight;
201  float getHeightFromFloat(float x, float y) const;
202  float getHeightFromUint16(float x, float y) const;
203  float getHeightFromUint8(float x, float y) const;
204  float getHeightFromFlat(float x, float y) const;
205 
206 public:
207  GridMap();
208  ~GridMap();
209  bool loadData(const char* filename);
210  void unloadData();
211 
212  uint16 getArea(float x, float y) const;
213  inline float getHeight(float x, float y) const {return (this->*_gridGetHeight)(x, y);}
214  float getMinHeight(float x, float y) const;
215  float getLiquidLevel(float x, float y) const;
216  uint8 getTerrainType(float x, float y) const;
217  ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0);
218 };
219 
220 #pragma pack(push, 1)
221 
223 {
227 };
228 
230 {
232 };
233 
235 {
236  ZoneDynamicInfo();
237 
243 };
244 
245 #pragma pack(pop)
246 
247 #define MAX_HEIGHT 100000.0f // can be use for find ground height at surface
248 #define INVALID_HEIGHT -100000.0f // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE
249 #define MAX_FALL_DISTANCE 250000.0f // "unlimited fall" to find VMap ground if it is available, just larger than MAX_HEIGHT - INVALID_HEIGHT
250 #define DEFAULT_HEIGHT_SEARCH 50.0f // default search distance to find height at nearby locations
251 #define MIN_UNLOAD_DELAY 1 // immediate unload
252 
253 typedef std::map<ObjectGuid::LowType/*leaderDBGUID*/, CreatureGroup*> CreatureGroupHolderType;
254 
255 typedef std::unordered_map<uint32 /*zoneId*/, ZoneDynamicInfo> ZoneDynamicInfoMap;
256 
258 
259 class TC_GAME_API Map : public GridRefManager<NGridType>
260 {
261  friend class MapReference;
262  public:
263  Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent = NULL);
264  virtual ~Map();
265 
266  MapEntry const* GetEntry() const { return i_mapEntry; }
267 
268  // currently unused for normal maps
269  bool CanUnload(uint32 diff)
270  {
271  if (!m_unloadTimer)
272  return false;
273 
274  if (m_unloadTimer <= diff)
275  return true;
276 
277  m_unloadTimer -= diff;
278  return false;
279  }
280 
281  virtual bool AddPlayerToMap(Player* player, bool initPlayer = true);
282  virtual void RemovePlayerFromMap(Player*, bool);
283 
284  template<class T> bool AddToMap(T *);
285  template<class T> void RemoveFromMap(T *, bool);
286 
288  virtual void Update(const uint32);
289 
290  float GetVisibilityRange() const { return m_VisibleDistance; }
291  //function for setting up visibility distance for maps on per-type/per-Id basis
292  virtual void InitVisibilityDistance();
293 
294  void PlayerRelocation(Player*, float x, float y, float z, float orientation);
295  void CreatureRelocation(Creature* creature, float x, float y, float z, float ang, bool respawnRelocationOnFail = true);
296  void GameObjectRelocation(GameObject* go, float x, float y, float z, float orientation, bool respawnRelocationOnFail = true);
297  void DynamicObjectRelocation(DynamicObject* go, float x, float y, float z, float orientation);
298 
299  template<class T, class CONTAINER>
300  void Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor);
301 
302  bool IsRemovalGrid(float x, float y) const
303  {
305  return !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL;
306  }
307 
308  bool IsGridLoaded(float x, float y) const
309  {
310  return IsGridLoaded(Trinity::ComputeGridCoord(x, y));
311  }
312 
313  bool GetUnloadLock(const GridCoord &p) const { return getNGrid(p.x_coord, p.y_coord)->getUnloadLock(); }
314  void SetUnloadLock(const GridCoord &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadExplicitLock(on); }
315  void LoadGrid(float x, float y);
316  bool UnloadGrid(NGridType& ngrid, bool pForce);
317  virtual void UnloadAll();
318 
319  void ResetGridExpiry(NGridType &grid, float factor = 1) const
320  {
321  grid.ResetTimeTracker(time_t(float(i_gridExpiry)*factor));
322  }
323 
324  time_t GetGridExpiry(void) const { return i_gridExpiry; }
325  uint32 GetId(void) const { return i_mapEntry->ID; }
326 
327  static bool ExistMap(uint32 mapid, int gx, int gy);
328  static bool ExistVMap(uint32 mapid, int gx, int gy);
329 
330  static void InitStateMachine();
331  static void DeleteStateMachine();
332 
333  Map const* GetParent() const { return m_parentMap; }
334 
335  // some calls like isInWater should not use vmaps due to processor power
336  // can return INVALID_HEIGHT if under z+2 z coord not found height
337  float GetHeight(float x, float y, float z, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
338  float GetMinHeight(float x, float y) const;
339 
340  ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = nullptr) const;
341 
342  uint32 GetAreaId(float x, float y, float z, bool *isOutdoors) const;
343  bool GetAreaInfo(float x, float y, float z, uint32& mogpflags, int32& adtId, int32& rootId, int32& groupId) const;
344  uint32 GetAreaId(float x, float y, float z) const;
345  uint32 GetZoneId(float x, float y, float z) const;
346  void GetZoneAndAreaId(uint32& zoneid, uint32& areaid, float x, float y, float z) const;
347 
348  bool IsOutdoors(float x, float y, float z) const;
349 
350  uint8 GetTerrainType(float x, float y) const;
351  float GetWaterLevel(float x, float y) const;
352  bool IsInWater(float x, float y, float z, LiquidData* data = nullptr) const;
353  bool IsUnderWater(float x, float y, float z) const;
354 
355  void MoveAllCreaturesInMoveList();
356  void MoveAllGameObjectsInMoveList();
357  void MoveAllDynamicObjectsInMoveList();
358  void RemoveAllObjectsInRemoveList();
359  virtual void RemoveAllPlayers();
360 
361  // used only in MoveAllCreaturesInMoveList and ObjectGridUnloader
362  bool CreatureRespawnRelocation(Creature* c, bool diffGridOnly);
363  bool GameObjectRespawnRelocation(GameObject* go, bool diffGridOnly);
364 
365  // assert print helper
366  bool CheckGridIntegrity(Creature* c, bool moved) const;
367 
368  uint32 GetInstanceId() const { return i_InstanceId; }
369  uint8 GetSpawnMode() const { return (i_spawnMode); }
370 
372  {
373  CAN_ENTER = 0,
374  CANNOT_ENTER_ALREADY_IN_MAP = 1, // Player is already in the map
375  CANNOT_ENTER_NO_ENTRY, // No map entry was found for the target map ID
376  CANNOT_ENTER_UNINSTANCED_DUNGEON, // No instance template was found for dungeon map
377  CANNOT_ENTER_DIFFICULTY_UNAVAILABLE, // Requested instance difficulty is not available for target map
378  CANNOT_ENTER_NOT_IN_RAID, // Target instance is a raid instance and the player is not in a raid group
379  CANNOT_ENTER_CORPSE_IN_DIFFERENT_INSTANCE, // Player is dead and their corpse is not in target instance
380  CANNOT_ENTER_INSTANCE_BIND_MISMATCH, // Player's permanent instance save is not compatible with their group's current instance bind
381  CANNOT_ENTER_TOO_MANY_INSTANCES, // Player has entered too many instances recently
382  CANNOT_ENTER_MAX_PLAYERS, // Target map already has the maximum number of players allowed
383  CANNOT_ENTER_ZONE_IN_COMBAT, // A boss encounter is currently in progress on the target map
384  CANNOT_ENTER_UNSPECIFIED_REASON
385  };
386  virtual EnterState CannotEnter(Player* /*player*/) { return CAN_ENTER; }
387  const char* GetMapName() const;
388 
389  // have meaning only for instanced map (that have set real difficulty)
390  Difficulty GetDifficultyID() const { return Difficulty(GetSpawnMode()); }
391  MapDifficultyEntry const* GetMapDifficulty() const;
392  uint32 GetDifficultyLootBonusTreeMod() const;
393 
394  bool Instanceable() const { return i_mapEntry && i_mapEntry->Instanceable(); }
395  bool IsDungeon() const { return i_mapEntry && i_mapEntry->IsDungeon(); }
396  bool IsNonRaidDungeon() const { return i_mapEntry && i_mapEntry->IsNonRaidDungeon(); }
397  bool IsRaid() const { return i_mapEntry && i_mapEntry->IsRaid(); }
398  bool IsRaidOrHeroicDungeon() const { return IsRaid() || IsHeroic(); }
399  bool IsHeroic() const;
400  bool Is25ManRaid() const { return IsRaid() && (i_spawnMode == DIFFICULTY_25_N || i_spawnMode == DIFFICULTY_25_HC); } // since 25man difficulties are 1 and 3, we can check them like that
401  bool IsBattleground() const { return i_mapEntry && i_mapEntry->IsBattleground(); }
402  bool IsBattleArena() const { return i_mapEntry && i_mapEntry->IsBattleArena(); }
403  bool IsBattlegroundOrArena() const { return i_mapEntry && i_mapEntry->IsBattlegroundOrArena(); }
404  bool IsGarrison() const { return i_mapEntry && i_mapEntry->IsGarrison(); }
405  bool GetEntrancePos(int32 &mapid, float &x, float &y)
406  {
407  if (!i_mapEntry)
408  return false;
409  return i_mapEntry->GetEntrancePos(mapid, x, y);
410  }
411 
412  void AddObjectToRemoveList(WorldObject* obj);
413  void AddObjectToSwitchList(WorldObject* obj, bool on);
414  virtual void DelayedUpdate(const uint32 diff);
415 
416  void UpdateObjectVisibility(WorldObject* obj, Cell cell, CellCoord cellpair);
417  void UpdateObjectsVisibilityFor(Player* player, Cell cell, CellCoord cellpair);
418 
419  void resetMarkedCells() { marked_cells.reset(); }
420  bool isCellMarked(uint32 pCellId) { return marked_cells.test(pCellId); }
421  void markCell(uint32 pCellId) { marked_cells.set(pCellId); }
422 
423  bool HavePlayers() const { return !m_mapRefManager.isEmpty(); }
424  uint32 GetPlayersCountExceptGMs() const;
425  bool ActiveObjectsNearGrid(NGridType const& ngrid) const;
426 
427  void AddWorldObject(WorldObject* obj) { i_worldObjects.insert(obj); }
428  void RemoveWorldObject(WorldObject* obj) { i_worldObjects.erase(obj); }
429 
430  void SendToPlayers(WorldPacket const* data) const;
431 
433  PlayerList const& GetPlayers() const { return m_mapRefManager; }
434 
435  //per-map script storage
436  void ScriptsStart(std::map<uint32, std::multimap<uint32, ScriptInfo> > const& scripts, uint32 id, Object* source, Object* target);
437  void ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* source, Object* target);
438 
439  // must called with AddToWorld
440  template<class T>
441  void AddToActive(T* obj);
442 
443  // must called with RemoveFromWorld
444  template<class T>
445  void RemoveFromActive(T* obj);
446 
447  template<class T> void SwitchGridContainers(T* obj, bool on);
448  template<class NOTIFIER> void VisitAll(const float &x, const float &y, float radius, NOTIFIER &notifier);
449  template<class NOTIFIER> void VisitFirstFound(const float &x, const float &y, float radius, NOTIFIER &notifier);
450  template<class NOTIFIER> void VisitWorld(const float &x, const float &y, float radius, NOTIFIER &notifier);
451  template<class NOTIFIER> void VisitGrid(const float &x, const float &y, float radius, NOTIFIER &notifier);
453 
454  void UpdateIteratorBack(Player* player);
455 
456  TempSummon* SummonCreature(uint32 entry, Position const& pos, SummonPropertiesEntry const* properties = NULL, uint32 duration = 0, Unit* summoner = NULL, uint32 spellId = 0, uint32 vehId = 0);
457  void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = NULL);
458  AreaTrigger* GetAreaTrigger(ObjectGuid const& guid);
459  Corpse* GetCorpse(ObjectGuid const& guid);
460  Creature* GetCreature(ObjectGuid const& guid);
462  GameObject* GetGameObject(ObjectGuid const& guid);
463  Pet* GetPet(ObjectGuid const& guid);
464  Transport* GetTransport(ObjectGuid const& guid);
465 
466  MapStoredObjectTypesContainer& GetObjectsStore() { return _objectsStore; }
467 
468  typedef std::unordered_multimap<ObjectGuid::LowType, Creature*> CreatureBySpawnIdContainer;
469  CreatureBySpawnIdContainer& GetCreatureBySpawnIdStore() { return _creatureBySpawnIdStore; }
470 
471  typedef std::unordered_multimap<ObjectGuid::LowType, GameObject*> GameObjectBySpawnIdContainer;
472  GameObjectBySpawnIdContainer& GetGameObjectBySpawnIdStore() { return _gameobjectBySpawnIdStore; }
473 
474  std::unordered_set<Corpse*> const* GetCorpsesInCell(uint32 cellId) const
475  {
476  auto itr = _corpsesByCell.find(cellId);
477  if (itr != _corpsesByCell.end())
478  return &itr->second;
479 
480  return nullptr;
481  }
482 
483  Corpse* GetCorpseByPlayer(ObjectGuid const& ownerGuid) const
484  {
485  auto itr = _corpsesByPlayer.find(ownerGuid);
486  if (itr != _corpsesByPlayer.end())
487  return itr->second;
488 
489  return nullptr;
490  }
491 
492  MapInstanced* ToMapInstanced() { if (Instanceable()) return reinterpret_cast<MapInstanced*>(this); return NULL; }
493  MapInstanced const* ToMapInstanced() const { if (Instanceable()) return reinterpret_cast<MapInstanced const*>(this); return NULL; }
494 
495  InstanceMap* ToInstanceMap() { if (IsDungeon()) return reinterpret_cast<InstanceMap*>(this); else return NULL; }
496  InstanceMap const* ToInstanceMap() const { if (IsDungeon()) return reinterpret_cast<InstanceMap const*>(this); return NULL; }
497 
498  BattlegroundMap* ToBattlegroundMap() { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap*>(this); else return NULL; }
499  BattlegroundMap const* ToBattlegroundMap() const { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap const*>(this); return NULL; }
500 
501  float GetWaterOrGroundLevel(float x, float y, float z, float* ground = NULL, bool swim = false) const;
502  float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
503  bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const;
504  void Balance() { _dynamicTree.balance(); }
505  void RemoveGameObjectModel(const GameObjectModel& model) { _dynamicTree.remove(model); }
506  void InsertGameObjectModel(const GameObjectModel& model) { _dynamicTree.insert(model); }
507  bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);}
508  bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist);
509 
510  virtual ObjectGuid::LowType GetOwnerGuildId(uint32 /*team*/ = TEAM_OTHER) const { return UI64LIT(0); }
511  /*
512  RESPAWN TIMES
513  */
514  time_t GetLinkedRespawnTime(ObjectGuid guid) const;
516  {
517  std::unordered_map<ObjectGuid::LowType /*dbGUID*/, time_t>::const_iterator itr = _creatureRespawnTimes.find(dbGuid);
518  if (itr != _creatureRespawnTimes.end())
519  return itr->second;
520 
521  return time_t(0);
522  }
523 
525  {
526  std::unordered_map<ObjectGuid::LowType /*dbGUID*/, time_t>::const_iterator itr = _goRespawnTimes.find(dbGuid);
527  if (itr != _goRespawnTimes.end())
528  return itr->second;
529 
530  return time_t(0);
531  }
532 
533  void SaveCreatureRespawnTime(ObjectGuid::LowType dbGuid, time_t respawnTime);
534  void RemoveCreatureRespawnTime(ObjectGuid::LowType dbGuid);
535  void SaveGORespawnTime(ObjectGuid::LowType dbGuid, time_t respawnTime);
536  void RemoveGORespawnTime(ObjectGuid::LowType dbGuid);
537  void LoadRespawnTimes();
538  void DeleteRespawnTimes();
539 
540  void LoadCorpseData();
541  void DeleteCorpseData();
542  void AddCorpse(Corpse* corpse);
543  void RemoveCorpse(Corpse* corpse);
544  Corpse* ConvertCorpseToBones(ObjectGuid const& ownerGuid, bool insignia = false);
545  void RemoveOldCorpses();
546 
547  static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId);
548 
549  void SendInitTransports(Player* player);
550  void SendRemoveTransports(Player* player);
551  void SendUpdateTransportVisibility(Player* player, std::set<uint32> const& previousPhases);
552  void SendZoneDynamicInfo(Player* player);
553 
554  void SetZoneMusic(uint32 zoneId, uint32 musicId);
555  void SetZoneWeather(uint32 zoneId, WeatherState weatherId, float weatherGrade);
556  void SetZoneOverrideLight(uint32 zoneId, uint32 lightId, uint32 fadeInTime);
557 
558  void UpdateAreaDependentAuras();
559 
560  template<HighGuid high>
562  {
563  static_assert(ObjectGuidTraits<high>::MapSpecific, "Only map specific guid can be generated in Map context");
564  return GetGuidSequenceGenerator<high>().Generate();
565  }
566 
568  {
569  _updateObjects.insert(obj);
570  }
571 
573  {
574  _updateObjects.erase(obj);
575  }
576 
577  private:
578  void LoadMapAndVMap(int gx, int gy);
579  void LoadVMap(int gx, int gy);
580  void LoadMap(int gx, int gy, bool reload = false);
581  void LoadMMap(int gx, int gy);
582  GridMap* GetGrid(float x, float y);
583 
584  void SetTimer(uint32 t) { i_gridExpiry = t < MIN_GRID_DELAY ? MIN_GRID_DELAY : t; }
585 
586  void SendInitSelf(Player* player);
587 
588  bool CreatureCellRelocation(Creature* creature, Cell new_cell);
589  bool GameObjectCellRelocation(GameObject* go, Cell new_cell);
590  bool DynamicObjectCellRelocation(DynamicObject* go, Cell new_cell);
591 
592  template<class T> void InitializeObject(T* obj);
593  void AddCreatureToMoveList(Creature* c, float x, float y, float z, float ang);
594  void RemoveCreatureFromMoveList(Creature* c);
595  void AddGameObjectToMoveList(GameObject* go, float x, float y, float z, float ang);
596  void RemoveGameObjectFromMoveList(GameObject* go);
597  void AddDynamicObjectToMoveList(DynamicObject* go, float x, float y, float z, float ang);
598  void RemoveDynamicObjectFromMoveList(DynamicObject* go);
599 
601  std::vector<Creature*> _creaturesToMove;
602 
604  std::vector<GameObject*> _gameObjectsToMove;
605 
607  std::vector<DynamicObject*> _dynamicObjectsToMove;
608 
609  bool IsGridLoaded(const GridCoord &) const;
610  void EnsureGridCreated(const GridCoord &);
611  void EnsureGridCreated_i(const GridCoord &);
612  bool EnsureGridLoaded(Cell const&);
613  void EnsureGridLoadedForActiveObject(Cell const&, WorldObject* object);
614 
615  void buildNGridLinkage(NGridType* pNGridType) { pNGridType->link(this); }
616 
618  {
620  return i_grids[x][y];
621  }
622 
623  bool isGridObjectDataLoaded(uint32 x, uint32 y) const { return getNGrid(x, y)->isGridObjectDataLoaded(); }
624  void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y) { getNGrid(x, y)->setGridObjectDataLoaded(pLoaded); }
625 
626  void setNGrid(NGridType* grid, uint32 x, uint32 y);
627  void ScriptsProcess();
628 
629  void UpdateActiveCells(const float &x, const float &y, const uint32 t_diff);
630 
631  void SendObjectUpdates();
632 
633  protected:
634  void SetUnloadReferenceLock(const GridCoord &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadReferenceLock(on); }
635  virtual void LoadGridObjects(NGridType* grid, Cell const& cell);
636 
637  std::mutex _mapLock;
638  std::mutex _gridLock;
639 
646 
649 
651 
652  typedef std::set<WorldObject*> ActiveNonPlayers;
653  ActiveNonPlayers m_activeNonPlayers;
654  ActiveNonPlayers::iterator m_activeNonPlayersIter;
655 
656  // Objects that must update even in inactive grids without activating them
657  typedef std::set<Transport*> TransportsContainer;
658  TransportsContainer _transports;
659  TransportsContainer::iterator _transportsUpdateIter;
660 
661  private:
662  Player* _GetScriptPlayerSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo) const;
663  Creature* _GetScriptCreatureSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo, bool bReverse = false) const;
664  Unit* _GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const;
665  Player* _GetScriptPlayer(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const;
666  Creature* _GetScriptCreature(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const;
667  WorldObject* _GetScriptWorldObject(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const;
668  void _ScriptProcessDoor(Object* source, Object* target, const ScriptInfo* scriptInfo) const;
669  GameObject* _FindGameObject(WorldObject* pWorldObject, ObjectGuid::LowType guid) const;
670 
671  time_t i_gridExpiry;
672 
673  //used for fast base_map (e.g. MapInstanced class object) search for
674  //InstanceMaps and BattlegroundMaps...
676 
679  std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP*TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells;
680 
681  //these functions used to process player/mob aggro reactions and
682  //visibility calculations. Highly optimized for massive calculations
683  void ProcessRelocationNotifies(const uint32 diff);
684 
686  std::set<WorldObject*> i_objectsToRemove;
687  std::map<WorldObject*, bool> i_objectsToSwitch;
688  std::set<WorldObject*> i_worldObjects;
689 
690  typedef std::multimap<time_t, ScriptAction> ScriptScheduleMap;
691  ScriptScheduleMap m_scriptSchedule;
692 
693  // Type specific code for add/remove to/from grid
694  template<class T>
695  void AddToGrid(T* object, Cell const& cell);
696 
697  template<class T>
698  void DeleteFromWorld(T*);
699 
701  {
702  m_activeNonPlayers.insert(obj);
703  }
704 
706  {
707  // Map::Update for active object in proccess
708  if (m_activeNonPlayersIter != m_activeNonPlayers.end())
709  {
710  ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj);
711  if (itr == m_activeNonPlayers.end())
712  return;
713  if (itr == m_activeNonPlayersIter)
714  ++m_activeNonPlayersIter;
715  m_activeNonPlayers.erase(itr);
716  }
717  else
718  m_activeNonPlayers.erase(obj);
719  }
720 
721  std::unordered_map<ObjectGuid::LowType /*dbGUID*/, time_t> _creatureRespawnTimes;
722  std::unordered_map<ObjectGuid::LowType /*dbGUID*/, time_t> _goRespawnTimes;
723 
726 
727  template<HighGuid high>
729  {
730  auto itr = _guidGenerators.find(high);
731  if (itr == _guidGenerators.end())
732  itr = _guidGenerators.insert(std::make_pair(high, Trinity::make_unique<ObjectGuidGenerator<high>>())).first;
733 
734  return *itr->second;
735  }
736 
737  std::map<HighGuid, std::unique_ptr<ObjectGuidGeneratorBase>> _guidGenerators;
739  CreatureBySpawnIdContainer _creatureBySpawnIdStore;
740  GameObjectBySpawnIdContainer _gameobjectBySpawnIdStore;
741  std::unordered_map<uint32/*cellId*/, std::unordered_set<Corpse*>> _corpsesByCell;
742  std::unordered_map<ObjectGuid, Corpse*> _corpsesByPlayer;
743  std::unordered_set<Corpse*> _corpseBones;
744 
745  std::unordered_set<Object*> _updateObjects;
746 };
747 
749 {
756 };
757 
759 {
760  public:
761  InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent);
762  ~InstanceMap();
763  bool AddPlayerToMap(Player* player, bool initPlayer = true) override;
764  void RemovePlayerFromMap(Player*, bool) override;
765  void Update(const uint32) override;
766  void CreateInstanceData(bool load);
767  bool Reset(uint8 method);
768  uint32 GetScriptId() const { return i_script_id; }
769  InstanceScript* GetInstanceScript() { return i_data; }
770  void PermBindAllPlayers(Player* source);
771  void UnloadAll() override;
772  EnterState CannotEnter(Player* player) override;
773  void SendResetWarnings(uint32 timeLeft) const;
774  void SetResetSchedule(bool on);
775 
776  /* this checks if any players have a permanent bind (included reactivatable expired binds) to the instance ID
777  it needs a DB query, so use sparingly */
778  bool HasPermBoundPlayers() const;
779  uint32 GetMaxPlayers() const;
780  uint32 GetMaxResetDelay() const;
781 
782  virtual void InitVisibilityDistance() override;
783  private:
788 };
789 
791 {
792  public:
793  BattlegroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent, uint8 spawnMode);
794  ~BattlegroundMap();
795 
796  bool AddPlayerToMap(Player* player, bool initPlayer = true) override;
797  void RemovePlayerFromMap(Player*, bool) override;
798  EnterState CannotEnter(Player* player) override;
799  void SetUnload();
800  //void UnloadAll(bool pForce);
801  void RemoveAllPlayers() override;
802 
803  virtual void InitVisibilityDistance() override;
804  Battleground* GetBG() { return m_bg; }
805  void SetBG(Battleground* bg) { m_bg = bg; }
806  private:
808 };
809 
810 template<class T, class CONTAINER>
811 inline void Map::Visit(Cell const& cell, TypeContainerVisitor<T, CONTAINER>& visitor)
812 {
813  const uint32 x = cell.GridX();
814  const uint32 y = cell.GridY();
815  const uint32 cell_x = cell.CellX();
816  const uint32 cell_y = cell.CellY();
817 
818  if (!cell.NoCreate() || IsGridLoaded(GridCoord(x, y)))
819  {
820  EnsureGridLoaded(cell);
821  getNGrid(x, y)->VisitGrid(cell_x, cell_y, visitor);
822  }
823 }
824 
825 template<class NOTIFIER>
826 inline void Map::VisitAll(float const& x, float const& y, float radius, NOTIFIER& notifier)
827 {
829  Cell cell(p);
830  cell.SetNoCreate();
831 
832  TypeContainerVisitor<NOTIFIER, WorldTypeMapContainer> world_object_notifier(notifier);
833  cell.Visit(p, world_object_notifier, *this, radius, x, y);
834  TypeContainerVisitor<NOTIFIER, GridTypeMapContainer > grid_object_notifier(notifier);
835  cell.Visit(p, grid_object_notifier, *this, radius, x, y);
836 }
837 
838 // should be used with Searcher notifiers, tries to search world if nothing found in grid
839 template<class NOTIFIER>
840 inline void Map::VisitFirstFound(const float &x, const float &y, float radius, NOTIFIER &notifier)
841 {
843  Cell cell(p);
844  cell.SetNoCreate();
845 
846  TypeContainerVisitor<NOTIFIER, WorldTypeMapContainer> world_object_notifier(notifier);
847  cell.Visit(p, world_object_notifier, *this, radius, x, y);
848  if (!notifier.i_object)
849  {
850  TypeContainerVisitor<NOTIFIER, GridTypeMapContainer > grid_object_notifier(notifier);
851  cell.Visit(p, grid_object_notifier, *this, radius, x, y);
852  }
853 }
854 
855 template<class NOTIFIER>
856 inline void Map::VisitWorld(const float &x, const float &y, float radius, NOTIFIER &notifier)
857 {
859  Cell cell(p);
860  cell.SetNoCreate();
861 
862  TypeContainerVisitor<NOTIFIER, WorldTypeMapContainer> world_object_notifier(notifier);
863  cell.Visit(p, world_object_notifier, *this, radius, x, y);
864 }
865 
866 template<class NOTIFIER>
867 inline void Map::VisitGrid(const float &x, const float &y, float radius, NOTIFIER &notifier)
868 {
870  Cell cell(p);
871  cell.SetNoCreate();
872 
873  TypeContainerVisitor<NOTIFIER, GridTypeMapContainer > grid_object_notifier(notifier);
874  cell.Visit(p, grid_object_notifier, *this, radius, x, y);
875 }
876 #endif
void SetTimer(uint32 t)
Definition: Map.h:584
float * m_V9
Definition: Map.h:163
TC_GAME_API Pet * GetPet(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:179
Definition: Object.h:95
virtual ObjectGuid::LowType GetOwnerGuildId(uint32=TEAM_OTHER) const
Definition: Map.h:510
Definition: MapInstanced.h:28
Definition: NGrid.h:77
bool IsBattlegroundOrArena() const
Definition: Map.h:403
std::vector< GameObject * > _gameObjectsToMove
Definition: Map.h:604
Definition: Map.h:136
ScriptScheduleMap m_scriptSchedule
Definition: Map.h:691
BattlegroundMap * ToBattlegroundMap()
Definition: Map.h:498
#define MIN_GRID_DELAY
Definition: GridDefines.h:44
uint8 offsetY
Definition: Map.h:125
Difficulty
Definition: DBCEnums.h:402
Definition: Corpse.h:49
uint8 GetSpawnMode() const
Definition: Map.h:369
void AddToActiveHelper(WorldObject *obj)
Definition: Map.h:700
bool IsBattleground() const
Definition: Map.h:401
uint8 height
Definition: Map.h:127
bool EnsureGridLoaded(Cell const &)
Definition: Map.cpp:481
std::set< WorldObject * > i_objectsToRemove
Definition: Map.h:686
uint32 fourcc
Definition: Map.h:110
std::unordered_map< ObjectGuid, Corpse * > _corpsesByPlayer
Definition: Map.h:742
LevelRequirementVsMode
Definition: Map.h:229
float depth_level
Definition: Map.h:156
float WeatherGrade
Definition: Map.h:240
virtual void InitVisibilityDistance()
Definition: Map.cpp:253
Definition: TypeContainerVisitor.h:32
Definition: TemporarySummon.h:40
virtual void RemovePlayerFromMap(Player *, bool)
Definition: Map.cpp:872
MapEntry const * i_mapEntry
Definition: Map.h:640
float _gridIntHeightMultiplier
Definition: Map.h:176
Definition: Map.h:222
bool isCellMarked(uint32 pCellId)
Definition: Map.h:420
uint16 flags
Definition: Map.h:122
uint32 areaMapSize
Definition: Map.h:85
bool GetEntrancePos(int32 &mapid, float &x, float &y)
Definition: Map.h:405
float m_VisibleDistance
Definition: Map.h:644
InstanceScript * i_data
Definition: Map.h:786
time_t i_gridExpiry
Definition: Map.h:671
void RemoveUpdateObject(Object *obj)
Definition: Map.h:572
std::unordered_map< uint32, ZoneDynamicInfo > ZoneDynamicInfoMap
Definition: Map.h:255
uint8 _liquidHeight
Definition: Map.h:191
uint32 CellY() const
Definition: Cell.h:75
Definition: Map.h:752
std::map< HighGuid, std::unique_ptr< ObjectGuidGeneratorBase > > _guidGenerators
Definition: Map.h:737
std::unordered_map< ObjectGuid::LowType, time_t > _creatureRespawnTimes
Definition: Map.h:721
std::multimap< time_t, ScriptAction > ScriptScheduleMap
Definition: Map.h:690
bool IsRaid() const
Definition: Map.h:397
TransportsContainer _transports
Definition: Map.h:658
Map * m_parentMap
Definition: Map.h:675
Definition: Map.h:234
Definition: ObjectGuid.h:372
std::unique_ptr< T > make_unique(Args &&...args)
std::make_unique implementation (TODO: remove this once C++14 is supported)
Definition: Common.h:176
Definition: Map.h:753
Difficulty GetDifficultyID() const
Definition: Map.h:390
Definition: Map.h:159
Definition: Map.h:151
std::bitset< TOTAL_NUMBER_OF_CELLS_PER_MAP *TOTAL_NUMBER_OF_CELLS_PER_MAP > marked_cells
Definition: Map.h:679
Definition: Map.h:378
float gridMaxHeight
Definition: Map.h:113
uint8 _liquidOffX
Definition: Map.h:188
uint8 offsetX
Definition: Map.h:124
ScriptInfo const * script
owner of source if source is item
Definition: Map.h:66
MapRefManager PlayerList
Definition: Map.h:432
NGridType * getNGrid(uint32 x, uint32 y) const
Definition: Map.h:617
Definition: Map.h:750
void ResetTimeTracker(time_t interval)
Definition: NGrid.h:119
Battleground * GetBG()
Definition: Map.h:804
std::unordered_map< uint32, std::unordered_set< Corpse * > > _corpsesByCell
Definition: Map.h:741
bool IsGarrison() const
Definition: Map.h:404
ObjectGuid ownerGUID
Definition: Map.h:65
GridCoord ComputeGridCoord(float x, float y)
Definition: GridDefines.h:188
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
std::map< WorldObject *, bool > i_objectsToSwitch
Definition: Map.h:687
void SetBG(Battleground *bg)
Definition: Map.h:805
int16 * _minHeight
Definition: Map.h:173
TC_GAME_API DynamicObject * GetDynamicObject(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:153
Definition: Map.h:754
#define UI64LIT(N)
Definition: Define.h:138
uint16 _gridArea
Definition: Map.h:186
Definition: DBCStructure.h:830
uint32 flags
Definition: Map.h:111
Definition: Map.h:134
Definition: Map.h:96
uint32 fourcc
Definition: Map.h:121
void RemoveGameObjectModel(const GameObjectModel &model)
Definition: Map.h:505
Definition: Map.h:231
#define MAX_NUMBER_OF_GRIDS
Definition: GridDefines.h:37
arena_t NULL
Definition: jemalloc_internal.h:624
GetHeightPtr _gridGetHeight
Definition: Map.h:200
TransportsContainer::iterator _transportsUpdateIter
Definition: Map.h:659
Definition: ObjectGuid.h:357
Definition: Transport.h:28
bool Is25ManRaid() const
Definition: Map.h:400
bool IsDungeon() const
Definition: Map.h:395
uint32 areaMapOffset
Definition: Map.h:84
MapInstanced const * ToMapInstanced() const
Definition: Map.h:493
Definition: ObjectMgr.h:182
void SetUnloadReferenceLock(const GridCoord &p, bool on)
Definition: Map.h:634
void SetNoCreate()
Definition: Cell.h:79
Definition: Object.h:423
void RemoveWorldObject(WorldObject *obj)
Definition: Map.h:428
Definition: Creature.h:467
uint32 y_coord
Definition: GridDefines.h:156
ZoneDynamicInfo()
Definition: Map.cpp:55
bool ContainsGameObjectModel(const GameObjectModel &model) const
Definition: Map.h:507
bool IsGridLoaded(float x, float y) const
Definition: Map.h:308
uint32 x_coord
Definition: GridDefines.h:155
uint16 gridArea
Definition: Map.h:100
uint64 LowType
Definition: ObjectGuid.h:199
Battleground * m_bg
Definition: Map.h:807
uint8 i_spawnMode
Definition: Map.h:641
#define DEFAULT_HEIGHT_SEARCH
Definition: Map.h:250
uint32 i_script_id
Definition: Map.h:787
TypeUnorderedMapContainer< AllMapStoredObjectTypes, ObjectGuid > MapStoredObjectTypesContainer
Definition: Map.h:257
ActiveNonPlayers m_activeNonPlayers
Definition: Map.h:653
bool i_scriptLock
Definition: Map.h:685
uint16 liquidType
Definition: Map.h:123
time_t GetGORespawnTime(ObjectGuid::LowType dbGuid) const
Definition: Map.h:524
Definition: DynamicTree.h:34
char asChar[4]
Definition: Map.h:72
uint16 * _areaMap
Definition: Map.h:179
uint8 width
Definition: Map.h:126
TC_GAME_API Transport * GetTransport(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:148
bool CanUnload(uint32 diff)
Definition: Map.h:269
void RemoveFromActiveHelper(WorldObject *obj)
Definition: Map.h:705
uint32 MusicId
Definition: Map.h:238
ObjectGuidGeneratorBase & GetGuidSequenceGenerator()
Definition: Map.h:728
TC_GAME_API AreaTrigger * GetAreaTrigger(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:158
uint32 asUInt
Non-null terminated string
Definition: Map.h:73
std::vector< DynamicObject * > _dynamicObjectsToMove
Definition: Map.h:607
float liquidLevel
Definition: Map.h:128
bool _gameObjectsToMoveLock
Definition: Map.h:603
uint8 * m_uint8_V8
Definition: Map.h:170
Definition: DynamicObject.h:35
uint32 GetId(void) const
Definition: Map.h:325
float * m_V8
Definition: Map.h:168
Corpse * GetCorpseByPlayer(ObjectGuid const &ownerGuid) const
Definition: Map.h:483
uint32 LightFadeInTime
Definition: Map.h:242
bool isGridObjectDataLoaded(uint32 x, uint32 y) const
Definition: Map.h:623
Definition: ObjectGuid.h:114
Definition: Map.h:79
Definition: Map.h:119
ZoneDynamicInfoMap _zoneDynamicInfo
Definition: Map.h:724
uint32 heightMapOffset
Definition: Map.h:86
void markCell(uint32 pCellId)
Definition: Map.h:421
Definition: Map.h:758
bool m_resetAfterUnload
Definition: Map.h:784
uint8 * m_uint8_V9
Definition: Map.h:165
Definition: CreatureGroups.h:56
void resetMarkedCells()
Definition: Map.h:419
uint32 m_unloadTimer
Definition: Map.h:643
BattlegroundMap const * ToBattlegroundMap() const
Definition: Map.h:499
Definition: GridReference.h:25
void VisitFirstFound(const float &x, const float &y, float radius, NOTIFIER &notifier)
Definition: Map.h:840
Definition: Map.h:790
uint32 Parent
Definition: Map.h:224
Definition: Map.h:375
Definition: NGrid.h:66
void VisitGrid(const uint32 x, const uint32 y, TypeContainerVisitor< T, TypeMapContainer< TT > > &visitor)
Definition: NGrid.h:155
std::unordered_multimap< ObjectGuid::LowType, Creature * > CreatureBySpawnIdContainer
Definition: Map.h:468
float getHeight(float x, float y) const
Definition: Map.h:213
uint32 holesOffset
Definition: Map.h:90
uint16 _liquidType
Definition: Map.h:187
std::set< WorldObject * > ActiveNonPlayers
Definition: Map.h:652
G3D::int16 z
Definition: Vector3int16.h:46
uint32 CellX() const
Definition: Cell.h:74
std::unordered_set< Corpse * > _corpseBones
Definition: Map.h:743
std::map< ObjectGuid::LowType, CreatureGroup * > CreatureGroupHolderType
Definition: Map.h:253
float level
Definition: Map.h:155
CreatureGroupHolderType CreatureGroupHolder
Definition: Map.h:452
uint8 _liquidOffY
Definition: Map.h:189
InstanceMap * ToInstanceMap()
Definition: Map.h:495
int32_t int32
Definition: Define.h:146
ObjectGuid targetGUID
Definition: Map.h:64
CreatureBySpawnIdContainer _creatureBySpawnIdStore
Definition: Map.h:739
uint32_t uint32
Definition: Define.h:150
TC_GAME_API Corpse * GetCorpse(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:138
MapEntry const * GetEntry() const
Definition: Map.h:266
G3D::int16 y
Definition: Vector2int16.h:38
uint16_t uint16
Definition: Define.h:151
ZLiquidStatus
Definition: Map.h:131
Definition: GridDefines.h:89
Definition: DBCEnums.h:408
Definition: GameObject.h:880
Definition: Map.h:135
uint32 GridY() const
Definition: Cell.h:77
void SetUnloadLock(const GridCoord &p, bool on)
Definition: Map.h:314
uint32 type_flags
Definition: Map.h:153
float _gridHeight
Definition: Map.h:175
bool HavePlayers() const
Definition: Map.h:423
uint32 liquidMapOffset
Definition: Map.h:88
std::set< Transport * > TransportsContainer
Definition: Map.h:657
std::unordered_map< ObjectGuid::LowType, time_t > _goRespawnTimes
Definition: Map.h:722
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:466
Definition: DBCEnums.h:410
void VisitAll(const float &x, const float &y, float radius, NOTIFIER &notifier)
Definition: Map.h:826
Definition: Map.h:259
uint16 * m_uint16_V8
Definition: Map.h:169
std::set< WorldObject * > i_worldObjects
Definition: Map.h:688
virtual void Update(const uint32)
Definition: Map.cpp:682
uint32 entry
Definition: Map.h:154
uint32 liquidMapSize
Definition: Map.h:89
Definition: InstanceSaveMgr.h:44
void Balance()
Definition: Map.h:504
float GetVisibilityRange() const
Definition: Map.h:290
uint16 flags
Definition: Map.h:99
bool IsNonRaidDungeon() const
Definition: Map.h:396
ObjectGuid sourceGUID
Definition: Map.h:63
bool _dynamicObjectsToMoveLock
Definition: Map.h:606
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
uint32 ScriptId
Definition: Map.h:225
virtual void RemoveAllPlayers()
Definition: Map.cpp:1597
bool AllowMount
Definition: Map.h:226
DynamicMapTree _dynamicTree
Definition: Map.h:645
float gridHeight
Definition: Map.h:112
void buildNGridLinkage(NGridType *pNGridType)
Definition: Map.h:615
uint32 heightMapSize
Definition: Map.h:87
Definition: SharedDefines.h:1006
std::mutex _mapLock
Definition: Map.h:637
PlayerList const & GetPlayers() const
Definition: Map.h:433
Definition: Cell.h:49
Definition: Map.h:382
Definition: GameObjectModel.h:50
virtual void UnloadAll()
Definition: Map.cpp:1614
InstanceScript * GetInstanceScript()
Definition: Map.h:769
Definition: MapRefManager.h:26
ActiveNonPlayers::iterator m_activeNonPlayersIter
Definition: Map.h:654
void Visit(const Cell &cell, TypeContainerVisitor< T, CONTAINER > &visitor)
Definition: Map.h:811
int32 m_VisibilityNotifyPeriod
Definition: Map.h:650
Definition: DBCStructure.h:885
uint16 * m_uint16_V9
Definition: Map.h:164
uint32 fourcc
Definition: Map.h:98
#define TC_GAME_API
Definition: Define.h:134
InstanceMap const * ToInstanceMap() const
Definition: Map.h:496
std::unordered_set< Object * > _updateObjects
Definition: Map.h:745
uint32 i_InstanceId
Definition: Map.h:642
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:143
uint32 GetScriptId() const
Definition: Map.h:768
InstanceResetMethod
Definition: Map.h:748
CreatureBySpawnIdContainer & GetCreatureBySpawnIdStore()
Definition: Map.h:469
GameObjectBySpawnIdContainer & GetGameObjectBySpawnIdStore()
Definition: Map.h:472
Definition: InstanceScript.h:141
uint8_t uint8
Definition: Define.h:152
Definition: Position.h:27
void link(GridRefManager< NGrid< N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES > > *pTo)
Definition: NGrid.h:105
bool NoCreate() const
Definition: Cell.h:78
#define ASSERT
Definition: Errors.h:55
bool Instanceable() const
Definition: Map.h:394
u_map_magic mapMagic
Definition: Map.h:81
Definition: Map.h:755
uint32 _flags
Definition: Map.h:161
bool IsBattleArena() const
Definition: Map.h:402
void VisitWorld(const float &x, const float &y, float radius, NOTIFIER &notifier)
Definition: Map.h:856
Definition: Battleground.h:235
EnterState
Definition: Map.h:371
bool GetUnloadLock(const GridCoord &p) const
Definition: Map.h:313
int16_t int16
Definition: Define.h:147
float _liquidLevel
Definition: Map.h:182
Definition: ObjectGuid.h:189
void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y)
Definition: Map.h:624
uint32_t uint32
Definition: g3dmath.h:168
Definition: Common.h:172
#define const
Definition: zconf.h:217
MapInstanced * ToMapInstanced()
Definition: Map.h:492
void AddWorldObject(WorldObject *obj)
Definition: Map.h:427
G3D::int16 x
Definition: Vector2int16.h:37
uint32 OverrideLightId
Definition: Map.h:241
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:561
GameObjectBySpawnIdContainer _gameobjectBySpawnIdStore
Definition: Map.h:740
bool IsRemovalGrid(float x, float y) const
Definition: Map.h:302
MapRefManager::iterator m_mapRefIter
Definition: Map.h:648
virtual bool AddPlayerToMap(Player *player, bool initPlayer=true)
Definition: Map.cpp:513
bool IsRaidOrHeroicDungeon() const
Definition: Map.h:398
void VisitGrid(const float &x, const float &y, float radius, NOTIFIER &notifier)
Definition: Map.h:867
MapStoredObjectTypesContainer _objectsStore
Definition: Map.h:738
virtual EnterState CannotEnter(Player *)
Definition: Map.h:386
std::mutex _gridLock
Definition: Map.h:638
Definition: Map.h:137
time_t GetGridExpiry(void) const
Definition: Map.h:324
std::unordered_multimap< ObjectGuid::LowType, GameObject * > GameObjectBySpawnIdContainer
Definition: Map.h:471
Represents a map magic value of 4 bytes (used in versions)
Definition: Map.h:70
time_t GetCreatureRespawnTime(ObjectGuid::LowType dbGuid) const
Definition: Map.h:515
Definition: Map.h:61
Definition: Unit.h:1305
void ResetGridExpiry(NGridType &grid, float factor=1) const
Definition: Map.h:319
std::unordered_set< Corpse * > const * GetCorpsesInCell(uint32 cellId) const
Definition: Map.h:474
bool m_unloadWhenEmpty
Definition: Map.h:785
Map const * GetParent() const
Definition: Map.h:333
std::vector< Creature * > _creaturesToMove
Definition: Map.h:601
MapRefManager m_mapRefManager
Definition: Map.h:647
void InsertGameObjectModel(const GameObjectModel &model)
Definition: Map.h:506
uint32 GetInstanceId() const
Definition: Map.h:368
void Visit(CellCoord const &, TypeContainerVisitor< T, CONTAINER > &visitor, Map &, WorldObject const &, float) const
Definition: CellImpl.h:122
Definition: WorldPacket.h:26
WeatherState
Definition: Weather.h:46
CoordPair< MAX_NUMBER_OF_GRIDS > GridCoord
Definition: GridDefines.h:171
uint32 holesSize
Definition: Map.h:91
u_map_magic buildMagic
Definition: Map.h:83
void AddUpdateObject(Object *obj)
Definition: Map.h:567
WeatherState WeatherId
Definition: Map.h:239
uint8 _liquidWidth
Definition: Map.h:190
Definition: Pet.h:46
void Update(uint32 diff)
Definition: WeatherMgr.cpp:150
uint32 _defaultLight
Definition: Map.h:725
uint32 GridX() const
Definition: Cell.h:76
Definition: Group.h:191
Definition: AreaTrigger.h:26
u_map_magic versionMagic
Definition: Map.h:82
bool _creatureToMoveLock
Definition: Map.h:600
Definition: Map.h:133
uint8 * _liquidFlags
Definition: Map.h:184
uint16 * _liquidEntry
Definition: Map.h:183
Definition: Map.h:108
Definition: DBCStructure.h:1242
float * _liquidMap
Definition: Map.h:185
int16 * _maxHeight
Definition: Map.h:172
Definition: MapReference.h:25