Skip to content

Commit

Permalink
fix(Core/Pool): Fix degradation of pools over time (#19750)
Browse files Browse the repository at this point in the history
  • Loading branch information
walkline committed Aug 28, 2024
1 parent b595586 commit 9144031
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/server/game/Pools/PoolMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ void PoolGroup<T>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 trig

// Triggering object is marked as spawned at this time and can be also rolled (respawn case)
// so this need explicit check for this case
if (roll < 0 && (/*obj.guid == triggerFrom ||*/ !spawns.IsActiveObject<T>(obj.guid)))
if (roll < 0 && (obj.guid == triggerFrom || !spawns.IsActiveObject<T>(obj.guid)))
{
rolledObjects.push_back(obj);
break;
Expand All @@ -340,9 +340,9 @@ void PoolGroup<T>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 trig

if (!EqualChanced.empty() && rolledObjects.empty())
{
std::copy_if(EqualChanced.begin(), EqualChanced.end(), std::back_inserter(rolledObjects), [/*triggerFrom, */&spawns](PoolObject const& object)
std::copy_if(EqualChanced.begin(), EqualChanced.end(), std::back_inserter(rolledObjects), [triggerFrom, &spawns](PoolObject const& object)
{
return /*object.guid == triggerFrom ||*/ !spawns.IsActiveObject<T>(object.guid);
return object.guid == triggerFrom || !spawns.IsActiveObject<T>(object.guid);
});

Acore::Containers::RandomResize(rolledObjects, count);
Expand Down Expand Up @@ -527,16 +527,18 @@ void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32

// Method that does the respawn job on the specified creature
template <>
void PoolGroup<Creature>::ReSpawn1Object(PoolObject* /*obj*/)
void PoolGroup<Creature>::ReSpawn1Object(PoolObject* obj)
{
// Creature is still on map, nothing to do
Despawn1Object(obj->guid);
Spawn1Object(obj);
}

// Method that does the respawn job on the specified gameobject
template <>
void PoolGroup<GameObject>::ReSpawn1Object(PoolObject* /*obj*/)
void PoolGroup<GameObject>::ReSpawn1Object(PoolObject* obj)
{
// Gameobject is still on map, nothing to do
Despawn1Object(obj->guid);
Spawn1Object(obj);
}

// Nothing to do for a child Pool
Expand Down

0 comments on commit 9144031

Please sign in to comment.