diff options
Diffstat (limited to 'src/server/game/Maps/Map.h')
| -rw-r--r-- | src/server/game/Maps/Map.h | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 20551da8a0..21226c54a9 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -1,14 +1,14 @@ /* * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the - * Free Software Foundation; either version 3 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along @@ -23,6 +23,7 @@ #include "DataMap.h" #include "Define.h" #include "DynamicTree.h" +#include "EventProcessor.h" #include "GameObjectModel.h" #include "GridDefines.h" #include "GridRefMgr.h" @@ -33,7 +34,6 @@ #include "PathGenerator.h" #include "Position.h" #include "SharedDefines.h" -#include "TaskScheduler.h" #include "Timer.h" #include "GridTerrainData.h" #include <bitset> @@ -172,7 +172,7 @@ public: // currently unused for normal maps bool CanUnload(uint32 diff) { - if (!m_unloadTimer) + if (!m_unloadTimer || Events.HasEvents()) return false; if (m_unloadTimer <= diff) @@ -243,8 +243,8 @@ public: [[nodiscard]] float GetMinHeight(float x, float y) const; Transport* GetTransportForPos(uint32 phase, float x, float y, float z, WorldObject* worldobject = nullptr); - void GetFullTerrainStatusForPosition(uint32 phaseMask, float x, float y, float z, float collisionHeight, PositionFullTerrainStatus& data, uint8 reqLiquidType = MAP_ALL_LIQUIDS); - LiquidData const GetLiquidData(uint32 phaseMask, float x, float y, float z, float collisionHeight, uint8 ReqLiquidType); + void GetFullTerrainStatusForPosition(uint32 phaseMask, float x, float y, float z, float collisionHeight, PositionFullTerrainStatus& data, Optional<uint8> reqLiquidType = {}); + LiquidData const GetLiquidData(uint32 phaseMask, float x, float y, float z, float collisionHeight, Optional<uint8> ReqLiquidType); [[nodiscard]] bool GetAreaInfo(uint32 phaseMask, float x, float y, float z, uint32& mogpflags, int32& adtId, int32& rootId, int32& groupId) const; [[nodiscard]] uint32 GetAreaId(uint32 phaseMask, float x, float y, float z) const; @@ -338,12 +338,12 @@ public: GameObject* SummonGameObject(uint32 entry, Position const& pos, float rotation0 = 0.0f, float rotation1 = 0.0f, float rotation2 = 0.0f, float rotation3 = 0.0f, uint32 respawnTime = 100, bool checkTransport = true); void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = nullptr); - Corpse* GetCorpse(ObjectGuid const guid); - Creature* GetCreature(ObjectGuid const guid); - GameObject* GetGameObject(ObjectGuid const guid); - Transport* GetTransport(ObjectGuid const guid); - DynamicObject* GetDynamicObject(ObjectGuid const guid); - Pet* GetPet(ObjectGuid const guid); + Corpse* GetCorpse(ObjectGuid const& guid); + Creature* GetCreature(ObjectGuid const& guid); + GameObject* GetGameObject(ObjectGuid const& guid); + Transport* GetTransport(ObjectGuid const& guid); + DynamicObject* GetDynamicObject(ObjectGuid const& guid); + Pet* GetPet(ObjectGuid const& guid); MapStoredObjectTypesContainer& GetObjectsStore() { return _objectsStore; } @@ -430,7 +430,7 @@ public: void UpdatePlayerZoneStats(uint32 oldZone, uint32 newZone); [[nodiscard]] uint32 ApplyDynamicModeRespawnScaling(WorldObject const* obj, uint32 respawnDelay) const; - TaskScheduler _creatureRespawnScheduler; + EventProcessor Events; void ScheduleCreatureRespawn(ObjectGuid /*creatureGuid*/, Milliseconds /*respawnTimer*/, Position pos = Position()); @@ -438,7 +438,7 @@ public: void DeleteCorpseData(); void AddCorpse(Corpse* corpse); void RemoveCorpse(Corpse* corpse); - Corpse* ConvertCorpseToBones(ObjectGuid const ownerGuid, bool insignia = false); + Corpse* ConvertCorpseToBones(ObjectGuid const& ownerGuid, bool insignia = false); void RemoveOldCorpses(); static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId); @@ -514,6 +514,14 @@ public: void RemoveWorldObjectFromZoneWideVisibleMap(uint32 zoneId, WorldObject* obj); ZoneWideVisibleWorldObjectsSet const* GetZoneWideVisibleWorldObjectsForZone(uint32 zoneId) const; + [[nodiscard]] uint32 GetPlayerCountInZone(uint32 zoneId) const + { + if (auto const& it = _zonePlayerCountMap.find(zoneId); it != _zonePlayerCountMap.end()) + return it->second; + + return 0; + }; + private: template<class T> void InitializeObject(T* obj); |
