diff options
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.h')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.h | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 26f3ba7cff3..b9d755636cd 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -36,12 +36,14 @@ #include "ObjectAccessor.h" #include "ObjectDefines.h" #include "VehicleDefines.h" +#include "ConditionMgr.h" +#include "DBCStores.h" #include <string> #include <tuple> #include <map> #include <limits> -#include "ConditionMgr.h" #include <functional> +#include <memory> class Item; struct AccessRequirement; @@ -1023,7 +1025,6 @@ class ObjectMgr void LoadExplorationBaseXP(); void LoadPetNames(); void LoadPetNumber(); - void LoadCorpses(); void LoadFishingBaseSkillLevel(); void LoadReputationRewardRate(); @@ -1059,11 +1060,20 @@ class ObjectMgr CreatureBaseStats const* GetCreatureBaseStats(uint8 level, uint8 unitClass); void SetHighestGuids(); - uint32 GenerateLowGuid(HighGuid guidhigh); + + template<HighGuid type> + inline ObjectGuidGeneratorBase& GetGenerator() + { + static_assert(ObjectGuidTraits<type>::Global, "Only global guid can be generated in ObjectMgr context"); + return GetGuidSequenceGenerator<type>(); + } + uint32 GenerateAuctionID(); uint64 GenerateEquipmentSetGuid(); uint32 GenerateMailID(); uint32 GeneratePetNumber(); + uint32 GenerateCreatureSpawnId(); + uint32 GenerateGameObjectSpawnId(); typedef std::multimap<int32, uint32> ExclusiveQuestGroups; typedef std::pair<ExclusiveQuestGroups::const_iterator, ExclusiveQuestGroups::const_iterator> ExclusiveQuestGroupsBounds; @@ -1219,7 +1229,6 @@ class ObjectMgr void RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data); uint32 AddGOData(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0, float rotation0 = 0, float rotation1 = 0, float rotation2 = 0, float rotation3 = 0); uint32 AddCreatureData(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0); - bool MoveCreatureData(uint32 guid, uint32 map, const Position& pos); // reserved names void LoadReservedPlayersNames(); @@ -1327,17 +1336,21 @@ class ObjectMgr uint32 _mailId; uint32 _hiPetNumber; + uint32 _creatureSpawnId; + uint32 _gameObjectSpawnId; + // first free low guid for selected guid type - uint32 _hiCharGuid; - uint32 _hiCreatureGuid; - uint32 _hiPetGuid; - uint32 _hiVehicleGuid; - uint32 _hiItemGuid; - uint32 _hiGoGuid; - uint32 _hiDoGuid; - uint32 _hiCorpseGuid; - uint32 _hiMoTransGuid; + 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; QuestMap _questTemplates; typedef std::unordered_map<uint32, GossipText> GossipTextContainer; |