[12019] Various changes

* Add some const correctness
* Remove unused Unit::isHover() function
* Help compiler optimize code from last commit (thx to vladimir)
This commit is contained in:
Schmoozerd 2012-06-25 14:41:31 +02:00
parent 6d49f2bbee
commit 01b6c6b8f4
4 changed files with 7 additions and 8 deletions

View file

@ -2170,7 +2170,8 @@ bool Creature::HasSpellCooldown(uint32 spell_id) const
uint8 Creature::getRace() const uint8 Creature::getRace() const
{ {
return Unit::getRace() ? Unit::getRace() : GetCreatureModelRace(GetNativeDisplayId()); uint8 race = Unit::getRace();
return race ? race : GetCreatureModelRace(GetNativeDisplayId());
} }
bool Creature::IsInEvadeMode() const bool Creature::IsInEvadeMode() const

View file

@ -8625,7 +8625,7 @@ void Unit::TauntFadeOut(Unit *taunter)
//====================================================================== //======================================================================
bool Unit::IsSecondChoiceTarget(Unit* pTarget, bool checkThreatArea) bool Unit::IsSecondChoiceTarget(Unit* pTarget, bool checkThreatArea) const
{ {
MANGOS_ASSERT(pTarget && GetTypeId() == TYPEID_UNIT); MANGOS_ASSERT(pTarget && GetTypeId() == TYPEID_UNIT);

View file

@ -1387,7 +1387,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
bool IsIgnoreUnitState(SpellEntry const *spell, IgnoreUnitState ignoreState); bool IsIgnoreUnitState(SpellEntry const *spell, IgnoreUnitState ignoreState);
bool isTargetableForAttack(bool inversAlive = false) const; bool isTargetableForAttack(bool inversAlive = false) const;
bool isPassiveToHostile() { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); } bool isPassiveToHostile() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); }
virtual bool IsInWater() const; virtual bool IsInWater() const;
virtual bool IsUnderWater() const; virtual bool IsUnderWater() const;
@ -1673,7 +1673,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void AddThreat(Unit* pVictim, float threat = 0.0f, bool crit = false, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NONE, SpellEntry const *threatSpell = NULL); void AddThreat(Unit* pVictim, float threat = 0.0f, bool crit = false, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NONE, SpellEntry const *threatSpell = NULL);
float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL); float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
void DeleteThreatList(); void DeleteThreatList();
bool IsSecondChoiceTarget(Unit* pTarget, bool checkThreatArea); bool IsSecondChoiceTarget(Unit* pTarget, bool checkThreatArea) const;
bool SelectHostileTarget(); bool SelectHostileTarget();
void TauntApply(Unit* pVictim); void TauntApply(Unit* pVictim);
void TauntFadeOut(Unit *taunter); void TauntFadeOut(Unit *taunter);
@ -1845,8 +1845,6 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
float GetSpeedRate( UnitMoveType mtype ) const { return m_speed_rate[mtype]; } float GetSpeedRate( UnitMoveType mtype ) const { return m_speed_rate[mtype]; }
void SetSpeedRate(UnitMoveType mtype, float rate, bool forced = false); void SetSpeedRate(UnitMoveType mtype, float rate, bool forced = false);
bool isHover() const { return HasAuraType(SPELL_AURA_HOVER); }
void KnockBackFrom(Unit* target, float horizontalSpeed, float verticalSpeed); void KnockBackFrom(Unit* target, float horizontalSpeed, float verticalSpeed);
void _RemoveAllAuraMods(); void _RemoveAllAuraMods();
@ -1908,7 +1906,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void _SetAINotifyScheduled(bool on) { m_AINotifyScheduled = on;} // only for call from RelocationNotifyEvent code void _SetAINotifyScheduled(bool on) { m_AINotifyScheduled = on;} // only for call from RelocationNotifyEvent code
void OnRelocated(); void OnRelocated();
bool IsLinkingEventTrigger() { return m_isCreatureLinkingTrigger; } bool IsLinkingEventTrigger() const { return m_isCreatureLinkingTrigger; }
protected: protected:
explicit Unit (); explicit Unit ();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12018" #define REVISION_NR "12019"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__