aboutsummaryrefslogtreecommitdiff
path: root/src/game/GameObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/GameObject.cpp')
-rw-r--r--src/game/GameObject.cpp26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
index bb1103e2262..0cc32ce4f2d 100644
--- a/src/game/GameObject.cpp
+++ b/src/game/GameObject.cpp
@@ -83,6 +83,9 @@ void GameObject::AddToWorld()
///- Register the gameobject for guid lookup
if(!IsInWorld())
{
+ if(m_zoneScript)
+ m_zoneScript->OnGameObjectCreate(this, true);
+
ObjectAccessor::Instance().AddObject(this);
WorldObject::AddToWorld();
}
@@ -93,16 +96,8 @@ void GameObject::RemoveFromWorld()
///- Remove the gameobject from the accessor
if(IsInWorld())
{
- if(Map *map = FindMap())
- if(map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData())
- ((InstanceMap*)map)->GetInstanceData()->OnObjectCreate(this, false);
-
- switch(m_goInfo->type)
- {
- case GAMEOBJECT_TYPE_CAPTURE_POINT:
- sOutdoorPvPMgr.OnGameObjectCreate(this, false);
- break;
- }
+ if(m_zoneScript)
+ m_zoneScript->OnGameObjectCreate(this, false);
// Possible crash at access to deleted GO in Unit::m_gameobj
if(uint64 owner_guid = GetOwnerGUID())
@@ -181,18 +176,9 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
m_goValue->destructibleBuilding.health = goinfo->destructibleBuilding.damagedHealth;
break;
- case GAMEOBJECT_TYPE_CAPTURE_POINT:
- sOutdoorPvPMgr.OnGameObjectCreate(this, true);
- break;
}
- //Notify the map's instance data.
- //Only works if you create the object in it, not if it is moves to that map.
- //Normally non-players do not teleport to other maps.
- if(map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData())
- {
- ((InstanceMap*)map)->GetInstanceData()->OnObjectCreate(this, true);
- }
+ SetZoneScript();
return true;
}