mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[9145] Small cleanups in pool system code
* Mark some pool system functions as constant * Drop unused field.
This commit is contained in:
parent
324772283f
commit
edfec630e8
3 changed files with 12 additions and 15 deletions
|
|
@ -41,7 +41,7 @@ void PoolGroup<T>::AddEntry(PoolObject& poolitem, uint32 maxentries)
|
||||||
|
|
||||||
// Method to check the chances are proper in this object pool
|
// Method to check the chances are proper in this object pool
|
||||||
template <class T>
|
template <class T>
|
||||||
bool PoolGroup<T>::CheckPool(void)
|
bool PoolGroup<T>::CheckPool() const
|
||||||
{
|
{
|
||||||
if (EqualChanced.size() == 0)
|
if (EqualChanced.size() == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -56,7 +56,7 @@ bool PoolGroup<T>::CheckPool(void)
|
||||||
|
|
||||||
// Method that tell if the gameobject, creature or pool is spawned currently
|
// Method that tell if the gameobject, creature or pool is spawned currently
|
||||||
template <class T>
|
template <class T>
|
||||||
bool PoolGroup<T>::IsSpawnedObject(uint32 guid)
|
bool PoolGroup<T>::IsSpawnedObject(uint32 guid) const
|
||||||
{
|
{
|
||||||
for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i)
|
for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i)
|
||||||
if (ExplicitlyChanced[i].guid == guid)
|
if (ExplicitlyChanced[i].guid == guid)
|
||||||
|
|
@ -348,7 +348,6 @@ bool PoolGroup<Pool>::ReSpawn1Object(uint32 /*guid*/)
|
||||||
|
|
||||||
PoolManager::PoolManager()
|
PoolManager::PoolManager()
|
||||||
{
|
{
|
||||||
m_IsPoolSystemStarted = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PoolManager::LoadFromDB()
|
void PoolManager::LoadFromDB()
|
||||||
|
|
@ -644,7 +643,6 @@ void PoolManager::Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
sLog.outBasic("Pool handling system initialized, %u pools spawned.", count);
|
sLog.outBasic("Pool handling system initialized, %u pools spawned.", count);
|
||||||
m_IsPoolSystemStarted = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call to spawn a pool, if cache if true the method will spawn only if cached entry is different
|
// Call to spawn a pool, if cache if true the method will spawn only if cached entry is different
|
||||||
|
|
@ -692,7 +690,7 @@ void PoolManager::UpdatePool(uint16 pool_id, uint32 guid, uint32 type)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method that tell if the gameobject/creature is part of a pool and return the pool id if yes
|
// Method that tell if the gameobject/creature is part of a pool and return the pool id if yes
|
||||||
uint16 PoolManager::IsPartOfAPool(uint32 guid, uint32 type)
|
uint16 PoolManager::IsPartOfAPool(uint32 guid, uint32 type) const
|
||||||
{
|
{
|
||||||
if (type == 0) // pool of pool
|
if (type == 0) // pool of pool
|
||||||
{
|
{
|
||||||
|
|
@ -716,7 +714,7 @@ uint16 PoolManager::IsPartOfAPool(uint32 guid, uint32 type)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method that check chance integrity of the creatures and gameobjects in this pool
|
// Method that check chance integrity of the creatures and gameobjects in this pool
|
||||||
bool PoolManager::CheckPool(uint16 pool_id)
|
bool PoolManager::CheckPool(uint16 pool_id) const
|
||||||
{
|
{
|
||||||
return pool_id <= max_pool_id &&
|
return pool_id <= max_pool_id &&
|
||||||
mPoolGameobjectGroups[pool_id].CheckPool() &&
|
mPoolGameobjectGroups[pool_id].CheckPool() &&
|
||||||
|
|
@ -725,7 +723,7 @@ bool PoolManager::CheckPool(uint16 pool_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method that tell if a creature or gameobject in pool_id is spawned currently
|
// Method that tell if a creature or gameobject in pool_id is spawned currently
|
||||||
bool PoolManager::IsSpawnedObject(uint16 pool_id, uint32 guid, uint32 type)
|
bool PoolManager::IsSpawnedObject(uint16 pool_id, uint32 guid, uint32 type) const
|
||||||
{
|
{
|
||||||
if (pool_id > max_pool_id)
|
if (pool_id > max_pool_id)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -44,11 +44,11 @@ class PoolGroup
|
||||||
public:
|
public:
|
||||||
PoolGroup() : m_SpawnedPoolAmount(0) { }
|
PoolGroup() : m_SpawnedPoolAmount(0) { }
|
||||||
~PoolGroup() {};
|
~PoolGroup() {};
|
||||||
bool isEmpty() { return ExplicitlyChanced.empty() && EqualChanced.empty(); }
|
bool isEmpty() const { return ExplicitlyChanced.empty() && EqualChanced.empty(); }
|
||||||
void AddEntry(PoolObject& poolitem, uint32 maxentries);
|
void AddEntry(PoolObject& poolitem, uint32 maxentries);
|
||||||
bool CheckPool(void);
|
bool CheckPool() const;
|
||||||
void RollOne(int32& index, PoolObjectList** store, uint32 triggerFrom);
|
void RollOne(int32& index, PoolObjectList** store, uint32 triggerFrom);
|
||||||
bool IsSpawnedObject(uint32 guid);
|
bool IsSpawnedObject(uint32 guid) const;
|
||||||
void DespawnObject(uint32 guid=0);
|
void DespawnObject(uint32 guid=0);
|
||||||
void Despawn1Object(uint32 guid);
|
void Despawn1Object(uint32 guid);
|
||||||
void SpawnObject(uint32 limit, uint32 triggerFrom);
|
void SpawnObject(uint32 limit, uint32 triggerFrom);
|
||||||
|
|
@ -71,16 +71,15 @@ class PoolManager
|
||||||
PoolManager();
|
PoolManager();
|
||||||
~PoolManager() {};
|
~PoolManager() {};
|
||||||
void LoadFromDB();
|
void LoadFromDB();
|
||||||
uint16 IsPartOfAPool(uint32 guid, uint32 type);
|
uint16 IsPartOfAPool(uint32 guid, uint32 type) const;
|
||||||
bool IsSpawnedObject(uint16 pool_id, uint32 guid, uint32 type);
|
bool IsSpawnedObject(uint16 pool_id, uint32 guid, uint32 type) const;
|
||||||
bool CheckPool(uint16 pool_id);
|
bool CheckPool(uint16 pool_id) const;
|
||||||
void SpawnPool(uint16 pool_id, uint32 guid, uint32 type);
|
void SpawnPool(uint16 pool_id, uint32 guid, uint32 type);
|
||||||
void DespawnPool(uint16 pool_id);
|
void DespawnPool(uint16 pool_id);
|
||||||
void UpdatePool(uint16 pool_id, uint32 guid, uint32 type);
|
void UpdatePool(uint16 pool_id, uint32 guid, uint32 type);
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_IsPoolSystemStarted;
|
|
||||||
uint16 max_pool_id;
|
uint16 max_pool_id;
|
||||||
typedef std::vector<PoolTemplateData> PoolTemplateDataMap;
|
typedef std::vector<PoolTemplateData> PoolTemplateDataMap;
|
||||||
typedef std::vector<PoolGroup<Creature> > PoolGroupCreatureMap;
|
typedef std::vector<PoolGroup<Creature> > PoolGroupCreatureMap;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9144"
|
#define REVISION_NR "9145"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue