fix crash with groups, added enum for battlfield leave reasons

This commit is contained in:
Kandera
2012-02-22 16:32:51 -05:00
parent 6318fd91ff
commit dd05f1dcd2
3 changed files with 14 additions and 21 deletions

View File

@@ -103,17 +103,9 @@ void Battlefield::HandlePlayerLeaveZone(Player *plr, uint32 /*zone */ )
{
m_PlayersInWar[plr->GetTeamId()].erase(plr->GetGUID());
plr->GetSession()->SendBfLeaveMessage(m_BattleId);
if (Group* group = GetGroupPlayer(plr->GetGUID(), plr->GetTeamId())) // remove from raid group if player is member
{
// I think that now is not a hack
if (!group->RemoveMember(plr->GetGUID())) // group was disbanded
{
m_Groups[plr->GetTeamId()].erase(group->GetGUID());
group->SetBattlefieldGroup(NULL);
sGroupMgr->RemoveGroup(group);
delete group;
}
}
if (Group* group = plr->GetGroup()) // remove from raid group if player is member
group->RemoveMember(plr->GetGUID());
OnPlayerLeaveWar(plr); //For scripting
}
}

View File

@@ -26,15 +26,6 @@
#include "BattlefieldMgr.h"
#include "Opcodes.h"
enum BFLeaveReason
{
BF_LEAVE_REASON_CLOSE = 0x00000001,
//BF_LEAVE_REASON_UNK1 = 0x00000002, (not used)
//BF_LEAVE_REASON_UNK2 = 0x00000004, (not used)
BF_LEAVE_REASON_EXITED = 0x00000008,
BF_LEAVE_REASON_LOW_LEVEL = 0x00000010,
};
//This send to player windows for invite player to join the war
//Param1:(BattleId) the BattleId of Bf
//Param2:(ZoneId) the zone where the battle is (4197 for wg)
@@ -97,7 +88,7 @@ void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason)
{
WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7);
data << uint32(BattleId);
data << uint8(reason);//byte Reason (1=close invite,8="exited",10="to low level")
data << uint8(reason);//byte Reason
data << uint8(2);//byte BattleStatus
data << uint8(0);//bool Relocated
SendPacket(&data);

View File

@@ -125,6 +125,16 @@ enum PartyResult
ERR_PARTY_LFG_TELEPORT_IN_COMBAT = 30
};
enum BFLeaveReason
{
BF_LEAVE_REASON_CLOSE = 0x00000001,
//BF_LEAVE_REASON_UNK1 = 0x00000002, (not used)
//BF_LEAVE_REASON_UNK2 = 0x00000004, (not used)
BF_LEAVE_REASON_EXITED = 0x00000008,
BF_LEAVE_REASON_LOW_LEVEL = 0x00000010,
};
enum ChatRestrictionType
{
ERR_CHAT_RESTRICTED = 0,