mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 09:39:11 +00:00
refactor(Core/Misc): Make DeathState enum class (#17607)
This commit is contained in:
@@ -247,7 +247,7 @@ Unit::Unit(bool isWorldObject) : WorldObject(isWorldObject),
|
||||
m_rootTimes = 0;
|
||||
|
||||
m_state = 0;
|
||||
m_deathState = ALIVE;
|
||||
m_deathState = DeathState::Alive;
|
||||
|
||||
for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
|
||||
m_currentSpells[i] = nullptr;
|
||||
@@ -4535,7 +4535,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator& i, AuraRemoveMode removeMo
|
||||
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && IsTotem() && GetGUID() == aura->GetCasterGUID())
|
||||
{
|
||||
if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE)
|
||||
ToTotem()->setDeathState(JUST_DIED);
|
||||
ToTotem()->setDeathState(DeathState::JustDied);
|
||||
}
|
||||
|
||||
// Remove aurastates only if were not found
|
||||
@@ -14497,7 +14497,7 @@ void Unit::setDeathState(DeathState s, bool despawn)
|
||||
// death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that
|
||||
// it can be used to check creation of death items (such as soul shards).
|
||||
|
||||
if (s != ALIVE && s != JUST_RESPAWNED)
|
||||
if (s != DeathState::Alive && s != DeathState::JustRespawned)
|
||||
{
|
||||
CombatStop();
|
||||
GetThreatMgr().ClearAllThreat();
|
||||
@@ -14512,7 +14512,7 @@ void Unit::setDeathState(DeathState s, bool despawn)
|
||||
RemoveAllAurasOnDeath();
|
||||
}
|
||||
|
||||
if (s == JUST_DIED)
|
||||
if (s == DeathState::JustDied)
|
||||
{
|
||||
// remove aurastates allowing special moves
|
||||
ClearAllReactives();
|
||||
@@ -14541,7 +14541,7 @@ void Unit::setDeathState(DeathState s, bool despawn)
|
||||
if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript())
|
||||
zoneScript->OnUnitDeath(this);
|
||||
}
|
||||
else if (s == JUST_RESPAWNED)
|
||||
else if (s == DeathState::JustRespawned)
|
||||
{
|
||||
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
|
||||
}
|
||||
@@ -15420,9 +15420,9 @@ void Unit::SetLevel(uint8 lvl, bool showLevelChange)
|
||||
|
||||
void Unit::SetHealth(uint32 val)
|
||||
{
|
||||
if (getDeathState() == JUST_DIED)
|
||||
if (getDeathState() == DeathState::JustDied)
|
||||
val = 0;
|
||||
else if (GetTypeId() == TYPEID_PLAYER && getDeathState() == DEAD)
|
||||
else if (GetTypeId() == TYPEID_PLAYER && getDeathState() == DeathState::Dead)
|
||||
val = 1;
|
||||
else
|
||||
{
|
||||
@@ -18086,12 +18086,12 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
|
||||
|
||||
if (!spiritOfRedemption)
|
||||
{
|
||||
LOG_DEBUG("entities.unit", "SET JUST_DIED");
|
||||
victim->setDeathState(JUST_DIED);
|
||||
LOG_DEBUG("entities.unit", "SET DeathState::JustDied");
|
||||
victim->setDeathState(DeathState::JustDied);
|
||||
}
|
||||
|
||||
// Inform pets (if any) when player kills target)
|
||||
// MUST come after victim->setDeathState(JUST_DIED); or pet next target
|
||||
// MUST come after victim->setDeathState(DeathState::JustDied); or pet next target
|
||||
// selection will get stuck on same target and break pet react state
|
||||
if (player)
|
||||
{
|
||||
@@ -20105,8 +20105,8 @@ void Unit::_ExitVehicle(Position const* exitPosition)
|
||||
if (HasUnitTypeMask(UNIT_MASK_ACCESSORY))
|
||||
{
|
||||
// Vehicle just died, we die too
|
||||
if (vehicleBase->getDeathState() == JUST_DIED)
|
||||
setDeathState(JUST_DIED);
|
||||
if (vehicleBase->getDeathState() == DeathState::JustDied)
|
||||
setDeathState(DeathState::JustDied);
|
||||
// If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user