diff options
| author | leak <none@none> | 2010-12-05 18:04:10 +0100 |
|---|---|---|
| committer | leak <none@none> | 2010-12-05 18:04:10 +0100 |
| commit | 6fe19b5a863dd1109700c8a28dad22a8c3b7526c (patch) | |
| tree | 65b29925addfe35b78125e0527b1092798411597 /src/server/game | |
| parent | dfa1e9532bef9e06fd20afcca800e37cb9783497 (diff) | |
Core/Scripts: Split OnCreatureCreate() and OnGameObjectCreate() into two virtual functions each.
Note to scripters: be aware that you will need to hook into the Remove functions if you want to do stuff at GO/creature removal.
Closes issue 5011.
--HG--
branch : trunk
Diffstat (limited to 'src/server/game')
| -rwxr-xr-x | src/server/game/Entities/Creature/Creature.cpp | 4 | ||||
| -rwxr-xr-x | src/server/game/Entities/GameObject/GameObject.cpp | 4 | ||||
| -rwxr-xr-x | src/server/game/Maps/ZoneScript.h | 6 | ||||
| -rwxr-xr-x | src/server/game/OutdoorPvP/OutdoorPvP.cpp | 4 | ||||
| -rwxr-xr-x | src/server/game/OutdoorPvP/OutdoorPvP.h | 4 |
5 files changed, 12 insertions, 10 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 6c943721b5b..4b5c8ae4223 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -182,7 +182,7 @@ void Creature::AddToWorld() if (!IsInWorld()) { if (m_zoneScript) - m_zoneScript->OnCreatureCreate(this, true); + m_zoneScript->OnCreatureCreate(this); sObjectAccessor.AddObject(this); Unit::AddToWorld(); SearchFormation(); @@ -197,7 +197,7 @@ void Creature::RemoveFromWorld() if (IsInWorld()) { if (m_zoneScript) - m_zoneScript->OnCreatureCreate(this, false); + m_zoneScript->OnCreatureRemove(this); if (m_formation) formation_mgr.RemoveCreatureFromGroup(m_formation, this); Unit::RemoveFromWorld(); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 5cf6240bea6..dc85d618993 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -125,7 +125,7 @@ void GameObject::AddToWorld() if (!IsInWorld()) { if (m_zoneScript) - m_zoneScript->OnGameObjectCreate(this, true); + m_zoneScript->OnGameObjectCreate(this); sObjectAccessor.AddObject(this); WorldObject::AddToWorld(); @@ -138,7 +138,7 @@ void GameObject::RemoveFromWorld() if (IsInWorld()) { if (m_zoneScript) - m_zoneScript->OnGameObjectCreate(this, false); + m_zoneScript->OnGameObjectRemove(this); // Possible crash at access to deleted GO in Unit::m_gameobj if (uint64 owner_guid = GetOwnerGUID()) diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h index ae38ea4dd24..b7bec3b353f 100755 --- a/src/server/game/Maps/ZoneScript.h +++ b/src/server/game/Maps/ZoneScript.h @@ -33,8 +33,10 @@ class ZoneScript virtual uint32 GetCreatureEntry(uint32 /*guidlow*/, const CreatureData *data) { return data->id; } virtual uint32 GetGameObjectEntry(uint32 /*guidlow*/, uint32 entry) { return entry; } - virtual void OnCreatureCreate(Creature *, bool /*add*/) {} - virtual void OnGameObjectCreate(GameObject * /*go*/, bool /*add*/) {} + virtual void OnCreatureCreate(Creature *) {} + virtual void OnCreatureRemove(Creature *) {} + virtual void OnGameObjectCreate(GameObject *) {} + virtual void OnGameObjectRemove(GameObject *) {} //All-purpose data storage 64 bit virtual uint64 GetData64(uint32 /*DataId*/) { return 0; } diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 88b02cb9661..878cc3325f7 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -590,11 +590,11 @@ void OutdoorPvP::TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2) TeamCastSpell(OTHER_TEAM(team), spellId2 ? -(int32)spellId2 : -(int32)spellId); } -void OutdoorPvP::OnGameObjectCreate(GameObject *go, bool add) +void OutdoorPvP::OnGameObjectCreate(GameObject *go) { if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT) return; if (OPvPCapturePoint *cp = GetCapturePoint(go->GetDBTableGUIDLow())) - cp->m_capturePoint = add ? go : NULL; + cp->m_capturePoint = go; } diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h index d3ec99034e9..a66c3c129fd 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.h @@ -219,8 +219,8 @@ class OutdoorPvP : public ZoneScript // setup stuff virtual bool SetupOutdoorPvP() {return true;} - void OnGameObjectCreate(GameObject *go, bool add); - void OnCreatureCreate(Creature *, bool /*add*/) {} + void OnGameObjectCreate(GameObject *go); + void OnCreatureCreate(Creature *) {} // send world state update to all players present void SendUpdateWorldState(uint32 field, uint32 value); |
