diff options
author | megamage <none@none> | 2009-05-30 22:15:05 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-30 22:15:05 -0500 |
commit | 8d1f4f9ea0beb503e2a3014abb95263e501ef1c5 (patch) | |
tree | 41d48951c315129dee817befa40d4dab90d3fd14 /src/game/GameObject.cpp | |
parent | b5778357d9d8c5fb10da5d99c46b48250578cb49 (diff) |
*Provide another way to implement dynamic spawns. Now a creature will call its zonescript before spawn to determine the spawned entry. This can be used to implement zones such as wintergrasp with less data requirement (only need to know the entry of counterpart creatures, not require spawn points)
*Use zonescript as basic class of opvp script and dugeon script (can also be used for bg)
*Store zonescript in worldobject.
*Add door for sapphiron.
--HG--
branch : trunk
Diffstat (limited to 'src/game/GameObject.cpp')
-rw-r--r-- | src/game/GameObject.cpp | 26 |
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; } |