aboutsummaryrefslogtreecommitdiff
path: root/src/game/Object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r--src/game/Object.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index d84e2b7c07e..eeedcc05188 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1623,6 +1623,11 @@ Map* WorldObject::GetMap() const
return MapManager::Instance().GetMap(GetMapId(), this);
}
+Map* WorldObject::FindMap() const
+{
+ return MapManager::Instance().FindMap(GetMapId(), GetInstanceId());
+}
+
Map const* WorldObject::GetBaseMap() const
{
return MapManager::Instance().GetBaseMap(GetMapId());
@@ -1694,13 +1699,14 @@ TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float a
TempSummon* WorldObject::SummonCreature(uint32 entry, float x, float y, float z, float ang, TempSummonType spwtype, uint32 duration)
{
- if(!IsInWorld())
+ Map *map = FindMap();
+ if(!map)
return NULL;
if (x == 0.0f && y == 0.0f && z == 0.0f)
GetClosePoint(x, y, z, GetObjectSize());
- TempSummon *pCreature = GetMap()->SummonCreature(entry, x, y, z, ang, NULL, duration, GetTypeId() == TYPEID_UNIT ? (Unit*)this : NULL);
+ TempSummon *pCreature = map->SummonCreature(entry, x, y, z, ang, NULL, duration, GetTypeId() == TYPEID_UNIT ? (Unit*)this : NULL);
if(!pCreature)
return NULL;
@@ -1817,7 +1823,6 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
pet->GetCharmInfo()->SetPetNumber(pet_number, false);
pet->AIM_Initialize();
-
map->Add((Creature*)pet);
pet->setPowerType(POWER_MANA);