Magic numbers cleanup:

- Replace many magic numbers with constants
- Use enum for vehicle flags/seat flags
- Correct structure for ItemRandomSuffixEntry

--HG--
branch : trunk
This commit is contained in:
Shocker
2010-09-28 08:21:51 +03:00
parent 192e972a59
commit 78803c9f09
44 changed files with 245 additions and 194 deletions
+5 -5
View File
@@ -252,7 +252,7 @@ inline float GetSpellMaxRange(uint32 id, bool positive)
inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
{
for (int i= 0; i < 3; ++i)
for (int i= 0; i < MAX_SPELL_EFFECTS; ++i)
if (SpellEffects(spellInfo->Effect[i]) == effect)
return true;
return false;
@@ -260,7 +260,7 @@ inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
inline bool IsSpellHaveAura(SpellEntry const *spellInfo, AuraType aura)
{
for (int i= 0; i < 3; ++i)
for (int i= 0; i < MAX_SPELL_EFFECTS; ++i)
if (AuraType(spellInfo->EffectApplyAuraName[i]) == aura)
return true;
return false;
@@ -386,7 +386,7 @@ inline bool IsPositionTarget(uint32 target)
inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
{
for (int i = 0; i < 3; ++i)
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
uint32 targetA = spellInfo->EffectImplicitTargetA[i];
if (targetA && !IsCasterSourceTarget(targetA))
@@ -518,7 +518,7 @@ inline uint32 GetAllSpellMechanicMask(SpellEntry const* spellInfo)
uint32 mask = 0;
if (spellInfo->Mechanic)
mask |= 1<<spellInfo->Mechanic;
for (int i=0; i< 3; ++i)
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (spellInfo->Effect[i] && spellInfo->EffectMechanic[i])
mask |= 1<<spellInfo->EffectMechanic[i];
return mask;
@@ -1352,7 +1352,7 @@ class SpellMgr
inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
{
for (int i = 0; i < 3; ++i)
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (uint32 target = spellInfo->EffectImplicitTargetA[i])
if (!IsCasterSourceTarget(target))
return false;