From 012c2ef51b1c0a882777b935913d7a865341f8bc Mon Sep 17 00:00:00 2001 From: stfx Date: Thu, 30 Aug 2012 12:16:34 +0200 Subject: [PATCH] [12155] Prevent saving/loading/init capture points in instances Reason for this are: 1) We don't want them saved/loaded between bg games 2) Saving cp slider is done by go id and would not work for instances 3) There are visual-only capture points in bg (eots) 4) It would be possible to only enable the capture points on bg start TODO: Move this to OutdoorPvP base class --- src/game/GameObject.cpp | 19 +++++++++++-------- src/shared/revision_nr.h | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 239eaf79c..063356a1c 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -70,10 +70,6 @@ GameObject::GameObject() : WorldObject(), GameObject::~GameObject() { - // store the capture point slider value (for non visual, non locked capture points) - GameObjectInfo const* goInfo = GetGOInfo(); - if (goInfo && goInfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT && goInfo->capturePoint.radius && m_lootState == GO_ACTIVATED) - sOutdoorPvPMgr.SetCapturePointSlider(GetEntry(), m_captureSlider); } void GameObject::AddToWorld() @@ -87,6 +83,13 @@ void GameObject::AddToWorld() void GameObject::RemoveFromWorld() { + // store the slider value for non instance, non locked capture points + if (!GetMap()->IsBattleGroundOrArena()) + { + if (GetGOInfo()->type == GAMEOBJECT_TYPE_CAPTURE_POINT && m_lootState == GO_ACTIVATED) + sOutdoorPvPMgr.SetCapturePointSlider(GetEntry(), m_captureSlider); + } + ///- Remove the gameobject from the accessor if (IsInWorld()) { @@ -162,15 +165,15 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa SetGoArtKit(0); // unknown what this is SetGoAnimProgress(animprogress); - // set initial data and activate non visual-only capture points - if (goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT && goinfo->capturePoint.radius) - SetCapturePointSlider(sOutdoorPvPMgr.GetCapturePointSliderValue(goinfo->id)); - // Notify the battleground script if (map->IsBattleGroundOrArena()) ((BattleGroundMap*)map)->GetBG()->HandleGameObjectCreate(this); else { + // set initial data and activate non instance capture points + if (goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT) + SetCapturePointSlider(sOutdoorPvPMgr.GetCapturePointSliderValue(goinfo->id)); + // Notify the outdoor pvp script if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId())) outdoorPvP->HandleGameObjectCreate(this); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9fb498aed..cac463d3d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12154" + #define REVISION_NR "12155" #endif // __REVISION_NR_H__