mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +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
|
||||
template <class T>
|
||||
bool PoolGroup<T>::CheckPool(void)
|
||||
bool PoolGroup<T>::CheckPool() const
|
||||
{
|
||||
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
|
||||
template <class T>
|
||||
bool PoolGroup<T>::IsSpawnedObject(uint32 guid)
|
||||
bool PoolGroup<T>::IsSpawnedObject(uint32 guid) const
|
||||
{
|
||||
for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i)
|
||||
if (ExplicitlyChanced[i].guid == guid)
|
||||
|
|
@ -348,7 +348,6 @@ bool PoolGroup<Pool>::ReSpawn1Object(uint32 /*guid*/)
|
|||
|
||||
PoolManager::PoolManager()
|
||||
{
|
||||
m_IsPoolSystemStarted = false;
|
||||
}
|
||||
|
||||
void PoolManager::LoadFromDB()
|
||||
|
|
@ -644,7 +643,6 @@ void PoolManager::Initialize()
|
|||
}
|
||||
|
||||
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
|
||||
|
|
@ -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
|
||||
uint16 PoolManager::IsPartOfAPool(uint32 guid, uint32 type)
|
||||
uint16 PoolManager::IsPartOfAPool(uint32 guid, uint32 type) const
|
||||
{
|
||||
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
|
||||
bool PoolManager::CheckPool(uint16 pool_id)
|
||||
bool PoolManager::CheckPool(uint16 pool_id) const
|
||||
{
|
||||
return pool_id <= max_pool_id &&
|
||||
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
|
||||
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)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -44,11 +44,11 @@ class PoolGroup
|
|||
public:
|
||||
PoolGroup() : m_SpawnedPoolAmount(0) { }
|
||||
~PoolGroup() {};
|
||||
bool isEmpty() { return ExplicitlyChanced.empty() && EqualChanced.empty(); }
|
||||
bool isEmpty() const { return ExplicitlyChanced.empty() && EqualChanced.empty(); }
|
||||
void AddEntry(PoolObject& poolitem, uint32 maxentries);
|
||||
bool CheckPool(void);
|
||||
bool CheckPool() const;
|
||||
void RollOne(int32& index, PoolObjectList** store, uint32 triggerFrom);
|
||||
bool IsSpawnedObject(uint32 guid);
|
||||
bool IsSpawnedObject(uint32 guid) const;
|
||||
void DespawnObject(uint32 guid=0);
|
||||
void Despawn1Object(uint32 guid);
|
||||
void SpawnObject(uint32 limit, uint32 triggerFrom);
|
||||
|
|
@ -71,16 +71,15 @@ class PoolManager
|
|||
PoolManager();
|
||||
~PoolManager() {};
|
||||
void LoadFromDB();
|
||||
uint16 IsPartOfAPool(uint32 guid, uint32 type);
|
||||
bool IsSpawnedObject(uint16 pool_id, uint32 guid, uint32 type);
|
||||
bool CheckPool(uint16 pool_id);
|
||||
uint16 IsPartOfAPool(uint32 guid, uint32 type) const;
|
||||
bool IsSpawnedObject(uint16 pool_id, uint32 guid, uint32 type) const;
|
||||
bool CheckPool(uint16 pool_id) const;
|
||||
void SpawnPool(uint16 pool_id, uint32 guid, uint32 type);
|
||||
void DespawnPool(uint16 pool_id);
|
||||
void UpdatePool(uint16 pool_id, uint32 guid, uint32 type);
|
||||
void Initialize();
|
||||
|
||||
protected:
|
||||
bool m_IsPoolSystemStarted;
|
||||
uint16 max_pool_id;
|
||||
typedef std::vector<PoolTemplateData> PoolTemplateDataMap;
|
||||
typedef std::vector<PoolGroup<Creature> > PoolGroupCreatureMap;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9144"
|
||||
#define REVISION_NR "9145"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue