Fix crash when using a pool template with an entry > 65535, fixes issue #3632

--HG--
branch : trunk
This commit is contained in:
Shocker
2010-08-26 06:49:31 +03:00
parent aa768001a7
commit 2748f86bdb
8 changed files with 56 additions and 55 deletions
+13 -13
View File
@@ -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())