Battlefields/Wintergrasp: Fixed a crash when leaving a capture point.

Fixed the worldstate counters

Signed-off-by: Subv <[email protected]>
This commit is contained in:
Subv
2012-08-20 13:49:19 -04:00
committed by Kandera
parent 6639347d37
commit 5ec5bc1721
4 changed files with 31 additions and 14 deletions
+27 -10
View File
@@ -888,11 +888,18 @@ bool BfCapturePoint::HandlePlayerEnter(Player *player)
return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
}
void BfCapturePoint::HandlePlayerLeave(Player *player)
GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* plr)
{
if (m_capturePoint)
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
m_activePlayers[player->GetTeamId()].erase(player->GetGUID());
plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
GuidSet::iterator current = m_activePlayers[plr->GetTeamId()].find(plr->GetGUID());
if (current == m_activePlayers[plr->GetTeamId()].end())
return current; // return end()
m_activePlayers[plr->GetTeamId()].erase(current++);
return current;
}
void BfCapturePoint::SendChangePhase()
@@ -964,17 +971,27 @@ bool BfCapturePoint::Update(uint32 diff)
float radius = m_capturePoint->GetGOInfo()->capturePoint.radius;
for (uint8 team = 0; team < 2; ++team)
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
if (Player* player = sObjectAccessor->FindPlayer(*itr))
if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
HandlePlayerLeave(player);
{
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
{
if (Player* plr = sObjectAccessor->FindPlayer(*itr))
{
if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive())
itr = HandlePlayerLeave(plr);
else
++itr;
}
else
++itr;
}
}
std::list < Player * >players;
std::list<Player*> players;
Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius);
Trinity::PlayerListSearcher < Trinity::AnyPlayerInObjectRangeCheck > searcher(m_capturePoint, players, checker);
Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(m_capturePoint, players, checker);
m_capturePoint->VisitNearbyWorldObject(radius, searcher);
for (std::list < Player * >::iterator itr = players.begin(); itr != players.end(); ++itr)
for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
if ((*itr)->IsOutdoorPvPActive())
if (m_activePlayers[(*itr)->GetTeamId()].insert((*itr)->GetGUID()).second)
HandlePlayerEnter(*itr);
+2 -2
View File
@@ -88,8 +88,8 @@ public:
void SendObjectiveComplete(uint32 id, uint64 guid);
// used when player is activated/inactivated in the area
virtual bool HandlePlayerEnter(Player * player);
virtual void HandlePlayerLeave(Player * player);
virtual bool HandlePlayerEnter(Player* player);
virtual GuidSet::iterator HandlePlayerLeave(Player* player);
//virtual void HandlePlayerActivityChanged(Player * player);
// checks if player is in range of a capture credit marker
@@ -892,7 +892,7 @@ uint32 BattlefieldWG::GetData(uint32 data)
return m_GraveYardList[GetSpiritGraveyardId(data)]->GetControlTeamId();
}
return 0;
return Battlefield::GetData(data);
}
// Method sending worldsate to player
@@ -28,7 +28,7 @@
const uint32 VehNumWorldState[2] = { 3680, 3490 };
const uint32 MaxVehNumWorldState[2] = { 3681, 3491 };
const uint32 ClockWorldState[2] = { 3781, 4354 };
const uint32 WintergraspFaction[3] = { 1732, 1735, 35 };
const uint32 WintergraspFaction[3] = { 1, 116, 35 };
const float WintergraspStalkerPos[4] = { 0, 0, 0, 0 };