mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[10695] Cleanup some death state enums usage.
This commit is contained in:
parent
bb3663d94f
commit
d2b3981631
5 changed files with 20 additions and 18 deletions
|
|
@ -557,7 +557,7 @@ void Creature::Update(uint32 update_diff, uint32 tick_diff)
|
||||||
m_regenTimer = REGEN_TIME_FULL;
|
m_regenTimer = REGEN_TIME_FULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DEAD_FALLING:
|
case CORPSE_FALLING:
|
||||||
{
|
{
|
||||||
SetDeathState(CORPSE);
|
SetDeathState(CORPSE);
|
||||||
}
|
}
|
||||||
|
|
@ -1396,7 +1396,7 @@ void Creature::SetDeathState(DeathState s)
|
||||||
UpdateSpeed(MOVE_RUN, false);
|
UpdateSpeed(MOVE_RUN, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return, since we promote to DEAD_FALLING. DEAD_FALLING is promoted to CORPSE at next update.
|
// return, since we promote to CORPSE_FALLING. CORPSE_FALLING is promoted to CORPSE at next update.
|
||||||
if (CanFly() && FallGround())
|
if (CanFly() && FallGround())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1422,7 +1422,7 @@ void Creature::SetDeathState(DeathState s)
|
||||||
|
|
||||||
bool Creature::FallGround()
|
bool Creature::FallGround()
|
||||||
{
|
{
|
||||||
// Only if state is JUST_DIED. DEAD_FALLING is set below and promoted to CORPSE later
|
// Only if state is JUST_DIED. CORPSE_FALLING is set below and promoted to CORPSE later
|
||||||
if (getDeathState() != JUST_DIED)
|
if (getDeathState() != JUST_DIED)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -1439,7 +1439,7 @@ bool Creature::FallGround()
|
||||||
if (fabs(GetPositionZ() - tz) < 0.1f)
|
if (fabs(GetPositionZ() - tz) < 0.1f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Unit::SetDeathState(DEAD_FALLING);
|
Unit::SetDeathState(CORPSE_FALLING);
|
||||||
|
|
||||||
float dz = tz - GetPositionZ();
|
float dz = tz - GetPositionZ();
|
||||||
float distance = sqrt(dz*dz);
|
float distance = sqrt(dz*dz);
|
||||||
|
|
@ -1474,7 +1474,7 @@ void Creature::Respawn()
|
||||||
SetVisibility(currentVis); // restore visibility state
|
SetVisibility(currentVis); // restore visibility state
|
||||||
UpdateObjectVisibility();
|
UpdateObjectVisibility();
|
||||||
|
|
||||||
if(getDeathState() == DEAD)
|
if (IsDespawned())
|
||||||
{
|
{
|
||||||
if (m_DBTableGuid)
|
if (m_DBTableGuid)
|
||||||
sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(), 0);
|
sObjectMgr.SaveCreatureRespawnTime(m_DBTableGuid,GetInstanceId(), 0);
|
||||||
|
|
|
||||||
|
|
@ -412,6 +412,8 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
||||||
bool IsTotem() const { return m_subtype == CREATURE_SUBTYPE_TOTEM; }
|
bool IsTotem() const { return m_subtype == CREATURE_SUBTYPE_TOTEM; }
|
||||||
bool IsTemporarySummon() const { return m_subtype == CREATURE_SUBTYPE_TEMPORARY_SUMMON; }
|
bool IsTemporarySummon() const { return m_subtype == CREATURE_SUBTYPE_TEMPORARY_SUMMON; }
|
||||||
|
|
||||||
|
bool IsCorpse() const { return getDeathState() == CORPSE; }
|
||||||
|
bool IsDespawned() const { return getDeathState() == DEAD; }
|
||||||
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
|
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
|
||||||
bool IsRacialLeader() const { return GetCreatureInfo()->RacialLeader; }
|
bool IsRacialLeader() const { return GetCreatureInfo()->RacialLeader; }
|
||||||
bool IsCivilian() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
|
bool IsCivilian() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 tick_diff)
|
||||||
|
|
||||||
case TEMPSUMMON_CORPSE_TIMED_DESPAWN:
|
case TEMPSUMMON_CORPSE_TIMED_DESPAWN:
|
||||||
{
|
{
|
||||||
if (m_deathState == CORPSE)
|
if (IsCorpse())
|
||||||
{
|
{
|
||||||
if (m_timer <= update_diff)
|
if (m_timer <= update_diff)
|
||||||
{
|
{
|
||||||
|
|
@ -78,7 +78,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 tick_diff)
|
||||||
case TEMPSUMMON_CORPSE_DESPAWN:
|
case TEMPSUMMON_CORPSE_DESPAWN:
|
||||||
{
|
{
|
||||||
// if m_deathState is DEAD, CORPSE was skipped
|
// if m_deathState is DEAD, CORPSE was skipped
|
||||||
if (m_deathState == CORPSE || m_deathState == DEAD)
|
if (isDead())
|
||||||
{
|
{
|
||||||
UnSummon();
|
UnSummon();
|
||||||
return;
|
return;
|
||||||
|
|
@ -88,7 +88,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 tick_diff)
|
||||||
}
|
}
|
||||||
case TEMPSUMMON_DEAD_DESPAWN:
|
case TEMPSUMMON_DEAD_DESPAWN:
|
||||||
{
|
{
|
||||||
if (m_deathState == DEAD)
|
if (IsDespawned())
|
||||||
{
|
{
|
||||||
UnSummon();
|
UnSummon();
|
||||||
return;
|
return;
|
||||||
|
|
@ -98,7 +98,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 tick_diff)
|
||||||
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
|
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
|
||||||
{
|
{
|
||||||
// if m_deathState is DEAD, CORPSE was skipped
|
// if m_deathState is DEAD, CORPSE was skipped
|
||||||
if (m_deathState == CORPSE || m_deathState == DEAD)
|
if (isDead())
|
||||||
{
|
{
|
||||||
UnSummon();
|
UnSummon();
|
||||||
return;
|
return;
|
||||||
|
|
@ -121,7 +121,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 tick_diff)
|
||||||
case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN:
|
case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN:
|
||||||
{
|
{
|
||||||
// if m_deathState is DEAD, CORPSE was skipped
|
// if m_deathState is DEAD, CORPSE was skipped
|
||||||
if (m_deathState == DEAD)
|
if (IsDespawned())
|
||||||
{
|
{
|
||||||
UnSummon();
|
UnSummon();
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -403,12 +403,12 @@ enum BaseModType
|
||||||
|
|
||||||
enum DeathState
|
enum DeathState
|
||||||
{
|
{
|
||||||
ALIVE = 0,
|
ALIVE = 0, // show as alive
|
||||||
JUST_DIED = 1,
|
JUST_DIED = 1, // temporary state at die, for creature auto converted to CORPSE, for player at next update call
|
||||||
CORPSE = 2,
|
CORPSE = 2, // corpse state, for player this also meaning that player not leave corpse
|
||||||
DEAD = 3,
|
DEAD = 3, // for creature despawned state (corpse despawned), for player CORPSE/DEAD not clear way switches (FIXME), and use m_deathtimer > 0 check for real corpse state
|
||||||
JUST_ALIVED = 4,
|
JUST_ALIVED = 4, // temporary state at resurrection, for creature auto converted to ALIVE, for player at next update call
|
||||||
DEAD_FALLING= 5
|
CORPSE_FALLING = 5 // corpse state in case when corpse still falling to ground
|
||||||
};
|
};
|
||||||
|
|
||||||
// internal state flags for some auras and movement generators, other.
|
// internal state flags for some auras and movement generators, other.
|
||||||
|
|
@ -1478,7 +1478,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
||||||
|
|
||||||
bool isAlive() const { return (m_deathState == ALIVE); };
|
bool isAlive() const { return (m_deathState == ALIVE); };
|
||||||
bool isDead() const { return ( m_deathState == DEAD || m_deathState == CORPSE ); };
|
bool isDead() const { return ( m_deathState == DEAD || m_deathState == CORPSE ); };
|
||||||
DeathState getDeathState() { return m_deathState; };
|
DeathState getDeathState() const { return m_deathState; };
|
||||||
virtual void SetDeathState(DeathState s); // overwritten in Creature/Player/Pet
|
virtual void SetDeathState(DeathState s); // overwritten in Creature/Player/Pet
|
||||||
|
|
||||||
ObjectGuid const& GetOwnerGuid() const { return GetGuidValue(UNIT_FIELD_SUMMONEDBY); }
|
ObjectGuid const& GetOwnerGuid() const { return GetGuidValue(UNIT_FIELD_SUMMONEDBY); }
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10694"
|
#define REVISION_NR "10695"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue