diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Chat/Commands/Level2.cpp | 3 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Events/GameEventMgr.cpp | 6 | ||||
-rw-r--r-- | src/server/game/Events/GameEventMgr.h | 2 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Pools/PoolMgr.cpp | 64 | ||||
-rw-r--r-- | src/server/game/Pools/PoolMgr.h | 26 |
8 files changed, 56 insertions, 55 deletions
diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp index 601c2ed240a..3074a842990 100644 --- a/src/server/game/Chat/Commands/Level2.cpp +++ b/src/server/game/Chat/Commands/Level2.cpp @@ -494,7 +494,8 @@ bool ChatHandler::HandleGameObjectTargetCommand(const char* args) bool found = false; float x, y, z, o; uint32 lowguid, id; - uint16 mapid, pool_id, phase; + uint16 mapid, phase; + uint32 pool_id; do { diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 40db0009ebe..727ffef5708 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1604,7 +1604,7 @@ void Creature::Respawn(bool force) if (IsAIEnabled) AI()->JustRespawned(); - uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0; + uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0; if (poolid) sPoolMgr.UpdatePool<Creature>(poolid, GetDBTableGUIDLow()); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index e987b30e098..a9404046175 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -318,7 +318,7 @@ void GameObject::Update(uint32 diff) return; } // respawn timer - uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<GameObject>(GetDBTableGUIDLow()) : 0; + uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<GameObject>(GetDBTableGUIDLow()) : 0; if (poolid) sPoolMgr.UpdatePool<GameObject>(poolid, GetDBTableGUIDLow()); else @@ -560,7 +560,7 @@ void GameObject::Delete() SetGoState(GO_STATE_READY); SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); - uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<GameObject>(GetDBTableGUIDLow()) : 0; + uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<GameObject>(GetDBTableGUIDLow()) : 0; if (poolid) sPoolMgr.UpdatePool<GameObject>(poolid, GetDBTableGUIDLow()); else diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 015f2eb1a2d..f06b1d520b2 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1004,7 +1004,7 @@ void GameEventMgr::LoadFromDB() bar2.step(); - uint32 entry = fields[0].GetUInt16(); + uint32 entry = fields[0].GetUInt32(); int16 event_id = fields[1].GetInt16(); int32 internal_event_id = mGameEvent.size() + event_id - 1; @@ -1314,7 +1314,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size()) { - sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size()); + sLog.outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size()); return; } @@ -1369,7 +1369,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) } if (internal_event_id < 0 || internal_event_id >= mGameEventPoolIds.size()) { - sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %i (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size()); + sLog.outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SIZEFMTD ")",internal_event_id,mGameEventPoolIds.size()); return; } diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h index 182bba4ee1c..a15e28f943d 100644 --- a/src/server/game/Events/GameEventMgr.h +++ b/src/server/game/Events/GameEventMgr.h @@ -137,7 +137,7 @@ class GameEventMgr bool hasGameObjectActiveEventExcept(uint32 go_guid, uint16 event_id); protected: typedef std::list<uint32> GuidList; - typedef std::list<uint16> IdList; + typedef std::list<uint32> IdList; typedef std::vector<GuidList> GameEventGuidMap; typedef std::vector<IdList> GameEventIdMap; typedef std::pair<uint32, ModelEquip> ModelEquipPair; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 80dfedc357d..563e2056fd9 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1341,7 +1341,7 @@ void ObjectMgr::LoadCreatures() data.spawnMask = fields[16].GetUInt8(); data.phaseMask = fields[17].GetUInt16(); int16 gameEvent = fields[18].GetInt16(); - int16 PoolId = fields[19].GetInt16(); + int32 PoolId = fields[19].GetInt32(); MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) @@ -1725,7 +1725,7 @@ void ObjectMgr::LoadGameobjects() data.phaseMask = fields[15].GetUInt16(); int16 gameEvent = fields[16].GetInt16(); - int16 PoolId = fields[17].GetInt16(); + int32 PoolId = fields[17].GetInt32(); if (data.rotation2 < -1.0f || data.rotation2 > 1.0f) { diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index 2f41972a605..c8b14943c7f 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -225,7 +225,7 @@ void PoolGroup<Pool>::Despawn1Object(uint32 child_pool_id) // Method for a pool only to remove any found record causing a circular dependency loop template<> -void PoolGroup<Pool>::RemoveOneRelation(uint16 child_pool_id) +void PoolGroup<Pool>::RemoveOneRelation(uint32 child_pool_id) { for (PoolObjectList::iterator itr = ExplicitlyChanced.begin(); itr != ExplicitlyChanced.end(); ++itr) { @@ -390,7 +390,7 @@ void PoolMgr::LoadFromDB() else { Field *fields = result->Fetch(); - max_pool_id = fields[0].GetUInt16(); + max_pool_id = fields[0].GetUInt32(); } mPoolTemplate.resize(max_pool_id + 1); @@ -414,7 +414,7 @@ void PoolMgr::LoadFromDB() bar.step(); - uint16 pool_id = fields[0].GetUInt16(); + uint32 pool_id = fields[0].GetUInt32(); PoolTemplateData& pPoolTemplate = mPoolTemplate[pool_id]; pPoolTemplate.MaxLimit = fields[1].GetUInt32(); @@ -454,7 +454,7 @@ void PoolMgr::LoadFromDB() bar2.step(); uint32 guid = fields[0].GetUInt32(); - uint16 pool_id = fields[1].GetUInt16(); + uint32 pool_id = fields[1].GetUInt32(); float chance = fields[2].GetFloat(); CreatureData const* data = sObjectMgr.GetCreatureData(guid); @@ -465,12 +465,12 @@ void PoolMgr::LoadFromDB() } if (pool_id > max_pool_id) { - sLog.outErrorDb("`pool_creature` pool id (%i) is out of range compared to max pool id in `pool_template`, skipped.",pool_id); + sLog.outErrorDb("`pool_creature` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.",pool_id); continue; } if (chance < 0 || chance > 100) { - sLog.outErrorDb("`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%i), skipped.", chance, guid, pool_id); + sLog.outErrorDb("`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); continue; } PoolTemplateData *pPoolTemplate = &mPoolTemplate[pool_id]; @@ -517,7 +517,7 @@ void PoolMgr::LoadFromDB() bar2.step(); uint32 guid = fields[0].GetUInt32(); - uint16 pool_id = fields[1].GetUInt16(); + uint32 pool_id = fields[1].GetUInt32(); float chance = fields[2].GetFloat(); GameObjectData const* data = sObjectMgr.GetGOData(guid); @@ -536,12 +536,12 @@ void PoolMgr::LoadFromDB() } if (pool_id > max_pool_id) { - sLog.outErrorDb("`pool_gameobject` pool id (%i) is out of range compared to max pool id in `pool_template`, skipped.",pool_id); + sLog.outErrorDb("`pool_gameobject` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.",pool_id); continue; } if (chance < 0 || chance > 100) { - sLog.outErrorDb("`pool_gameobject` has an invalid chance (%f) for gameobject guid (%u) in pool id (%i), skipped.", chance, guid, pool_id); + sLog.outErrorDb("`pool_gameobject` has an invalid chance (%f) for gameobject guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); continue; } PoolTemplateData *pPoolTemplate = &mPoolTemplate[pool_id]; @@ -587,28 +587,28 @@ void PoolMgr::LoadFromDB() bar2.step(); - uint16 child_pool_id = fields[0].GetUInt16(); - uint16 mother_pool_id = fields[1].GetUInt16(); + uint32 child_pool_id = fields[0].GetUInt32(); + uint32 mother_pool_id = fields[1].GetUInt32(); float chance = fields[2].GetFloat(); if (mother_pool_id > max_pool_id) { - sLog.outErrorDb("`pool_pool` mother_pool id (%i) is out of range compared to max pool id in `pool_template`, skipped.",mother_pool_id); + sLog.outErrorDb("`pool_pool` mother_pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.",mother_pool_id); continue; } if (child_pool_id > max_pool_id) { - sLog.outErrorDb("`pool_pool` included pool_id (%i) is out of range compared to max pool id in `pool_template`, skipped.",child_pool_id); + sLog.outErrorDb("`pool_pool` included pool_id (%u) is out of range compared to max pool id in `pool_template`, skipped.",child_pool_id); continue; } if (mother_pool_id == child_pool_id) { - sLog.outErrorDb("`pool_pool` pool_id (%i) includes itself, dead-lock detected, skipped.",child_pool_id); + sLog.outErrorDb("`pool_pool` pool_id (%u) includes itself, dead-lock detected, skipped.",child_pool_id); continue; } if (chance < 0 || chance > 100) { - sLog.outErrorDb("`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%i), skipped.", chance, child_pool_id, mother_pool_id); + sLog.outErrorDb("`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id); continue; } PoolTemplateData *pPoolTemplateMother = &mPoolTemplate[mother_pool_id]; @@ -625,9 +625,9 @@ void PoolMgr::LoadFromDB() } while (result->NextRow()); // Now check for circular reference - for (uint16 i=0; i<max_pool_id; ++i) + for (uint32 i=0; i<max_pool_id; ++i) { - std::set<uint16> checkedPools; + std::set<uint32> checkedPools; for (SearchMap::iterator poolItr = mPoolSearchMap.find(i); poolItr != mPoolSearchMap.end(); poolItr = mPoolSearchMap.find(poolItr->second)) { checkedPools.insert(poolItr->first); @@ -635,7 +635,7 @@ void PoolMgr::LoadFromDB() { std::ostringstream ss; ss<< "The pool(s) "; - for (std::set<uint16>::const_iterator itr=checkedPools.begin(); itr != checkedPools.end(); ++itr) + for (std::set<uint32>::const_iterator itr=checkedPools.begin(); itr != checkedPools.end(); ++itr) ss << *itr << " "; ss << "create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool " << poolItr->first << " and child pool " << poolItr->second; @@ -663,15 +663,15 @@ void PoolMgr::Initialize() do { Field *fields = result->Fetch(); - uint16 pool_entry = fields[0].GetUInt16(); - uint16 pool_pool_id = fields[1].GetUInt16(); + uint32 pool_entry = fields[0].GetUInt32(); + uint32 pool_pool_id = fields[1].GetUInt32(); if (!CheckPool(pool_entry)) { if (pool_pool_id) // The pool is a child pool in pool_pool table. Ideally we should remove it from the pool handler to ensure it never gets spawned, // however that could recursively invalidate entire chain of mother pools. It can be done in the future but for now we'll do nothing. - sLog.outErrorDb("Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt16()); + sLog.outErrorDb("Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt32()); else sLog.outErrorDb("Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry); continue; @@ -692,7 +692,7 @@ void PoolMgr::Initialize() // 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>(uint16 pool_id, uint32 db_guid) +void PoolMgr::SpawnPool<Creature>(uint32 pool_id, uint32 db_guid) { if (!mPoolCreatureGroups[pool_id].isEmpty()) mPoolCreatureGroups[pool_id].SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, db_guid); @@ -701,7 +701,7 @@ void PoolMgr::SpawnPool<Creature>(uint16 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>(uint16 pool_id, uint32 db_guid) +void PoolMgr::SpawnPool<GameObject>(uint32 pool_id, uint32 db_guid) { if (!mPoolGameobjectGroups[pool_id].isEmpty()) mPoolGameobjectGroups[pool_id].SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, db_guid); @@ -710,13 +710,13 @@ void PoolMgr::SpawnPool<GameObject>(uint16 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>(uint16 pool_id, uint32 sub_pool_id) +void PoolMgr::SpawnPool<Pool>(uint32 pool_id, uint32 sub_pool_id) { if (!mPoolPoolGroups[pool_id].isEmpty()) mPoolPoolGroups[pool_id].SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, sub_pool_id); } -void PoolMgr::SpawnPool(uint16 pool_id) +void PoolMgr::SpawnPool(uint32 pool_id) { SpawnPool<Pool>(pool_id, 0); SpawnPool<GameObject>(pool_id, 0); @@ -724,7 +724,7 @@ void PoolMgr::SpawnPool(uint16 pool_id) } // Call to despawn a pool, all gameobjects/creatures in this pool are removed -void PoolMgr::DespawnPool(uint16 pool_id) +void PoolMgr::DespawnPool(uint32 pool_id) { if (!mPoolCreatureGroups[pool_id].isEmpty()) mPoolCreatureGroups[pool_id].DespawnObject(mSpawnedData); @@ -737,7 +737,7 @@ void PoolMgr::DespawnPool(uint16 pool_id) } // Method that check chance integrity of the creatures and gameobjects in this pool -bool PoolMgr::CheckPool(uint16 pool_id) const +bool PoolMgr::CheckPool(uint32 pool_id) const { return pool_id <= max_pool_id && mPoolGameobjectGroups[pool_id].CheckPool() && @@ -749,14 +749,14 @@ bool PoolMgr::CheckPool(uint16 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(uint16 pool_id, uint32 db_guid_or_pool_id) +void PoolMgr::UpdatePool(uint32 pool_id, uint32 db_guid_or_pool_id) { - if (uint16 motherpoolid = IsPartOfAPool<Pool>(pool_id)) + if (uint32 motherpoolid = IsPartOfAPool<Pool>(pool_id)) SpawnPool<Pool>(motherpoolid, pool_id); else SpawnPool<T>(pool_id, db_guid_or_pool_id); } -template void PoolMgr::UpdatePool<Pool>(uint16 pool_id, uint32 db_guid_or_pool_id); -template void PoolMgr::UpdatePool<GameObject>(uint16 pool_id, uint32 db_guid_or_pool_id); -template void PoolMgr::UpdatePool<Creature>(uint16 pool_id, uint32 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); diff --git a/src/server/game/Pools/PoolMgr.h b/src/server/game/Pools/PoolMgr.h index 6632c7e74a7..7adfddf1a26 100644 --- a/src/server/game/Pools/PoolMgr.h +++ b/src/server/game/Pools/PoolMgr.h @@ -80,7 +80,7 @@ class PoolGroup void Spawn1Object(PoolObject* obj); void ReSpawn1Object(PoolObject* obj); - void RemoveOneRelation(uint16 child_pool_id); + void RemoveOneRelation(uint32 child_pool_id); private: uint32 poolId; PoolObjectList ExplicitlyChanced; @@ -98,30 +98,30 @@ class PoolMgr void Initialize(); template<typename T> - uint16 IsPartOfAPool(uint32 db_guid_or_pool_id) const; + uint32 IsPartOfAPool(uint32 db_guid_or_pool_id) const; template<typename T> bool IsSpawnedObject(uint32 db_guid_or_pool_id) const { return mSpawnedData.IsSpawnedObject<T>(db_guid_or_pool_id); } - bool CheckPool(uint16 pool_id) const; + bool CheckPool(uint32 pool_id) const; - void SpawnPool(uint16 pool_id); - void DespawnPool(uint16 pool_id); + void SpawnPool(uint32 pool_id); + void DespawnPool(uint32 pool_id); template<typename T> - void UpdatePool(uint16 pool_id, uint32 db_guid_or_pool_id); + void UpdatePool(uint32 pool_id, uint32 db_guid_or_pool_id); protected: template<typename T> - void SpawnPool(uint16 pool_id, uint32 db_guid_or_pool_id); + void SpawnPool(uint32 pool_id, uint32 db_guid_or_pool_id); - uint16 max_pool_id; + uint32 max_pool_id; typedef std::vector<PoolTemplateData> PoolTemplateDataMap; typedef std::vector<PoolGroup<Creature> > PoolGroupCreatureMap; typedef std::vector<PoolGroup<GameObject> > PoolGroupGameObjectMap; typedef std::vector<PoolGroup<Pool> > PoolGroupPoolMap; - typedef std::pair<uint32, uint16> SearchPair; - typedef std::map<uint32, uint16> SearchMap; + typedef std::pair<uint32, uint32> SearchPair; + typedef std::map<uint32, uint32> SearchMap; PoolTemplateDataMap mPoolTemplate; PoolGroupCreatureMap mPoolCreatureGroups; @@ -139,7 +139,7 @@ class PoolMgr // Method that tell if the creature is part of a pool and return the pool id if yes template<> -inline uint16 PoolMgr::IsPartOfAPool<Creature>(uint32 db_guid) const +inline uint32 PoolMgr::IsPartOfAPool<Creature>(uint32 db_guid) const { SearchMap::const_iterator itr = mCreatureSearchMap.find(db_guid); if (itr != mCreatureSearchMap.end()) @@ -150,7 +150,7 @@ inline uint16 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 uint16 PoolMgr::IsPartOfAPool<GameObject>(uint32 db_guid) const +inline uint32 PoolMgr::IsPartOfAPool<GameObject>(uint32 db_guid) const { SearchMap::const_iterator itr = mGameobjectSearchMap.find(db_guid); if (itr != mGameobjectSearchMap.end()) @@ -161,7 +161,7 @@ inline uint16 PoolMgr::IsPartOfAPool<GameObject>(uint32 db_guid) const // Method that tell if the pool is part of another pool and return the pool id if yes template<> -inline uint16 PoolMgr::IsPartOfAPool<Pool>(uint32 pool_id) const +inline uint32 PoolMgr::IsPartOfAPool<Pool>(uint32 pool_id) const { SearchMap::const_iterator itr = mPoolSearchMap.find(pool_id); if (itr != mPoolSearchMap.end()) |