fix(Core/Pooling): Fixed less and less objects from pools being spawned the longer the server is running (#5572)

This commit is contained in:
UltraNix
2021-05-08 20:39:09 +02:00
committed by GitHub
parent 75c75a40d4
commit 44babc3c3a
26 changed files with 136 additions and 105 deletions

View File

@@ -104,7 +104,7 @@ public:
std::list<uint32> helpersList;
for (uint8 i = 0; i < MAX_HELPERS_COUNT; ++i)
helpersList.push_back(helpersEntries[i]);
acore::Containers::RandomResizeList(helpersList, MAX_ACTIVE_HELPERS);
acore::Containers::RandomResize(helpersList, MAX_ACTIVE_HELPERS);
uint8 j = 0;
for (std::list<uint32>::const_iterator itr = helpersList.begin(); itr != helpersList.end(); ++itr, ++j)

View File

@@ -626,7 +626,7 @@ public:
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(SpectralBlastCheck(GetCaster()->GetVictim()));
acore::Containers::RandomResizeList(targets, 1);
acore::Containers::RandomResize(targets, 1);
}
void HandleDummy(SpellEffIndex effIndex)

View File

@@ -394,7 +394,7 @@ public:
void FilterTargets(std::list<WorldObject*>& targets)
{
acore::Containers::RandomResizeList(targets, GetCaster()->GetAI()->GetData(DATA_NEGATIVE_ENERGY_TARGETS));
acore::Containers::RandomResize(targets, GetCaster()->GetAI()->GetData(DATA_NEGATIVE_ENERGY_TARGETS));
}
void HandleScriptEffect(SpellEffIndex effIndex)

View File

@@ -137,7 +137,7 @@ public:
targetList.push_back((*itr)->getTarget());
}
acore::Containers::RandomResizeList(targetList, 5);
acore::Containers::RandomResize(targetList, 5);
for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
DoCast(*itr, SPELL_DRAIN_MANA);

View File

@@ -420,7 +420,7 @@ public:
if (Player* p = itr->GetSource())
if (p->IsAlive() && p != me->GetVictim() && p->GetGUID() != _offtankGUID && !p->IsGameMaster() && p->GetDistance(me) < 100.0f && !p->HasAura(SPELL_UNCONTROLLABLE_FRENZY))
myList.push_back(p);
acore::Containers::RandomResizeList(myList, Is25ManRaid() ? 3 : 2);
acore::Containers::RandomResize(myList, Is25ManRaid() ? 3 : 2);
if (myList.size() > 1)
{
Talk(SAY_PACT_OF_THE_DARKFALLEN);
@@ -446,7 +446,7 @@ public:
if (!myList.empty())
{
acore::Containers::RandomResizeList(myList, 1);
acore::Containers::RandomResize(myList, 1);
Player* target = myList.front();
Talk(EMOTE_SWARMING_SHADOWS, target);
Talk(SAY_SWARMING_SHADOWS);
@@ -468,7 +468,7 @@ public:
if (p->IsAlive() && p != me->GetVictim() && p->GetGUID() != _offtankGUID && !p->IsGameMaster() && !p->HasAura(SPELL_PACT_OF_THE_DARKFALLEN) && !p->HasAura(SPELL_UNCONTROLLABLE_FRENZY))
myList.push_back(p);
acore::Containers::RandomResizeList<Player*>(myList, uint32(Is25ManRaid() ? 4 : 2));
acore::Containers::RandomResize(myList, uint32(Is25ManRaid() ? 4 : 2));
for (std::list<Player*>::iterator itr = myList.begin(); itr != myList.end(); ++itr)
me->CastSpell(*itr, SPELL_TWILIGHT_BLOODBOLT, false);
me->CastSpell(me, SPELL_TWILIGHT_BLOODBOLT_TARGET, false);
@@ -723,7 +723,7 @@ public:
{
uint32 targetCount = (targets.size() + 2) / 3;
targets.remove_if(BloodboltHitCheck(static_cast<LanaThelAI*>(GetCaster()->GetAI())));
acore::Containers::RandomResizeList(targets, targetCount);
acore::Containers::RandomResize(targets, targetCount);
// mark targets now, effect hook has missile travel time delay (might cast next in that time)
for (std::list<WorldObject*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
GetCaster()->GetAI()->SetGUID((*itr)->GetGUID(), GUID_BLOODBOLT);

View File

@@ -1315,7 +1315,7 @@ public:
targets.push_back(target);
}
else
acore::Containers::RandomResizeList(targets, 3);
acore::Containers::RandomResize(targets, 3);
}
void Register() override

View File

@@ -2208,7 +2208,7 @@ public:
void SelectTarget(std::list<WorldObject*>& targets)
{
targets.remove_if(IgbExplosionCheck(GetCaster()));
acore::Containers::RandomResizeList(targets, 1);
acore::Containers::RandomResize(targets, 1);
}
void Register() override

View File

@@ -1257,7 +1257,7 @@ public:
}
targets.remove_if(acore::UnitAuraCheck(true, sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster())));
acore::Containers::RandomResizeList(targets, 1);
acore::Containers::RandomResize(targets, 1);
}
void HandleScript(SpellEffIndex /*effIndex*/)

