[11490] Alow implicit cast ObjectGuid->uint64 and only explicit uint64->ObjectGuid

Now safe allow this casts in like way after completed convertion to ObjectGuid use.
Also simplify code in result allowed auto cast to uint64.

Please _not_ add new uint64 storages (local and in structures) for guid values.
This commit is contained in:
VladimirMangos 2011-05-15 22:01:16 +04:00
parent ecdb435b1e
commit 249fb836ca
47 changed files with 194 additions and 210 deletions

View file

@ -938,7 +938,7 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode )
for(std::map<uint32, ObjectGuid>::const_iterator map_itr = affectedSelf.begin(); map_itr != affectedSelf.end(); ++map_itr)
{
Item* item = pTarget && !map_itr->second.IsEmpty() ? pTarget->GetItemByGuid(map_itr->second) : NULL;
Item* item = pTarget && map_itr->second ? pTarget->GetItemByGuid(map_itr->second) : NULL;
target->RemoveAurasDueToSpell(map_itr->first);
target->CastSpell(target, map_itr->first, true, item);
}
@ -1048,7 +1048,7 @@ void Aura::TriggerSpell()
ObjectGuid casterGUID = GetCasterGuid();
Unit* triggerTarget = GetTriggerTarget();
if (casterGUID.IsEmpty() || !triggerTarget)
if (!casterGUID || !triggerTarget)
return;
// generic casting code with custom spells and target/caster customs
@ -1888,7 +1888,7 @@ void Aura::TriggerSpellWithValue()
ObjectGuid casterGuid = GetCasterGuid();
Unit* target = GetTriggerTarget();
if (casterGuid.IsEmpty() || !target)
if (!casterGuid || !target)
return;
// generic casting code with custom spells and target/caster customs
@ -6662,7 +6662,7 @@ void Aura::HandleAuraRetainComboPoints(bool apply, bool Real)
// combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
// remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
if (!apply && m_removeMode == AURA_REMOVE_BY_EXPIRE && !target->GetComboTargetGuid().IsEmpty())
if (!apply && m_removeMode == AURA_REMOVE_BY_EXPIRE && target->GetComboTargetGuid())
if (Unit* unit = ObjectAccessor::GetUnit(*GetTarget(),target->GetComboTargetGuid()))
target->AddComboPoints(unit, -m_modifier.m_amount);
}
@ -8366,7 +8366,7 @@ void SpellAuraHolder::_AddSpellAuraHolder()
{
if (m_spellProto->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE)
{
Item* castItem = !m_castItemGuid.IsEmpty() ? ((Player*)caster)->GetItemByGuid(m_castItemGuid) : NULL;
Item* castItem = m_castItemGuid ? ((Player*)caster)->GetItemByGuid(m_castItemGuid) : NULL;
((Player*)caster)->AddSpellAndCategoryCooldowns(m_spellProto,castItem ? castItem->GetEntry() : 0, NULL,true);
}
}
@ -8682,7 +8682,7 @@ Unit* SpellAuraHolder::GetCaster() const
bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder const* ref) const
{
// only item casted spells
if (GetCastItemGuid().IsEmpty())
if (!GetCastItemGuid())
return false;
// Exclude Debuffs
@ -8711,7 +8711,7 @@ bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder const* ref) co
return false;
// form different weapons
return !ref->GetCastItemGuid().IsEmpty() && ref->GetCastItemGuid() != GetCastItemGuid();
return ref->GetCastItemGuid() && ref->GetCastItemGuid() != GetCastItemGuid();
}
bool SpellAuraHolder::IsNeedVisibleSlot(Unit const* caster) const