aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-03-20 14:38:53 -0600
committermegamage <none@none>2009-03-20 14:38:53 -0600
commitf3a543bef3690dae643653ff97120db17ba13d34 (patch)
tree528df51a75e0c38c1e3002107adeed598005b9c7 /src
parent4776c384aa7f13ba094e361082db234ec35bfaae (diff)
*Do not delete charminfo for guardian.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Creature.h2
-rw-r--r--src/game/SpellEffects.cpp2
-rw-r--r--src/game/Unit.cpp6
3 files changed, 5 insertions, 5 deletions
diff --git a/src/game/Creature.h b/src/game/Creature.h
index bc59826ce51..d733ccd98b7 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -446,7 +446,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const;
uint32 GetEquipmentId() const { return m_equipmentId; }
- uint32 GetSummonMask() const { return m_summonMask; }
+ uint32 HasSummonMask(uint32 mask) const { return mask & m_summonMask; }
bool isSummon() const { return m_summonMask & SUMMON_MASK_SUMMON; }
bool isPet() const { return m_summonMask & SUMMON_MASK_PET; }
bool isVehicle() const { return m_summonMask & SUMMON_MASK_VEHICLE; }
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 775ac762cd2..d6995420d40 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -6615,7 +6615,7 @@ void Spell::SummonGuardian(uint32 entry, SummonPropertiesEntry const *properties
if(!summon)
return;
- if(summon->GetSummonMask() | SUMMON_MASK_GUARDIAN)
+ if(summon->HasSummonMask(SUMMON_MASK_GUARDIAN))
((Guardian*)summon)->InitStatsForLevel(level);
summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 77f0a0eb4c3..94baed9e8d3 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -13228,7 +13228,7 @@ void Unit::SetCharmedOrPossessedBy(Unit* charmer, bool possess)
}
// Pets already have a properly initialized CharmInfo, don't overwrite it.
- if(GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT && !((Creature*)this)->isPet())
+ if(GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT && !((Creature*)this)->HasSummonMask(SUMMON_MASK_GUARDIAN))
{
CharmInfo *charmInfo = InitCharmInfo();
if(possess)
@@ -13347,9 +13347,9 @@ void Unit::RemoveCharmedOrPossessedBy(Unit *charmer)
}
}
- if(GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT && !((Creature*)this)->isPet())
+ //a guardian should always have charminfo
+ if(GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT && !((Creature*)this)->HasSummonMask(SUMMON_MASK_GUARDIAN))
{
- //TODO: this will cause crash when a guardian is charmed
DeleteCharmInfo();
}