aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
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());