aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-02-20 12:05:58 -0600
committermegamage <none@none>2009-02-20 12:05:58 -0600
commit1b587c0fe3355567173918d7a0b56141c6bcd1b2 (patch)
treefd8b03d40861ec08c1fd3d47744131032f7398bd /src/game/Unit.cpp
parent187cd928ea6a02df715c349ec970d5899ef6274f (diff)
parent956c828bf56f06b5c25ff20d760ad41be2642a51 (diff)
*Merge.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 57bc0333b4c..7d430054cd9 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -7648,7 +7648,8 @@ void Unit::SetCharm(Unit* pet)
void Unit::AddPlayerToVision(Player* plr)
{
- if (m_sharedVision.empty() && GetTypeId() == TYPEID_UNIT)
+ if (m_sharedVision.empty() && GetTypeId() == TYPEID_UNIT
+ && !((Creature*)this)->isPet() && !((Creature*)this)->isVehicle())
{
setActive(true);
GetMap()->SwitchGridContainers((Creature*)this, true);
@@ -7660,7 +7661,8 @@ void Unit::AddPlayerToVision(Player* plr)
void Unit::RemovePlayerFromVision(Player* plr)
{
m_sharedVision.remove(plr);
- if (m_sharedVision.empty() && GetTypeId() == TYPEID_UNIT)
+ if (m_sharedVision.empty() && GetTypeId() == TYPEID_UNIT
+ && !((Creature*)this)->isPet() && !((Creature*)this)->isVehicle())
{
setActive(false);
GetMap()->SwitchGridContainers((Creature*)this, false);
@@ -12383,6 +12385,10 @@ void Unit::SetCharmedOrPossessedBy(Unit* charmer, bool possess)
if(GetTypeId() == TYPEID_PLAYER)
((Player*)this)->StopCastingCharm();
+ // StopCastingCharm may remove a possessed pet?
+ if(!IsInWorld())
+ return;
+
// Set charmed
charmer->SetCharm(this);
SetCharmerGUID(charmer->GetGUID());