[10782] Use Team enum types in all appropriate cases and catches bug in result fix.

* Fixed wrong arenaid use at leave arena queue.
* Fixed memory lost and etc at not virtual EndBattleground call
* Fixed crash at arena join with fake data from client.
* Code cleanups.
This commit is contained in:
VladimirMangos 2010-11-24 23:25:53 +03:00
parent c2331f58bc
commit cc0655a402
38 changed files with 315 additions and 321 deletions

View file

@ -435,7 +435,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
// set the destination instance id
_player->SetBattleGroundId(bg->GetInstanceID(), bgTypeId);
// set the destination team
_player->SetBGTeam(ginfo.Team);
_player->SetBGTeam(ginfo.GroupTeam);
// bg->HandleBeforeTeleportToBattleGround(_player);
sBattleGroundMgr.SendToBattleGround(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId);
// add only in HandleMoveWorldPortAck()
@ -446,7 +446,7 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
// if player leaves rated arena match before match start, it is counted as he played but he lost
if (ginfo.IsRated)
{
ArenaTeam * at = sObjectMgr.GetArenaTeamById(ginfo.Team);
ArenaTeam * at = sObjectMgr.GetArenaTeamById(ginfo.ArenaTeamId);
if (at)
{
DEBUG_LOG("UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating);
@ -605,7 +605,6 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
uint8 arenaslot; // 2v2, 3v3 or 5v5
uint8 asGroup; // asGroup
uint8 isRated; // isRated
Group * grp;
recv_data >> guid >> arenaslot >> asGroup >> isRated;
@ -655,9 +654,15 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
GroupJoinBattlegroundResult err;
Group * grp = NULL;
// check queue conditions
if (!asGroup)
{
// you can't join in this way by client
if (isRated)
return;
// check if already in queue
if (_player->GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
//player is already in this queue