Codestyle: Renamed some variables to fit codestyle, corrected order in structure/class fields to match alignment (they use slightly less memory now)

Signed-off-by: Subv <[email protected]>
This commit is contained in:
Subv
2012-02-14 12:46:26 -05:00
parent f1182f0884
commit 8a72aede16
26 changed files with 967 additions and 966 deletions
@@ -95,18 +95,19 @@ class AuraEffect
Aura* const m_base;
SpellInfo const* const m_spellInfo;
uint8 const m_effIndex;
int32 const m_baseAmount;
int32 m_amount;
bool m_canBeRecalculated;
SpellModifier* m_spellmod;
bool m_isPeriodic;
int32 m_periodicTimer;
int32 m_amplitude;
uint32 m_tickNumber;
uint8 const m_effIndex;
bool m_canBeRecalculated;
bool m_isPeriodic;
private:
bool IsPeriodicTickCrit(Unit* target, Unit const* caster) const;
+18 -18
View File
@@ -37,8 +37,8 @@
#include "Vehicle.h"
AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint8 effMask):
m_target(target), m_base(aura), m_slot(MAX_AURAS), m_flags(AFLAG_NONE),
m_effectsToApply(effMask), m_removeMode(AURA_REMOVE_NONE), m_needClientUpdate(false)
_target(target), _base(aura), _slot(MAX_AURAS), _flags(AFLAG_NONE),
_effectsToApply(effMask), _removeMode(AURA_REMOVE_NONE), _needClientUpdate(false)
{
ASSERT(GetTarget() && GetBase());
@@ -70,7 +70,7 @@ m_effectsToApply(effMask), m_removeMode(AURA_REMOVE_NONE), m_needClientUpdate(fa
// Register Visible Aura
if (slot < MAX_AURAS)
{
m_slot = slot;
_slot = slot;
GetTarget()->SetVisibleAura(slot, this);
SetNeedClientUpdate();
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura: %u Effect: %d put to unit visible auras slot: %u", GetBase()->GetId(), GetEffectMask(), slot);
@@ -89,7 +89,7 @@ void AuraApplication::_Remove()
if (slot >= MAX_AURAS)
return;
if (AuraApplication * foundAura = m_target->GetAuraApplication(GetBase()->GetId(), GetBase()->GetCasterGUID(), GetBase()->GetCastItemGUID()))
if (AuraApplication * foundAura = _target->GetAuraApplication(GetBase()->GetId(), GetBase()->GetCasterGUID(), GetBase()->GetCastItemGUID()))
{
// Reuse visible aura slot by aura which is still applied - prevent storing dead pointers
if (slot == foundAura->GetSlot())
@@ -115,7 +115,7 @@ void AuraApplication::_Remove()
void AuraApplication::_InitFlags(Unit* caster, uint8 effMask)
{
// mark as selfcasted if needed
m_flags |= (GetBase()->GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_CASTER : AFLAG_NONE;
_flags |= (GetBase()->GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_CASTER : AFLAG_NONE;
// aura is casted by self or an enemy
// one negative effect and we know aura is negative
@@ -130,7 +130,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask)
break;
}
}
m_flags |= negativeFound ? AFLAG_NEGATIVE : AFLAG_POSITIVE;
_flags |= negativeFound ? AFLAG_NEGATIVE : AFLAG_POSITIVE;
}
// aura is casted by friend
// one positive effect and we know aura is positive
@@ -145,7 +145,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask)
break;
}
}
m_flags |= positiveFound ? AFLAG_POSITIVE : AFLAG_NEGATIVE;
_flags |= positiveFound ? AFLAG_POSITIVE : AFLAG_NEGATIVE;
}
}
@@ -154,19 +154,19 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)
AuraEffect* aurEff = GetBase()->GetEffect(effIndex);
ASSERT(aurEff);
ASSERT(HasEffect(effIndex) == (!apply));
ASSERT((1<<effIndex) & m_effectsToApply);
ASSERT((1<<effIndex) & _effectsToApply);
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraApplication::_HandleEffect: %u, apply: %u: amount: %u", aurEff->GetAuraType(), apply, aurEff->GetAmount());
if (apply)
{
ASSERT(!(m_flags & (1<<effIndex)));
m_flags |= 1<<effIndex;
ASSERT(!(_flags & (1<<effIndex)));
_flags |= 1<<effIndex;
aurEff->HandleEffect(this, AURA_EFFECT_HANDLE_REAL, true);
}
else
{
ASSERT(m_flags & (1<<effIndex));
m_flags &= ~(1<<effIndex);
ASSERT(_flags & (1<<effIndex));
_flags &= ~(1<<effIndex);
aurEff->HandleEffect(this, AURA_EFFECT_HANDLE_REAL, false);
// Remove all triggered by aura spells vs unlimited duration
@@ -177,19 +177,19 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)
void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const
{
data << uint8(m_slot);
data << uint8(_slot);
if (remove)
{
ASSERT(!m_target->GetVisibleAura(m_slot));
ASSERT(!_target->GetVisibleAura(_slot));
data << uint32(0);
return;
}
ASSERT(m_target->GetVisibleAura(m_slot));
ASSERT(_target->GetVisibleAura(_slot));
Aura const* aura = GetBase();
data << uint32(aura->GetId());
uint32 flags = m_flags;
uint32 flags = _flags;
if (aura->GetMaxDuration() > 0 && !(aura->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_HIDE_DURATION))
flags |= AFLAG_DURATION;
data << uint8(flags);
@@ -210,13 +210,13 @@ void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const
void AuraApplication::ClientUpdate(bool remove)
{
m_needClientUpdate = false;
_needClientUpdate = false;
WorldPacket data(SMSG_AURA_UPDATE);
data.append(GetTarget()->GetPackGUID());
BuildUpdatePacket(data, remove);
m_target->SendMessageToSet(&data, true);
_target->SendMessageToSet(&data, true);
}
uint8 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner)
+20 -20
View File
@@ -46,13 +46,13 @@ class AuraApplication
friend void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode);
friend AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask);
private:
Unit* const m_target;
Aura* const m_base;
uint8 m_slot; // Aura slot on unit
uint8 m_flags; // Aura info flag
uint8 m_effectsToApply; // Used only at spell hit to determine which effect should be applied
AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason
bool m_needClientUpdate:1;
Unit* const _target;
Aura* const _base;
AuraRemoveMode _removeMode:8; // Store info for know remove aura reason
uint8 _slot; // Aura slot on unit
uint8 _flags; // Aura info flag
uint8 _effectsToApply; // Used only at spell hit to determine which effect should be applied
bool _needClientUpdate:1;
explicit AuraApplication(Unit* target, Unit* caster, Aura* base, uint8 effMask);
void _Remove();
@@ -61,22 +61,22 @@ class AuraApplication
void _HandleEffect(uint8 effIndex, bool apply);
public:
Unit* GetTarget() const { return m_target; }
Aura* GetBase() const { return m_base; }
Unit* GetTarget() const { return _target; }
Aura* GetBase() const { return _base; }
uint8 GetSlot() const { return m_slot; }
uint8 GetFlags() const { return m_flags; }
uint8 GetEffectMask() const { return m_flags & (AFLAG_EFF_INDEX_0 | AFLAG_EFF_INDEX_1 | AFLAG_EFF_INDEX_2); }
bool HasEffect(uint8 effect) const { ASSERT(effect < MAX_SPELL_EFFECTS); return m_flags & (1<<effect); }
bool IsPositive() const { return m_flags & AFLAG_POSITIVE; }
bool IsSelfcasted() const { return m_flags & AFLAG_CASTER; }
uint8 GetEffectsToApply() const { return m_effectsToApply; }
uint8 GetSlot() const { return _slot; }
uint8 GetFlags() const { return _flags; }
uint8 GetEffectMask() const { return _flags & (AFLAG_EFF_INDEX_0 | AFLAG_EFF_INDEX_1 | AFLAG_EFF_INDEX_2); }
bool HasEffect(uint8 effect) const { ASSERT(effect < MAX_SPELL_EFFECTS); return _flags & (1<<effect); }
bool IsPositive() const { return _flags & AFLAG_POSITIVE; }
bool IsSelfcasted() const { return _flags & AFLAG_CASTER; }
uint8 GetEffectsToApply() const { return _effectsToApply; }
void SetRemoveMode(AuraRemoveMode mode) { m_removeMode = mode; }
AuraRemoveMode GetRemoveMode() const {return m_removeMode;}
void SetRemoveMode(AuraRemoveMode mode) { _removeMode = mode; }
AuraRemoveMode GetRemoveMode() const {return _removeMode;}
void SetNeedClientUpdate() { m_needClientUpdate = true;}
bool IsNeedClientUpdate() const { return m_needClientUpdate;}
void SetNeedClientUpdate() { _needClientUpdate = true;}
bool IsNeedClientUpdate() const { return _needClientUpdate;}
void BuildUpdatePacket(ByteBuffer& data, bool remove) const;
void ClientUpdate(bool remove = false);
};