diff options
| author | Shauren <shauren.trinity@gmail.com> | 2014-10-26 02:57:28 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2014-10-26 02:57:28 +0200 |
| commit | 9e1930959db59013d6f0221d29cc652cdf2f6145 (patch) | |
| tree | 29218cc6af11c18f645eba3503583ed821975b2c /src/server/game/Pools | |
| parent | 747350a0bcffaa4ef2b5d3317bb75fac78c64472 (diff) | |
Core/Entities: Changed object lowguid to uint64
Diffstat (limited to 'src/server/game/Pools')
| -rw-r--r-- | src/server/game/Pools/PoolMgr.cpp | 70 | ||||
| -rw-r--r-- | src/server/game/Pools/PoolMgr.h | 44 |
2 files changed, 57 insertions, 57 deletions
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index 3ada9d9740b..614e1afd9f2 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -34,62 +34,62 @@ uint32 ActivePoolData::GetActiveObjectCount(uint32 pool_id) const // Method that tell if a creature is spawned currently template<> -bool ActivePoolData::IsActiveObject<Creature>(uint32 db_guid) const +bool ActivePoolData::IsActiveObject<Creature>(uint64 db_guid) const { return mSpawnedCreatures.find(db_guid) != mSpawnedCreatures.end(); } // Method that tell if a gameobject is spawned currently template<> -bool ActivePoolData::IsActiveObject<GameObject>(uint32 db_guid) const +bool ActivePoolData::IsActiveObject<GameObject>(uint64 db_guid) const { return mSpawnedGameobjects.find(db_guid) != mSpawnedGameobjects.end(); } // Method that tell if a pool is spawned currently template<> -bool ActivePoolData::IsActiveObject<Pool>(uint32 sub_pool_id) const +bool ActivePoolData::IsActiveObject<Pool>(uint64 sub_pool_id) const { return mSpawnedPools.find(sub_pool_id) != mSpawnedPools.end(); } // Method that tell if a quest can be started template<> -bool ActivePoolData::IsActiveObject<Quest>(uint32 quest_id) const +bool ActivePoolData::IsActiveObject<Quest>(uint64 quest_id) const { return mActiveQuests.find(quest_id) != mActiveQuests.end(); } template<> -void ActivePoolData::ActivateObject<Creature>(uint32 db_guid, uint32 pool_id) +void ActivePoolData::ActivateObject<Creature>(uint64 db_guid, uint32 pool_id) { mSpawnedCreatures.insert(db_guid); ++mSpawnedPools[pool_id]; } template<> -void ActivePoolData::ActivateObject<GameObject>(uint32 db_guid, uint32 pool_id) +void ActivePoolData::ActivateObject<GameObject>(uint64 db_guid, uint32 pool_id) { mSpawnedGameobjects.insert(db_guid); ++mSpawnedPools[pool_id]; } template<> -void ActivePoolData::ActivateObject<Pool>(uint32 sub_pool_id, uint32 pool_id) +void ActivePoolData::ActivateObject<Pool>(uint64 sub_pool_id, uint32 pool_id) { mSpawnedPools[sub_pool_id] = 0; ++mSpawnedPools[pool_id]; } template<> -void ActivePoolData::ActivateObject<Quest>(uint32 quest_id, uint32 pool_id) +void ActivePoolData::ActivateObject<Quest>(uint64 quest_id, uint32 pool_id) { mActiveQuests.insert(quest_id); ++mSpawnedPools[pool_id]; } template<> -void ActivePoolData::RemoveObject<Creature>(uint32 db_guid, uint32 pool_id) +void ActivePoolData::RemoveObject<Creature>(uint64 db_guid, uint32 pool_id) { mSpawnedCreatures.erase(db_guid); uint32& val = mSpawnedPools[pool_id]; @@ -98,7 +98,7 @@ void ActivePoolData::RemoveObject<Creature>(uint32 db_guid, uint32 pool_id) } template<> -void ActivePoolData::RemoveObject<GameObject>(uint32 db_guid, uint32 pool_id) +void ActivePoolData::RemoveObject<GameObject>(uint64 db_guid, uint32 pool_id) { mSpawnedGameobjects.erase(db_guid); uint32& val = mSpawnedPools[pool_id]; @@ -107,7 +107,7 @@ void ActivePoolData::RemoveObject<GameObject>(uint32 db_guid, uint32 pool_id) } template<> -void ActivePoolData::RemoveObject<Pool>(uint32 sub_pool_id, uint32 pool_id) +void ActivePoolData::RemoveObject<Pool>(uint64 sub_pool_id, uint32 pool_id) { mSpawnedPools.erase(sub_pool_id); uint32& val = mSpawnedPools[pool_id]; @@ -116,7 +116,7 @@ void ActivePoolData::RemoveObject<Pool>(uint32 sub_pool_id, uint32 pool_id) } template<> -void ActivePoolData::RemoveObject<Quest>(uint32 quest_id, uint32 pool_id) +void ActivePoolData::RemoveObject<Quest>(uint64 quest_id, uint32 pool_id) { mActiveQuests.erase(quest_id); uint32& val = mSpawnedPools[pool_id]; @@ -153,7 +153,7 @@ bool PoolGroup<T>::CheckPool() const } template <class T> -PoolObject* PoolGroup<T>::RollOne(ActivePoolData& spawns, uint32 triggerFrom) +PoolObject* PoolGroup<T>::RollOne(ActivePoolData& spawns, uint64 triggerFrom) { if (!ExplicitlyChanced.empty()) { @@ -184,7 +184,7 @@ PoolObject* PoolGroup<T>::RollOne(ActivePoolData& spawns, uint32 triggerFrom) // If no guid is passed, the pool is just removed (event end case) // If guid is filled, cache will be used and no removal will occur, it just fill the cache template<class T> -void PoolGroup<T>::DespawnObject(ActivePoolData& spawns, uint32 guid) +void PoolGroup<T>::DespawnObject(ActivePoolData& spawns, uint64 guid) { for (size_t i=0; i < EqualChanced.size(); ++i) { @@ -215,7 +215,7 @@ void PoolGroup<T>::DespawnObject(ActivePoolData& spawns, uint32 guid) // Method that is actualy doing the removal job on one creature template<> -void PoolGroup<Creature>::Despawn1Object(uint32 guid) +void PoolGroup<Creature>::Despawn1Object(uint64 guid) { if (CreatureData const* data = sObjectMgr->GetCreatureData(guid)) { @@ -228,7 +228,7 @@ void PoolGroup<Creature>::Despawn1Object(uint32 guid) // Same on one gameobject template<> -void PoolGroup<GameObject>::Despawn1Object(uint32 guid) +void PoolGroup<GameObject>::Despawn1Object(uint64 guid) { if (GameObjectData const* data = sObjectMgr->GetGOData(guid)) { @@ -241,14 +241,14 @@ void PoolGroup<GameObject>::Despawn1Object(uint32 guid) // Same on one pool template<> -void PoolGroup<Pool>::Despawn1Object(uint32 child_pool_id) +void PoolGroup<Pool>::Despawn1Object(uint64 child_pool_id) { sPoolMgr->DespawnPool(child_pool_id); } // Same on one quest template<> -void PoolGroup<Quest>::Despawn1Object(uint32 quest_id) +void PoolGroup<Quest>::Despawn1Object(uint64 quest_id) { // Creatures QuestRelations* questMap = sObjectMgr->GetCreatureQuestRelationMap(); @@ -312,7 +312,7 @@ void PoolGroup<Pool>::RemoveOneRelation(uint32 child_pool_id) } template <class T> -void PoolGroup<T>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 triggerFrom) +void PoolGroup<T>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint64 triggerFrom) { uint32 lastDespawned = 0; int count = limit - spawns.GetActiveObjectCount(poolId); @@ -435,7 +435,7 @@ void PoolGroup<Quest>::Spawn1Object(PoolObject* obj) } template <> -void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 triggerFrom) +void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint64 triggerFrom) { TC_LOG_DEBUG("pool", "PoolGroup<Quest>: Spawning pool %u", poolId); // load state from db @@ -607,14 +607,14 @@ void PoolMgr::LoadFromDB() { Field* fields = result->Fetch(); - uint32 guid = fields[0].GetUInt32(); + uint64 guid = fields[0].GetUInt32(); uint32 pool_id = fields[1].GetUInt32(); float chance = fields[2].GetFloat(); CreatureData const* data = sObjectMgr->GetCreatureData(guid); if (!data) { - TC_LOG_ERROR("sql.sql", "`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); + TC_LOG_ERROR("sql.sql", "`pool_creature` has a non existing creature spawn (GUID: " UI64FMTD ") defined for pool id (%u), skipped.", guid, pool_id); continue; } if (pool_id > max_pool_id) @@ -624,7 +624,7 @@ void PoolMgr::LoadFromDB() } if (chance < 0 || chance > 100) { - TC_LOG_ERROR("sql.sql", "`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); + TC_LOG_ERROR("sql.sql", "`pool_creature` has an invalid chance (%f) for creature guid (" UI64FMTD ") in pool id (%u), skipped.", chance, guid, pool_id); continue; } PoolTemplateData* pPoolTemplate = &mPoolTemplate[pool_id]; @@ -663,14 +663,14 @@ void PoolMgr::LoadFromDB() { Field* fields = result->Fetch(); - uint32 guid = fields[0].GetUInt32(); + uint64 guid = fields[0].GetUInt64(); uint32 pool_id = fields[1].GetUInt32(); float chance = fields[2].GetFloat(); GameObjectData const* data = sObjectMgr->GetGOData(guid); if (!data) { - TC_LOG_ERROR("sql.sql", "`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); + TC_LOG_ERROR("sql.sql", "`pool_gameobject` has a non existing gameobject spawn (GUID: " UI64FMTD ") defined for pool id (%u), skipped.", guid, pool_id); continue; } @@ -679,7 +679,7 @@ void PoolMgr::LoadFromDB() goinfo->type != GAMEOBJECT_TYPE_GOOBER && goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE) { - TC_LOG_ERROR("sql.sql", "`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id); + TC_LOG_ERROR("sql.sql", "`pool_gameobject` has a not lootable gameobject spawn (GUID: " UI64FMTD ", type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id); continue; } @@ -998,7 +998,7 @@ void PoolMgr::ChangeWeeklyQuests() // Call to spawn a pool, if cache if true the method will spawn only if cached entry is different // If it's same, the creature is respawned only (added back to map) template<> -void PoolMgr::SpawnPool<Creature>(uint32 pool_id, uint32 db_guid) +void PoolMgr::SpawnPool<Creature>(uint32 pool_id, uint64 db_guid) { if (!mPoolCreatureGroups[pool_id].isEmpty()) mPoolCreatureGroups[pool_id].SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, db_guid); @@ -1007,7 +1007,7 @@ void PoolMgr::SpawnPool<Creature>(uint32 pool_id, uint32 db_guid) // Call to spawn a pool, if cache if true the method will spawn only if cached entry is different // If it's same, the gameobject is respawned only (added back to map) template<> -void PoolMgr::SpawnPool<GameObject>(uint32 pool_id, uint32 db_guid) +void PoolMgr::SpawnPool<GameObject>(uint32 pool_id, uint64 db_guid) { if (!mPoolGameobjectGroups[pool_id].isEmpty()) mPoolGameobjectGroups[pool_id].SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, db_guid); @@ -1016,7 +1016,7 @@ void PoolMgr::SpawnPool<GameObject>(uint32 pool_id, uint32 db_guid) // Call to spawn a pool, if cache if true the method will spawn only if cached entry is different // If it's same, the pool is respawned only template<> -void PoolMgr::SpawnPool<Pool>(uint32 pool_id, uint32 sub_pool_id) +void PoolMgr::SpawnPool<Pool>(uint32 pool_id, uint64 sub_pool_id) { if (!mPoolPoolGroups[pool_id].isEmpty()) mPoolPoolGroups[pool_id].SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, sub_pool_id); @@ -1024,7 +1024,7 @@ void PoolMgr::SpawnPool<Pool>(uint32 pool_id, uint32 sub_pool_id) // Call to spawn a pool template<> -void PoolMgr::SpawnPool<Quest>(uint32 pool_id, uint32 quest_id) +void PoolMgr::SpawnPool<Quest>(uint32 pool_id, uint64 quest_id) { if (!mPoolQuestGroups[pool_id].isEmpty()) mPoolQuestGroups[pool_id].SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, quest_id); @@ -1068,7 +1068,7 @@ bool PoolMgr::CheckPool(uint32 pool_id) const // Here we cache only the creature/gameobject whose guid is passed as parameter // Then the spawn pool call will use this cache to decide template<typename T> -void PoolMgr::UpdatePool(uint32 pool_id, uint32 db_guid_or_pool_id) +void PoolMgr::UpdatePool(uint32 pool_id, uint64 db_guid_or_pool_id) { if (uint32 motherpoolid = IsPartOfAPool<Pool>(pool_id)) SpawnPool<Pool>(motherpoolid, pool_id); @@ -1076,7 +1076,7 @@ void PoolMgr::UpdatePool(uint32 pool_id, uint32 db_guid_or_pool_id) SpawnPool<T>(pool_id, db_guid_or_pool_id); } -template void PoolMgr::UpdatePool<Pool>(uint32 pool_id, uint32 db_guid_or_pool_id); -template void PoolMgr::UpdatePool<GameObject>(uint32 pool_id, uint32 db_guid_or_pool_id); -template void PoolMgr::UpdatePool<Creature>(uint32 pool_id, uint32 db_guid_or_pool_id); -template void PoolMgr::UpdatePool<Quest>(uint32 pool_id, uint32 db_guid_or_pool_id); +template void PoolMgr::UpdatePool<Pool>(uint32 pool_id, uint64 db_guid_or_pool_id); +template void PoolMgr::UpdatePool<GameObject>(uint32 pool_id, uint64 db_guid_or_pool_id); +template void PoolMgr::UpdatePool<Creature>(uint32 pool_id, uint64 db_guid_or_pool_id); +template void PoolMgr::UpdatePool<Quest>(uint32 pool_id, uint64 db_guid_or_pool_id); diff --git a/src/server/game/Pools/PoolMgr.h b/src/server/game/Pools/PoolMgr.h index dd24cceae07..ff633c08ba1 100644 --- a/src/server/game/Pools/PoolMgr.h +++ b/src/server/game/Pools/PoolMgr.h @@ -31,31 +31,31 @@ struct PoolTemplateData struct PoolObject { - uint32 guid; + uint64 guid; float chance; - PoolObject(uint32 _guid, float _chance) : guid(_guid), chance(std::fabs(_chance)) { } + PoolObject(uint64 _guid, float _chance) : guid(_guid), chance(std::fabs(_chance)) { } }; class Pool // for Pool of Pool case { }; -typedef std::set<uint32> ActivePoolObjects; -typedef std::map<uint32, uint32> ActivePoolPools; +typedef std::set<uint64> ActivePoolObjects; +typedef std::map<uint64, uint32> ActivePoolPools; class ActivePoolData { public: template<typename T> - bool IsActiveObject(uint32 db_guid_or_pool_id) const; + bool IsActiveObject(uint64 db_guid_or_pool_id) const; uint32 GetActiveObjectCount(uint32 pool_id) const; template<typename T> - void ActivateObject(uint32 db_guid_or_pool_id, uint32 pool_id); + void ActivateObject(uint64 db_guid_or_pool_id, uint32 pool_id); template<typename T> - void RemoveObject(uint32 db_guid_or_pool_id, uint32 pool_id); + void RemoveObject(uint64 db_guid_or_pool_id, uint32 pool_id); ActivePoolObjects GetActiveQuests() const { return mActiveQuests; } // a copy of the set private: @@ -76,15 +76,15 @@ class PoolGroup bool isEmpty() const { return ExplicitlyChanced.empty() && EqualChanced.empty(); } void AddEntry(PoolObject& poolitem, uint32 maxentries); bool CheckPool() const; - PoolObject* RollOne(ActivePoolData& spawns, uint32 triggerFrom); - void DespawnObject(ActivePoolData& spawns, uint32 guid=0); - void Despawn1Object(uint32 guid); - void SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 triggerFrom); + PoolObject* RollOne(ActivePoolData& spawns, uint64 triggerFrom); + void DespawnObject(ActivePoolData& spawns, uint64 guid=0); + void Despawn1Object(uint64 guid); + void SpawnObject(ActivePoolData& spawns, uint32 limit, uint64 triggerFrom); void Spawn1Object(PoolObject* obj); void ReSpawn1Object(PoolObject* obj); void RemoveOneRelation(uint32 child_pool_id); - uint32 GetFirstEqualChancedObjectId() + uint64 GetFirstEqualChancedObjectId() { if (EqualChanced.empty()) return 0; @@ -121,10 +121,10 @@ class PoolMgr void Initialize(); template<typename T> - uint32 IsPartOfAPool(uint32 db_guid_or_pool_id) const; + uint32 IsPartOfAPool(uint64 db_guid_or_pool_id) const; template<typename T> - bool IsSpawnedObject(uint32 db_guid_or_pool_id) const { return mSpawnedData.IsActiveObject<T>(db_guid_or_pool_id); } + bool IsSpawnedObject(uint64 db_guid_or_pool_id) const { return mSpawnedData.IsActiveObject<T>(db_guid_or_pool_id); } bool CheckPool(uint32 pool_id) const; @@ -132,7 +132,7 @@ class PoolMgr void DespawnPool(uint32 pool_id); template<typename T> - void UpdatePool(uint32 pool_id, uint32 db_guid_or_pool_id); + void UpdatePool(uint32 pool_id, uint64 db_guid_or_pool_id); void ChangeDailyQuests(); void ChangeWeeklyQuests(); @@ -142,7 +142,7 @@ class PoolMgr private: template<typename T> - void SpawnPool(uint32 pool_id, uint32 db_guid_or_pool_id); + void SpawnPool(uint32 pool_id, uint64 db_guid_or_pool_id); uint32 max_pool_id; typedef std::vector<PoolTemplateData> PoolTemplateDataMap; @@ -150,8 +150,8 @@ class PoolMgr typedef std::vector<PoolGroup<GameObject> > PoolGroupGameObjectMap; typedef std::vector<PoolGroup<Pool> > PoolGroupPoolMap; typedef std::vector<PoolGroup<Quest> > PoolGroupQuestMap; - typedef std::pair<uint32, uint32> SearchPair; - typedef std::map<uint32, uint32> SearchMap; + typedef std::pair<uint64, uint32> SearchPair; + typedef std::map<uint64, uint32> SearchMap; PoolTemplateDataMap mPoolTemplate; PoolGroupCreatureMap mPoolCreatureGroups; @@ -171,7 +171,7 @@ class PoolMgr // Method that tell if the creature is part of a pool and return the pool id if yes template<> -inline uint32 PoolMgr::IsPartOfAPool<Creature>(uint32 db_guid) const +inline uint32 PoolMgr::IsPartOfAPool<Creature>(uint64 db_guid) const { SearchMap::const_iterator itr = mCreatureSearchMap.find(db_guid); if (itr != mCreatureSearchMap.end()) @@ -182,7 +182,7 @@ inline uint32 PoolMgr::IsPartOfAPool<Creature>(uint32 db_guid) const // Method that tell if the gameobject is part of a pool and return the pool id if yes template<> -inline uint32 PoolMgr::IsPartOfAPool<GameObject>(uint32 db_guid) const +inline uint32 PoolMgr::IsPartOfAPool<GameObject>(uint64 db_guid) const { SearchMap::const_iterator itr = mGameobjectSearchMap.find(db_guid); if (itr != mGameobjectSearchMap.end()) @@ -193,7 +193,7 @@ inline uint32 PoolMgr::IsPartOfAPool<GameObject>(uint32 db_guid) const // Method that tell if the quest is part of another pool and return the pool id if yes template<> -inline uint32 PoolMgr::IsPartOfAPool<Quest>(uint32 pool_id) const +inline uint32 PoolMgr::IsPartOfAPool<Quest>(uint64 pool_id) const { SearchMap::const_iterator itr = mQuestSearchMap.find(pool_id); if (itr != mQuestSearchMap.end()) @@ -204,7 +204,7 @@ inline uint32 PoolMgr::IsPartOfAPool<Quest>(uint32 pool_id) const // Method that tell if the pool is part of another pool and return the pool id if yes template<> -inline uint32 PoolMgr::IsPartOfAPool<Pool>(uint32 pool_id) const +inline uint32 PoolMgr::IsPartOfAPool<Pool>(uint64 pool_id) const { SearchMap::const_iterator itr = mPoolSearchMap.find(pool_id); if (itr != mPoolSearchMap.end()) |
