Core/Creature: implement initial SummonInfo API for handling summons in the future
This commit is contained in:
1 parent
0f41e34aa1
commit
5848eedb24
10 files changed
+427
-1
No files matched your search
@@ -79,6 +79,7 @@
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellPackets.h"
|
||||
#include "SummonInfo.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "Totem.h"
|
||||
#include "Transport.h"
|
||||
@@ -8818,6 +8819,23 @@ uint32 Unit::GetCreatureTypeMask() const
|
||||
return (creatureType >= 1) ? (1 << (creatureType - 1)) : 0;
|
||||
}
|
||||
|
||||
void Unit::RegisterSummon(SummonInfo* summon)
|
||||
{
|
||||
if (!summon)
|
||||
return;
|
||||
|
||||
if (!advstd::ranges::contains(_activeSummons, summon))
|
||||
_activeSummons.push_back(summon);
|
||||
}
|
||||
|
||||
void Unit::UnregisterSummon(SummonInfo* summon)
|
||||
{
|
||||
if (!summon)
|
||||
return;
|
||||
|
||||
std::erase(_activeSummons, summon);
|
||||
}
|
||||
|
||||
void Unit::SetShapeshiftForm(ShapeshiftForm form)
|
||||
{
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, UNIT_BYTES_2_OFFSET_SHAPESHIFT_FORM, form);
|
||||
@@ -9607,6 +9625,9 @@ void Unit::RemoveFromWorld()
|
||||
}
|
||||
}
|
||||
|
||||
// Clear all active summon references. If we are about to switch map instances, we want to make sure that we leave all summons behind so we won't do threadunsafe operations
|
||||
_activeSummons.clear();
|
||||
|
||||
WorldObject::RemoveFromWorld();
|
||||
m_duringRemoveFromWorld = false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user