diff options
| author | zorix <zajast@o2.pl> | 2013-09-20 16:58:27 +0200 |
|---|---|---|
| committer | zorix <zajast@o2.pl> | 2013-09-20 16:58:27 +0200 |
| commit | bd48d0ebe71bd9c1d64ba86d52ed6f58a7336fa7 (patch) | |
| tree | f93b7a3099f88fc342832968f77b713637fcb6bb /src/server/game/Battlegrounds/BattlegroundMgr.cpp | |
| parent | fb997c5f41965eafb080597a71181fcfc57e7678 (diff) | |
Core/Battleground:
Add missing NULL pointer check for player if is not in world
Core/Spell:
Add absolute value for delta because can be nevgative
Close #10846
Diffstat (limited to 'src/server/game/Battlegrounds/BattlegroundMgr.cpp')
| -rw-r--r-- | src/server/game/Battlegrounds/BattlegroundMgr.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index f6a3148edc3..8accb93f0f0 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -376,7 +376,9 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) } } - data->WriteBits(bg->GetPlayerScoresSize(), 21); + size_t count_pos = data->bitwpos(); + data->WriteBits(0, 21); + uint32 count = 0; for (Battleground::BattlegroundScoreMap::const_iterator itr = bg->GetPlayerScoresBegin(); itr != bg->GetPlayerScoresEnd(); ++itr) { if (!bg->IsPlayerInBattleground(itr->first)) @@ -386,6 +388,12 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) } Player* player = ObjectAccessor::FindPlayer(itr->first); + if (!player) + { + TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "Player " UI64FMTD " has scoreboard entry for battleground %u but is not in world!", itr->first, bg->GetTypeID(true)); + continue; + } + ObjectGuid playerGUID = itr->first; BattlegroundScore* score = itr->second; @@ -539,8 +547,10 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) // if (unk 4) << uint32() unk buff.WriteByteSeq(playerGUID[7]); buff.WriteByteSeq(playerGUID[2]); + ++count; } + data->PutBits(count_pos, count, 21); data->WriteBit(bg->GetStatus() == STATUS_WAIT_LEAVE); // If Ended if (isRated) // arena |
