Use OutdoorPvPMgr to save/load capture point data when grid unloads

This commit is contained in:
stfx 2012-08-17 18:41:22 +02:00 committed by Antz
parent dafd0adac1
commit 525ec3ea4c

View file

@ -36,6 +36,7 @@
#include "MapPersistentStateMgr.h"
#include "BattleGround.h"
#include "BattleGroundAV.h"
#include "OutdoorPvP/OutdoorPvP.h"
#include "Util.h"
#include "ScriptMgr.h"
#include "SQLStorages.h"
@ -69,6 +70,10 @@ 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()
@ -159,7 +164,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
// set initial data and activate non visual-only capture points
if (goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT && goinfo->capturePoint.radius)
SetCapturePointSlider(CAPTURE_SLIDER_NEUTRAL);
SetCapturePointSlider(sOutdoorPvPMgr.GetCapturePointSliderValue(goinfo->id));
// Notify the map's instance data.
// Only works if you create the object in it, not if it is moves to that map.