View File

@@ -908,10 +908,10 @@ public:
uint32 maxSize = uint32(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1);
healList.remove_if(UnchainedMagicTargetSelector(false));
if (healList.size() > maxSize)
acore::Containers::RandomResizeList(healList, maxSize);
acore::Containers::RandomResize(healList, maxSize);
dpsList.remove_if(UnchainedMagicTargetSelector(true));
if (dpsList.size() > maxSize)
acore::Containers::RandomResizeList(dpsList, maxSize);
acore::Containers::RandomResize(dpsList, maxSize);
unitList.splice(unitList.begin(), healList);
unitList.splice(unitList.begin(), dpsList);
}

View File

@@ -1368,7 +1368,7 @@ public:
return;
summoners = list_copy;
}
acore::Containers::RandomResizeList(summoners, 2);
acore::Containers::RandomResize(summoners, 2);
for (uint32 i = 0; i < 3; ++i)
caster->CastSpell(summoners.front(), SPELL_SUMMON_SUPPRESSER, true);

View File

@@ -2159,7 +2159,7 @@ public:
void RemoveAliveTarget(std::list<WorldObject*>& targets)
{
targets.remove_if(AliveCheck());
acore::Containers::RandomResizeList(targets, 2);
acore::Containers::RandomResize(targets, 2);
}
void Land(SpellEffIndex /*effIndex*/)

View File

@@ -426,7 +426,7 @@ public:
targets.push_back(itr->GetSource());
targets.remove_if(acore::ObjectTypeIdCheck(TYPEID_PLAYER, false));
targets.remove_if(acore::UnitAuraCheck(true, SPELL_FLASH_FREEZE_TRAPPED_PLAYER));
acore::Containers::RandomResizeList(targets, (RAID_MODE(2,3)));
acore::Containers::RandomResize(targets, (RAID_MODE(2,3)));
for (std::list<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
float prevZ = (*itr)->GetPositionZ();
@@ -1273,7 +1273,7 @@ public:
{
targets.remove_if(acore::ObjectTypeIdCheck(TYPEID_PLAYER, false));
targets.remove_if(acore::UnitAuraCheck(true, SPELL_FLASH_FREEZE_TRAPPED_PLAYER));
acore::Containers::RandomResizeList(targets, 1);
acore::Containers::RandomResize(targets, 1);
}
void Register() override

View File

@@ -1193,7 +1193,7 @@ public:
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(GhoulTargetCheck(GetSpellInfo()->Id == 70790));
acore::Containers::RandomResizeList(targets, 2);
acore::Containers::RandomResize(targets, 2);
}
void HandleScript(SpellEffIndex effIndex)

View File

@@ -199,7 +199,7 @@ public:
void FilterTargets(std::list<WorldObject*>& unitList)
{
acore::Containers::RandomResizeList(unitList, 1);
acore::Containers::RandomResize(unitList, 1);
}
void HandleDummy(SpellEffIndex effIndex)

View File

@@ -241,7 +241,7 @@ public:
void FilterTargets(std::list<WorldObject*>& unitList)
{
acore::Containers::RandomResizeList(unitList, 1);
acore::Containers::RandomResize(unitList, 1);
}
void HandleScriptEffect(SpellEffIndex effIndex)

View File

@@ -993,7 +993,7 @@ public:
targetList.push_back(target);
}
acore::Containers::RandomResizeList(targetList, 5);
acore::Containers::RandomResize(targetList, 5);
for (std::list<Unit*>::const_iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
GetCaster()->CastSpell(*itr, SPELL_NETHER_BEAM_DAMAGE, true);
}

View File

@@ -1050,7 +1050,7 @@ public:
void FilterTargets(std::list<WorldObject*>& targets)
{
acore::Containers::RandomResizeList(targets, 2);
acore::Containers::RandomResize(targets, 2);
}
void HandleDummy(SpellEffIndex /*effIndex*/)

View File

@@ -768,7 +768,7 @@ public:
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove(GetCaster());
acore::Containers::RandomResizeList(targets, _count);
acore::Containers::RandomResize(targets, _count);
}
void Register() override

View File

@@ -652,7 +652,7 @@ public:
void CountTargets(std::list<WorldObject*>& targetList)
{
acore::Containers::RandomResizeList(targetList, GetSpellValue()->MaxAffectedTargets);
acore::Containers::RandomResize(targetList, GetSpellValue()->MaxAffectedTargets);
_targetCount = targetList.size();
}