diff options
author | megamage <none@none> | 2009-05-03 10:45:34 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-03 10:45:34 -0500 |
commit | f6e8ccb239eaaa98bceab708a831e163d4107a3c (patch) | |
tree | 489ed002538bd17ea047d43d8dd38acc5bb082ab /src/game/TemporarySummon.cpp | |
parent | f9b13b45e09e06ce2400c5e93a97ac2459d7159c (diff) |
*Clean up summon code.
--HG--
branch : trunk
Diffstat (limited to 'src/game/TemporarySummon.cpp')
-rw-r--r-- | src/game/TemporarySummon.cpp | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp index b5ef539ab0c..ff67f19aca3 100644 --- a/src/game/TemporarySummon.cpp +++ b/src/game/TemporarySummon.cpp @@ -257,37 +257,18 @@ void TempSummon::SaveToDB() { } -bool TempSummon::SetOwner(Unit *owner, bool apply) -{ - if(apply) - { - if(!AddUInt64Value(UNIT_FIELD_SUMMONEDBY, owner->GetGUID())) - { - sLog.outCrash("Unit %u is summoned by %u but it already has a owner", GetEntry(), owner->GetEntry()); - return false; - } - if(owner->GetTypeId() == TYPEID_PLAYER) - { - m_ControlledByPlayer = true; - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - } - } - else - { - if(!RemoveUInt64Value(UNIT_FIELD_SUMMONEDBY, owner->GetGUID())) - { - sLog.outCrash("Unit %u is unsummoned by %u but it has another owner", GetEntry(), owner->GetEntry()); - return false; - } - } - - return true; -} - Minion::Minion(SummonPropertiesEntry const *properties, Unit *owner) : TempSummon(properties, owner) , m_owner(owner) { + assert(m_owner); m_summonMask |= SUMMON_MASK_MINION; + SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_owner->GetGUID()); + + if(m_owner->GetTypeId() == TYPEID_PLAYER) + { + m_ControlledByPlayer = true; + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + } } void Minion::InitSummon(uint32 duration) |