Skip to content

Commit

Permalink
[10630] Convert Set(Get)ChannelObjectGuid to ObjectGuid way.
Browse files Browse the repository at this point in the history
Also fix typo in debug output for prev. commit.
  • Loading branch information
VladimirMangos committed Oct 20, 2010
1 parent 888c53f commit 16c6cd0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/game/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15356,14 +15356,13 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
std::string taxi_nodes = fields[37].GetCppString();

// clear channel spell data (if saved at channel spell casting)
SetChannelObjectGUID(0);
SetChannelObjectGuid(ObjectGuid());
SetUInt32Value(UNIT_CHANNEL_SPELL,0);

// clear charm/summon related fields
SetCharm(NULL);
SetPet(NULL);
SetTargetGuid(ObjectGuid());
SetChannelObjectGUID(0);
SetCharmerGUID(0);
SetOwnerGUID(0);
SetCreatorGUID(0);
Expand Down
6 changes: 3 additions & 3 deletions src/game/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3808,12 +3808,12 @@ void Spell::SendChannelUpdate(uint32 time)
{
m_caster->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID());

ObjectGuid target_guid = m_caster->GetChannelObjectGUID();
ObjectGuid target_guid = m_caster->GetChannelObjectGuid();
if (target_guid != m_caster->GetObjectGuid() && target_guid.IsUnit())
if (Unit* target = ObjectAccessor::GetUnit(*m_caster, target_guid))
target->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID());

m_caster->SetChannelObjectGUID(0);
m_caster->SetChannelObjectGuid(ObjectGuid());
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
}

Expand Down Expand Up @@ -3861,7 +3861,7 @@ void Spell::SendChannelStart(uint32 duration)
m_timer = duration;

if (target)
m_caster->SetChannelObjectGUID(target->GetGUID());
m_caster->SetChannelObjectGuid(target->GetObjectGuid());

m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id);
}
Expand Down
4 changes: 2 additions & 2 deletions src/game/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6892,7 +6892,7 @@ void Aura::PeriodicTick()
// ignore non positive values (can be result apply spellmods to aura damage
uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;

DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s energize %s (TypeId: %u) for %u dmg inflicted by %u",
DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s energize %s for %u dmg inflicted by %u",
GetCasterGuid().GetString().c_str(), target->GetObjectGuid().GetString().c_str(), pdamage, GetId());

if(m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS)
Expand Down Expand Up @@ -8885,7 +8885,7 @@ void SpellAuraHolder::Update(uint32 diff)
}

// need check distance for channeled target only
if (caster->GetChannelObjectGUID() == m_target->GetGUID())
if (caster->GetChannelObjectGuid() == m_target->GetObjectGuid())
{
// Get spell range
float max_range = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellProto->rangeIndex));
Expand Down
2 changes: 1 addition & 1 deletion src/game/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7774,7 +7774,7 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx)
{
case GAMEOBJECT_TYPE_FISHINGNODE:
{
m_caster->SetChannelObjectGUID(pGameObj->GetGUID());
m_caster->SetChannelObjectGuid(pGameObj->GetObjectGuid());
m_caster->AddGameObject(pGameObj); // will removed at spell cancel

// end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo))
Expand Down
4 changes: 2 additions & 2 deletions src/game/Unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -1485,8 +1485,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void SetCharmGUID(uint64 charm) { SetUInt64Value(UNIT_FIELD_CHARM, charm); }
ObjectGuid const& GetTargetGuid() const { return GetGuidValue(UNIT_FIELD_TARGET); }
void SetTargetGuid(ObjectGuid targetGuid) { SetGuidValue(UNIT_FIELD_TARGET, targetGuid); }
uint64 GetChannelObjectGUID() const { return GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT); }
void SetChannelObjectGUID(uint64 targetGuid) { SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, targetGuid); }
ObjectGuid const& GetChannelObjectGuid() const { return GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT); }
void SetChannelObjectGuid(ObjectGuid targetGuid) { SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, targetGuid); }

uint64 GetCharmerOrOwnerGUID() const { return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID(); }
uint64 GetCharmerOrOwnerOrOwnGUID() const
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10629"
#define REVISION_NR "10630"
#endif // __REVISION_NR_H__

0 comments on commit 16c6cd0

Please sign in to comment.