*Use map instead of vector to store capture points in opvp.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-19 18:17:30 -05:00
parent bd0dbcc9ad
commit 47b30023a5
8 changed files with 58 additions and 63 deletions
+19 -29
View File
@@ -117,7 +117,7 @@ bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 team, uint3
return false; return false;
} }
bool OPvPCapturePoint::AddCapturePoint(uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3) bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
{ {
sLog.outDebug("Creating capture point %u", entry); sLog.outDebug("Creating capture point %u", entry);
@@ -222,7 +222,7 @@ void OPvPCapturePoint::DeleteSpawns()
void OutdoorPvP::DeleteSpawns() void OutdoorPvP::DeleteSpawns()
{ {
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
(*itr)->DeleteSpawns(); itr->second->DeleteSpawns();
} }
OutdoorPvP::OutdoorPvP() OutdoorPvP::OutdoorPvP()
@@ -243,7 +243,7 @@ void OutdoorPvP::HandlePlayerLeaveZone(Player * plr, uint32 zone)
{ {
// inform the objectives of the leaving // inform the objectives of the leaving
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
(*itr)->HandlePlayerLeave(plr); itr->second->HandlePlayerLeave(plr);
// remove the world state information from the player (we can't keep everyone up to date, so leave out those who are not in the concerning zones) // remove the world state information from the player (we can't keep everyone up to date, so leave out those who are not in the concerning zones)
if(!plr->GetSession()->PlayerLogout()) if(!plr->GetSession()->PlayerLogout())
SendRemoveWorldStates(plr); SendRemoveWorldStates(plr);
@@ -256,9 +256,9 @@ bool OutdoorPvP::Update(uint32 diff)
bool objective_changed = false; bool objective_changed = false;
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{ {
if((*itr)->Update(diff)) if(itr->second->Update(diff))
{ {
(*itr)->ChangeState(); itr->second->ChangeState();
objective_changed = true; objective_changed = true;
} }
} }
@@ -452,7 +452,7 @@ void OutdoorPvP::HandleKill(Player *killer, Unit * killed)
bool OutdoorPvP::IsInsideObjective(Player *plr) const bool OutdoorPvP::IsInsideObjective(Player *plr) const
{ {
for(OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if((*itr)->IsInsideObjective(plr)) if(itr->second->IsInsideObjective(plr))
return true; return true;
return false; return false;
@@ -466,10 +466,9 @@ bool OPvPCapturePoint::IsInsideObjective(Player *plr) const
bool OutdoorPvP::HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go) bool OutdoorPvP::HandleCustomSpell(Player *plr, uint32 spellId, GameObject * go)
{ {
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{ if(itr->second->HandleCustomSpell(plr,spellId,go))
if((*itr)->HandleCustomSpell(plr,spellId,go))
return true; return true;
}
return false; return false;
} }
@@ -483,40 +482,36 @@ bool OPvPCapturePoint::HandleCustomSpell(Player *plr, uint32 spellId, GameObject
bool OutdoorPvP::HandleOpenGo(Player *plr, uint64 guid) bool OutdoorPvP::HandleOpenGo(Player *plr, uint64 guid)
{ {
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{ if(itr->second->HandleOpenGo(plr,guid) >= 0)
if((*itr)->HandleOpenGo(plr,guid) >= 0)
return true; return true;
}
return false; return false;
} }
bool OutdoorPvP::HandleGossipOption(Player * plr, uint64 guid, uint32 id) bool OutdoorPvP::HandleGossipOption(Player * plr, uint64 guid, uint32 id)
{ {
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{ if(itr->second->HandleGossipOption(plr, guid, id))
if((*itr)->HandleGossipOption(plr, guid, id))
return true; return true;
}
return false; return false;
} }
bool OutdoorPvP::CanTalkTo(Player * plr, Creature * c, GossipOption &gso) bool OutdoorPvP::CanTalkTo(Player * plr, Creature * c, GossipOption &gso)
{ {
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{ if(itr->second->CanTalkTo(plr, c, gso))
if((*itr)->CanTalkTo(plr, c, gso))
return true; return true;
}
return false; return false;
} }
bool OutdoorPvP::HandleDropFlag(Player * plr, uint32 id) bool OutdoorPvP::HandleDropFlag(Player * plr, uint32 id)
{ {
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{ if(itr->second->HandleDropFlag(plr, id))
if((*itr)->HandleDropFlag(plr, id))
return true; return true;
}
return false; return false;
} }
@@ -589,12 +584,7 @@ void OutdoorPvP::OnGameObjectCreate(GameObject *go, bool add)
if(go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT) if(go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT)
return; return;
for(OutdoorPvP::OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) OutdoorPvP::OPvPCapturePointMap::iterator itr = m_capturePoints.find(go->GetDBTableGUIDLow());
{ if(itr != m_capturePoints.end())
if((*itr)->m_CapturePointGUID == go->GetDBTableGUIDLow()) itr->second->m_capturePoint = add ? go : NULL;
{
(*itr)->m_capturePoint = add ? go : NULL;
break;
}
}
} }
+7 -2
View File
@@ -113,7 +113,7 @@ public:
void AddGO(uint32 type, uint32 guid, uint32 entry = 0); void AddGO(uint32 type, uint32 guid, uint32 entry = 0);
void AddCre(uint32 type, uint32 guid, uint32 entry = 0); void AddCre(uint32 type, uint32 guid, uint32 entry = 0);
bool AddCapturePoint(uint32 entry, uint32 map, float x, float y, float z, float o = 0, float rotation0 = 0, float rotation1 = 0, float rotation2 = 0, float rotation3 = 0); bool SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o = 0, float rotation0 = 0, float rotation1 = 0, float rotation2 = 0, float rotation3 = 0);
protected: protected:
@@ -165,7 +165,7 @@ public:
// deletes all gos/creatures spawned by the pvp // deletes all gos/creatures spawned by the pvp
void DeleteSpawns(); void DeleteSpawns();
typedef std::vector<OPvPCapturePoint*> OPvPCapturePointMap; typedef std::map<uint32/*lowguid*/, OPvPCapturePoint*> OPvPCapturePointMap;
virtual void FillInitialWorldStates(WorldPacket & data) {} virtual void FillInitialWorldStates(WorldPacket & data) {}
// called when a player triggers an areatrigger // called when a player triggers an areatrigger
@@ -221,6 +221,11 @@ protected:
virtual void HandlePlayerEnterZone(Player * plr, uint32 zone); virtual void HandlePlayerEnterZone(Player * plr, uint32 zone);
virtual void HandlePlayerLeaveZone(Player * plr, uint32 zone); virtual void HandlePlayerLeaveZone(Player * plr, uint32 zone);
void AddCapturePoint(OPvPCapturePoint* cp)
{
m_capturePoints[cp->m_CapturePointGUID] = cp;
}
void RegisterZone(uint32 zoneid); void RegisterZone(uint32 zoneid);
bool HasPlayer(Player *plr) const; bool HasPlayer(Player *plr) const;
void TeamCastSpell(TeamId team, int32 spellId); void TeamCastSpell(TeamId team, int32 spellId);
+9 -9
View File
@@ -31,7 +31,7 @@
OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP *pvp) OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP *pvp)
: OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_UnitsSummonedSide(0) : OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_UnitsSummonedSide(0)
{ {
AddCapturePoint(EPCapturePoints[EP_EWT].entry,EPCapturePoints[EP_EWT].map,EPCapturePoints[EP_EWT].x,EPCapturePoints[EP_EWT].y,EPCapturePoints[EP_EWT].z,EPCapturePoints[EP_EWT].o,EPCapturePoints[EP_EWT].rot0,EPCapturePoints[EP_EWT].rot1,EPCapturePoints[EP_EWT].rot2,EPCapturePoints[EP_EWT].rot3); SetCapturePointData(EPCapturePoints[EP_EWT].entry,EPCapturePoints[EP_EWT].map,EPCapturePoints[EP_EWT].x,EPCapturePoints[EP_EWT].y,EPCapturePoints[EP_EWT].z,EPCapturePoints[EP_EWT].o,EPCapturePoints[EP_EWT].rot0,EPCapturePoints[EP_EWT].rot1,EPCapturePoints[EP_EWT].rot2,EPCapturePoints[EP_EWT].rot3);
AddObject(EP_EWT_FLAGS,EPTowerFlags[EP_EWT].entry,EPTowerFlags[EP_EWT].map,EPTowerFlags[EP_EWT].x,EPTowerFlags[EP_EWT].y,EPTowerFlags[EP_EWT].z,EPTowerFlags[EP_EWT].o,EPTowerFlags[EP_EWT].rot0,EPTowerFlags[EP_EWT].rot1,EPTowerFlags[EP_EWT].rot2,EPTowerFlags[EP_EWT].rot3); AddObject(EP_EWT_FLAGS,EPTowerFlags[EP_EWT].entry,EPTowerFlags[EP_EWT].map,EPTowerFlags[EP_EWT].x,EPTowerFlags[EP_EWT].y,EPTowerFlags[EP_EWT].z,EPTowerFlags[EP_EWT].o,EPTowerFlags[EP_EWT].rot0,EPTowerFlags[EP_EWT].rot1,EPTowerFlags[EP_EWT].rot2,EPTowerFlags[EP_EWT].rot3);
} }
@@ -185,7 +185,7 @@ void OPvPCapturePointEP_EWT::SummonSupportUnitAtNorthpassTower(uint32 team)
OPvPCapturePointEP_NPT::OPvPCapturePointEP_NPT(OutdoorPvP *pvp) OPvPCapturePointEP_NPT::OPvPCapturePointEP_NPT(OutdoorPvP *pvp)
: OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_SummonedGOSide(0) : OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_SummonedGOSide(0)
{ {
AddCapturePoint(EPCapturePoints[EP_NPT].entry,EPCapturePoints[EP_NPT].map,EPCapturePoints[EP_NPT].x,EPCapturePoints[EP_NPT].y,EPCapturePoints[EP_NPT].z,EPCapturePoints[EP_NPT].o,EPCapturePoints[EP_NPT].rot0,EPCapturePoints[EP_NPT].rot1,EPCapturePoints[EP_NPT].rot2,EPCapturePoints[EP_NPT].rot3); SetCapturePointData(EPCapturePoints[EP_NPT].entry,EPCapturePoints[EP_NPT].map,EPCapturePoints[EP_NPT].x,EPCapturePoints[EP_NPT].y,EPCapturePoints[EP_NPT].z,EPCapturePoints[EP_NPT].o,EPCapturePoints[EP_NPT].rot0,EPCapturePoints[EP_NPT].rot1,EPCapturePoints[EP_NPT].rot2,EPCapturePoints[EP_NPT].rot3);
AddObject(EP_NPT_FLAGS,EPTowerFlags[EP_NPT].entry,EPTowerFlags[EP_NPT].map,EPTowerFlags[EP_NPT].x,EPTowerFlags[EP_NPT].y,EPTowerFlags[EP_NPT].z,EPTowerFlags[EP_NPT].o,EPTowerFlags[EP_NPT].rot0,EPTowerFlags[EP_NPT].rot1,EPTowerFlags[EP_NPT].rot2,EPTowerFlags[EP_NPT].rot3); AddObject(EP_NPT_FLAGS,EPTowerFlags[EP_NPT].entry,EPTowerFlags[EP_NPT].map,EPTowerFlags[EP_NPT].x,EPTowerFlags[EP_NPT].y,EPTowerFlags[EP_NPT].z,EPTowerFlags[EP_NPT].o,EPTowerFlags[EP_NPT].rot0,EPTowerFlags[EP_NPT].rot1,EPTowerFlags[EP_NPT].rot2,EPTowerFlags[EP_NPT].rot3);
} }
@@ -334,7 +334,7 @@ void OPvPCapturePointEP_NPT::SummonGO(uint32 team)
OPvPCapturePointEP_CGT::OPvPCapturePointEP_CGT(OutdoorPvP *pvp) OPvPCapturePointEP_CGT::OPvPCapturePointEP_CGT(OutdoorPvP *pvp)
: OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_GraveyardSide(0) : OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_GraveyardSide(0)
{ {
AddCapturePoint(EPCapturePoints[EP_CGT].entry,EPCapturePoints[EP_CGT].map,EPCapturePoints[EP_CGT].x,EPCapturePoints[EP_CGT].y,EPCapturePoints[EP_CGT].z,EPCapturePoints[EP_CGT].o,EPCapturePoints[EP_CGT].rot0,EPCapturePoints[EP_CGT].rot1,EPCapturePoints[EP_CGT].rot2,EPCapturePoints[EP_CGT].rot3); SetCapturePointData(EPCapturePoints[EP_CGT].entry,EPCapturePoints[EP_CGT].map,EPCapturePoints[EP_CGT].x,EPCapturePoints[EP_CGT].y,EPCapturePoints[EP_CGT].z,EPCapturePoints[EP_CGT].o,EPCapturePoints[EP_CGT].rot0,EPCapturePoints[EP_CGT].rot1,EPCapturePoints[EP_CGT].rot2,EPCapturePoints[EP_CGT].rot3);
AddObject(EP_CGT_FLAGS,EPTowerFlags[EP_CGT].entry,EPTowerFlags[EP_CGT].map,EPTowerFlags[EP_CGT].x,EPTowerFlags[EP_CGT].y,EPTowerFlags[EP_CGT].z,EPTowerFlags[EP_CGT].o,EPTowerFlags[EP_CGT].rot0,EPTowerFlags[EP_CGT].rot1,EPTowerFlags[EP_CGT].rot2,EPTowerFlags[EP_CGT].rot3); AddObject(EP_CGT_FLAGS,EPTowerFlags[EP_CGT].entry,EPTowerFlags[EP_CGT].map,EPTowerFlags[EP_CGT].x,EPTowerFlags[EP_CGT].y,EPTowerFlags[EP_CGT].z,EPTowerFlags[EP_CGT].o,EPTowerFlags[EP_CGT].rot0,EPTowerFlags[EP_CGT].rot1,EPTowerFlags[EP_CGT].rot2,EPTowerFlags[EP_CGT].rot3);
} }
@@ -478,7 +478,7 @@ void OPvPCapturePointEP_CGT::LinkGraveYard(uint32 team)
OPvPCapturePointEP_PWT::OPvPCapturePointEP_PWT(OutdoorPvP *pvp) OPvPCapturePointEP_PWT::OPvPCapturePointEP_PWT(OutdoorPvP *pvp)
: OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_FlightMasterSpawned(0) : OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_FlightMasterSpawned(0)
{ {
AddCapturePoint(EPCapturePoints[EP_PWT].entry,EPCapturePoints[EP_PWT].map,EPCapturePoints[EP_PWT].x,EPCapturePoints[EP_PWT].y,EPCapturePoints[EP_PWT].z,EPCapturePoints[EP_PWT].o,EPCapturePoints[EP_PWT].rot0,EPCapturePoints[EP_PWT].rot1,EPCapturePoints[EP_PWT].rot2,EPCapturePoints[EP_PWT].rot3); SetCapturePointData(EPCapturePoints[EP_PWT].entry,EPCapturePoints[EP_PWT].map,EPCapturePoints[EP_PWT].x,EPCapturePoints[EP_PWT].y,EPCapturePoints[EP_PWT].z,EPCapturePoints[EP_PWT].o,EPCapturePoints[EP_PWT].rot0,EPCapturePoints[EP_PWT].rot1,EPCapturePoints[EP_PWT].rot2,EPCapturePoints[EP_PWT].rot3);
AddObject(EP_PWT_FLAGS,EPTowerFlags[EP_PWT].entry,EPTowerFlags[EP_PWT].map,EPTowerFlags[EP_PWT].x,EPTowerFlags[EP_PWT].y,EPTowerFlags[EP_PWT].z,EPTowerFlags[EP_PWT].o,EPTowerFlags[EP_PWT].rot0,EPTowerFlags[EP_PWT].rot1,EPTowerFlags[EP_PWT].rot2,EPTowerFlags[EP_PWT].rot3); AddObject(EP_PWT_FLAGS,EPTowerFlags[EP_PWT].entry,EPTowerFlags[EP_PWT].map,EPTowerFlags[EP_PWT].x,EPTowerFlags[EP_PWT].y,EPTowerFlags[EP_PWT].z,EPTowerFlags[EP_PWT].o,EPTowerFlags[EP_PWT].rot0,EPTowerFlags[EP_PWT].rot1,EPTowerFlags[EP_PWT].rot2,EPTowerFlags[EP_PWT].rot3);
} }
@@ -711,10 +711,10 @@ bool OutdoorPvPEP::SetupOutdoorPvP()
for(int i = 0; i < EPBuffZonesNum; ++i) for(int i = 0; i < EPBuffZonesNum; ++i)
RegisterZone(EPBuffZones[i]); RegisterZone(EPBuffZones[i]);
m_capturePoints.push_back(new OPvPCapturePointEP_EWT(this)); AddCapturePoint(new OPvPCapturePointEP_EWT(this));
m_capturePoints.push_back(new OPvPCapturePointEP_PWT(this)); AddCapturePoint(new OPvPCapturePointEP_PWT(this));
m_capturePoints.push_back(new OPvPCapturePointEP_CGT(this)); AddCapturePoint(new OPvPCapturePointEP_CGT(this));
m_capturePoints.push_back(new OPvPCapturePointEP_NPT(this)); AddCapturePoint(new OPvPCapturePointEP_NPT(this));
return true; return true;
} }
@@ -804,7 +804,7 @@ void OutdoorPvPEP::FillInitialWorldStates(WorldPacket & data)
data << EP_UI_TOWER_SLIDER_N << uint32(100); data << EP_UI_TOWER_SLIDER_N << uint32(100);
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{ {
(*itr)->FillInitialWorldStates(data); itr->second->FillInitialWorldStates(data);
} }
} }
+5 -5
View File
@@ -36,7 +36,7 @@ const uint32 HP_LANG_CAPTURE_H[HP_TOWER_NUM] = {LANG_OPVP_HP_CAPTURE_BROKENHILL_
OPvPCapturePointHP::OPvPCapturePointHP(OutdoorPvP *pvp,OutdoorPvPHPTowerType type) OPvPCapturePointHP::OPvPCapturePointHP(OutdoorPvP *pvp,OutdoorPvPHPTowerType type)
: OPvPCapturePoint(pvp), m_TowerType(type) : OPvPCapturePoint(pvp), m_TowerType(type)
{ {
AddCapturePoint(HPCapturePoints[type].entry, SetCapturePointData(HPCapturePoints[type].entry,
HPCapturePoints[type].map, HPCapturePoints[type].map,
HPCapturePoints[type].x, HPCapturePoints[type].x,
HPCapturePoints[type].y, HPCapturePoints[type].y,
@@ -72,11 +72,11 @@ bool OutdoorPvPHP::SetupOutdoorPvP()
for(int i = 0; i < OutdoorPvPHPBuffZonesNum; ++i) for(int i = 0; i < OutdoorPvPHPBuffZonesNum; ++i)
RegisterZone(OutdoorPvPHPBuffZones[i]); RegisterZone(OutdoorPvPHPBuffZones[i]);
m_capturePoints.push_back(new OPvPCapturePointHP(this,HP_TOWER_BROKEN_HILL)); AddCapturePoint(new OPvPCapturePointHP(this,HP_TOWER_BROKEN_HILL));
m_capturePoints.push_back(new OPvPCapturePointHP(this,HP_TOWER_OVERLOOK)); AddCapturePoint(new OPvPCapturePointHP(this,HP_TOWER_OVERLOOK));
m_capturePoints.push_back(new OPvPCapturePointHP(this,HP_TOWER_STADIUM)); AddCapturePoint(new OPvPCapturePointHP(this,HP_TOWER_STADIUM));
return true; return true;
} }
@@ -159,7 +159,7 @@ void OutdoorPvPHP::FillInitialWorldStates(WorldPacket &data)
data << uint32(HP_UI_TOWER_SLIDER_N) << uint32(100); data << uint32(HP_UI_TOWER_SLIDER_N) << uint32(100);
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{ {
(*itr)->FillInitialWorldStates(data); itr->second->FillInitialWorldStates(data);
} }
} }
+2 -2
View File
@@ -207,7 +207,7 @@ OPvPCapturePoint(pvp), m_capturable(true), m_GuardsAlive(0), m_ControllingFactio
m_HalaaState(HALAA_N), m_WyvernStateSouth(0), m_WyvernStateNorth(0), m_WyvernStateWest(0), m_HalaaState(HALAA_N), m_WyvernStateSouth(0), m_WyvernStateNorth(0), m_WyvernStateWest(0),
m_WyvernStateEast(0), m_RespawnTimer(NA_RESPAWN_TIME), m_GuardCheckTimer(NA_GUARD_CHECK_TIME) m_WyvernStateEast(0), m_RespawnTimer(NA_RESPAWN_TIME), m_GuardCheckTimer(NA_GUARD_CHECK_TIME)
{ {
AddCapturePoint(182210,530,-1572.57,7945.3,-22.475,2.05949,0,0,0.857167,0.515038); SetCapturePointData(182210,530,-1572.57,7945.3,-22.475,2.05949,0,0,0.857167,0.515038);
} }
bool OutdoorPvPNA::SetupOutdoorPvP() bool OutdoorPvPNA::SetupOutdoorPvP()
@@ -220,7 +220,7 @@ bool OutdoorPvPNA::SetupOutdoorPvP()
m_obj = new OPvPCapturePointNA(this); m_obj = new OPvPCapturePointNA(this);
if(!m_obj) if(!m_obj)
return false; return false;
m_capturePoints.push_back(m_obj); AddCapturePoint(m_obj);
return true; return true;
} }
+7 -7
View File
@@ -32,7 +32,7 @@ OutdoorPvPTF::OutdoorPvPTF()
OPvPCapturePointTF::OPvPCapturePointTF(OutdoorPvP *pvp, OutdoorPvPTF_TowerType type) OPvPCapturePointTF::OPvPCapturePointTF(OutdoorPvP *pvp, OutdoorPvPTF_TowerType type)
: OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(TF_TOWERSTATE_N) : OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(TF_TOWERSTATE_N)
{ {
AddCapturePoint(TFCapturePoints[type].entry,TFCapturePoints[type].map,TFCapturePoints[type].x,TFCapturePoints[type].y,TFCapturePoints[type].z,TFCapturePoints[type].o,TFCapturePoints[type].rot0,TFCapturePoints[type].rot1,TFCapturePoints[type].rot2,TFCapturePoints[type].rot3); SetCapturePointData(TFCapturePoints[type].entry,TFCapturePoints[type].map,TFCapturePoints[type].x,TFCapturePoints[type].y,TFCapturePoints[type].z,TFCapturePoints[type].o,TFCapturePoints[type].rot0,TFCapturePoints[type].rot1,TFCapturePoints[type].rot2,TFCapturePoints[type].rot3);
} }
void OPvPCapturePointTF::FillInitialWorldStates(WorldPacket &data) void OPvPCapturePointTF::FillInitialWorldStates(WorldPacket &data)
@@ -62,7 +62,7 @@ void OutdoorPvPTF::FillInitialWorldStates(WorldPacket &data)
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{ {
(*itr)->FillInitialWorldStates(data); itr->second->FillInitialWorldStates(data);
} }
} }
@@ -223,11 +223,11 @@ bool OutdoorPvPTF::SetupOutdoorPvP()
for(int i = 0; i < OutdoorPvPTFBuffZonesNum; ++i) for(int i = 0; i < OutdoorPvPTFBuffZonesNum; ++i)
RegisterZone(OutdoorPvPTFBuffZones[i]); RegisterZone(OutdoorPvPTFBuffZones[i]);
m_capturePoints.push_back(new OPvPCapturePointTF(this,TF_TOWER_NW)); AddCapturePoint(new OPvPCapturePointTF(this,TF_TOWER_NW));
m_capturePoints.push_back(new OPvPCapturePointTF(this,TF_TOWER_N)); AddCapturePoint(new OPvPCapturePointTF(this,TF_TOWER_N));
m_capturePoints.push_back(new OPvPCapturePointTF(this,TF_TOWER_NE)); AddCapturePoint(new OPvPCapturePointTF(this,TF_TOWER_NE));
m_capturePoints.push_back(new OPvPCapturePointTF(this,TF_TOWER_SE)); AddCapturePoint(new OPvPCapturePointTF(this,TF_TOWER_SE));
m_capturePoints.push_back(new OPvPCapturePointTF(this,TF_TOWER_S)); AddCapturePoint(new OPvPCapturePointTF(this,TF_TOWER_S));
return true; return true;
} }
+5 -5
View File
@@ -29,7 +29,7 @@
OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP *pvp, ZM_BeaconType type) OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP *pvp, ZM_BeaconType type)
: OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N) : OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N)
{ {
AddCapturePoint(ZMCapturePoints[type].entry,ZMCapturePoints[type].map,ZMCapturePoints[type].x,ZMCapturePoints[type].y,ZMCapturePoints[type].z,ZMCapturePoints[type].o,ZMCapturePoints[type].rot0,ZMCapturePoints[type].rot1,ZMCapturePoints[type].rot2,ZMCapturePoints[type].rot3); SetCapturePointData(ZMCapturePoints[type].entry,ZMCapturePoints[type].map,ZMCapturePoints[type].x,ZMCapturePoints[type].y,ZMCapturePoints[type].z,ZMCapturePoints[type].o,ZMCapturePoints[type].rot0,ZMCapturePoints[type].rot1,ZMCapturePoints[type].rot2,ZMCapturePoints[type].rot3);
} }
void OPvPCapturePointZM_Beacon::FillInitialWorldStates(WorldPacket &data) void OPvPCapturePointZM_Beacon::FillInitialWorldStates(WorldPacket &data)
@@ -182,10 +182,10 @@ bool OutdoorPvPZM::SetupOutdoorPvP()
for(int i = 0; i < OutdoorPvPZMBuffZonesNum; ++i) for(int i = 0; i < OutdoorPvPZMBuffZonesNum; ++i)
RegisterZone(OutdoorPvPZMBuffZones[i]); RegisterZone(OutdoorPvPZMBuffZones[i]);
m_capturePoints.push_back(new OPvPCapturePointZM_Beacon(this,ZM_BEACON_WEST)); AddCapturePoint(new OPvPCapturePointZM_Beacon(this,ZM_BEACON_WEST));
m_capturePoints.push_back(new OPvPCapturePointZM_Beacon(this,ZM_BEACON_EAST)); AddCapturePoint(new OPvPCapturePointZM_Beacon(this,ZM_BEACON_EAST));
m_GraveYard = new OPvPCapturePointZM_GraveYard(this); m_GraveYard = new OPvPCapturePointZM_GraveYard(this);
m_capturePoints.push_back(m_GraveYard); // though the update function isn't used, the handleusego is! AddCapturePoint(m_GraveYard); // though the update function isn't used, the handleusego is!
return true; return true;
} }
@@ -393,7 +393,7 @@ void OutdoorPvPZM::FillInitialWorldStates(WorldPacket &data)
data << ZM_WORLDSTATE_UNK_1 << uint32(1); data << ZM_WORLDSTATE_UNK_1 << uint32(1);
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
{ {
(*itr)->FillInitialWorldStates(data); itr->second->FillInitialWorldStates(data);
} }
} }
+4 -4
View File
@@ -253,7 +253,7 @@ bool OPvPWintergrasp::SetupOutdoorPvP()
} }
SiegeWorkshop *workshop = new SiegeWorkshop(this, m_buildingStates[guid]); SiegeWorkshop *workshop = new SiegeWorkshop(this, m_buildingStates[guid]);
if(!workshop->AddCapturePoint(capturePointEntry, goData->mapid, goData->posX, goData->posY, goData->posZ)) if(!workshop->SetCapturePointData(capturePointEntry, goData->mapid, goData->posX, goData->posY, goData->posZ))
{ {
delete workshop; delete workshop;
sLog.outError("Cannot add capture point!"); sLog.outError("Cannot add capture point!");
@@ -269,7 +269,7 @@ bool OPvPWintergrasp::SetupOutdoorPvP()
workshop->m_engGuid = engGuid; workshop->m_engGuid = engGuid;
//workshop->AddCre(0, engGuid, creData->id); //workshop->AddCre(0, engGuid, creData->id);
//sLog.outDebug("Demolisher Engineerer lowguid %u is linked to workshop lowguid %u.", engGuid, guid); //sLog.outDebug("Demolisher Engineerer lowguid %u is linked to workshop lowguid %u.", engGuid, guid);
m_capturePoints.push_back(workshop); AddCapturePoint(workshop);
workshop->SetStateByBuildingState(); workshop->SetStateByBuildingState();
} }
}while(result->NextRow()); }while(result->NextRow());
@@ -375,7 +375,7 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
else if(entry == CRE_ENG_A || entry == CRE_ENG_H) // demolisher engineers else if(entry == CRE_ENG_A || entry == CRE_ENG_H) // demolisher engineers
{ {
for(OutdoorPvP::OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OutdoorPvP::OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if(SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(*itr)) if(SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(itr->second))
if(workshop->m_engGuid == creature->GetDBTableGUIDLow()) if(workshop->m_engGuid == creature->GetDBTableGUIDLow())
{ {
workshop->m_engineer = add ? creature : NULL; workshop->m_engineer = add ? creature : NULL;
@@ -427,7 +427,7 @@ void OPvPWintergrasp::UpdateAllWorldObject()
// update capture points // update capture points
for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) for(OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
if(SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(*itr)) if(SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(itr->second))
workshop->SetStateByBuildingState(); workshop->SetStateByBuildingState();
SendInitWorldStatesTo(); SendInitWorldStatesTo();