mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 11:25:42 +00:00
fix(Core/Common): Container fixes use after free (#21460)
This commit is contained in:
@@ -64,6 +64,11 @@ struct Position
|
||||
return !(operator==(a));
|
||||
}
|
||||
|
||||
inline bool operator!=(Position const& a) const
|
||||
{
|
||||
return !(operator==(a));
|
||||
}
|
||||
|
||||
operator G3D::Vector3() const
|
||||
{
|
||||
return { m_positionX, m_positionY, m_positionZ };
|
||||
|
||||
@@ -205,10 +205,12 @@ public:
|
||||
{
|
||||
if (_availableRiftPositions.size() > 1)
|
||||
{
|
||||
spawnPos = Acore::Containers::SelectRandomContainerElementIf(_availableRiftPositions, [&](Position pos) -> bool
|
||||
auto spawnPosItr = Acore::Containers::SelectRandomContainerElementIf(_availableRiftPositions, [&](Position const& pos) -> bool
|
||||
{
|
||||
return pos != lastPosition;
|
||||
});
|
||||
if (spawnPosItr != _availableRiftPositions.end())
|
||||
spawnPos = *spawnPosItr;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -93,10 +93,13 @@ struct boss_laj : public BossAI
|
||||
|
||||
ScheduleTimedEvent(30s, [&] {
|
||||
me->RemoveAurasDueToSpell(_lastTransform.spellId);
|
||||
_lastTransform = Acore::Containers::SelectRandomContainerElementIf(_transformContainer, [&](LajTransformData data) -> bool
|
||||
auto lastTransformItr = Acore::Containers::SelectRandomContainerElementIf(_transformContainer, [&](LajTransformData const& data) -> bool
|
||||
{
|
||||
return data.spellId != _lastTransform.spellId;
|
||||
});
|
||||
if (lastTransformItr == _transformContainer.end())
|
||||
return;
|
||||
_lastTransform = *lastTransformItr;
|
||||
me->SetDisplayId(_lastTransform.modelId);
|
||||
DoCastSelf(_lastTransform.spellId, true);
|
||||
}, 35s);
|
||||
|
||||
Reference in New Issue
Block a user