Code/Groups: use enum as parameter in Group::RemoveMember

--HG--
branch : trunk
This commit is contained in:
Spp
2010-09-10 13:37:55 +02:00
parent 279d40efdc
commit 9e9c39244b
5 changed files with 13 additions and 7 deletions
@@ -995,7 +995,7 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
// remove from raid group if player is member // remove from raid group if player is member
if (Group *group = GetBgRaid(team)) if (Group *group = GetBgRaid(team))
{ {
if (!group->RemoveMember(guid, 0)) // group was disbanded if (!group->RemoveMember(guid)) // group was disbanded
{ {
SetBgRaid(team, NULL); SetBgRaid(team, NULL);
delete group; delete group;
+1 -1
View File
@@ -7386,7 +7386,7 @@ bool ChatHandler::HandleGroupRemoveCommand(const char *args)
if (GetPlayerGroupAndGUIDByName(cname, plr, group, guid, true)) if (GetPlayerGroupAndGUIDByName(cname, plr, group, guid, true))
if (group) if (group)
group->RemoveMember(guid, 0); group->RemoveMember(guid);
return true; return true;
} }
+1 -1
View File
@@ -2598,7 +2598,7 @@ void Player::RemoveFromGroup(Group* group, uint64 guid)
{ {
if (group) if (group)
{ {
if (group->RemoveMember(guid, 0) <= 1) if (group->RemoveMember(guid) <= 1)
{ {
// group->Disband(); already disbanded in RemoveMember // group->Disband(); already disbanded in RemoveMember
sObjectMgr.RemoveGroup(group); sObjectMgr.RemoveGroup(group);
+2 -2
View File
@@ -354,7 +354,7 @@ bool Group::AddMember(const uint64 &guid, const char* name)
return true; return true;
} }
uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method) uint32 Group::RemoveMember(const uint64 &guid, const RemoveMethod &method)
{ {
BroadcastGroupUpdate(); BroadcastGroupUpdate();
@@ -376,7 +376,7 @@ uint32 Group::RemoveMember(const uint64 &guid, const uint8 &method)
WorldPacket data; WorldPacket data;
if (method == 1) if (method == GROUP_REMOVEMETHOD_KICK)
{ {
data.Initialize(SMSG_GROUP_UNINVITE, 0); data.Initialize(SMSG_GROUP_UNINVITE, 0);
player->GetSession()->SendPacket(&data); player->GetSession()->SendPacket(&data);
+8 -2
View File
@@ -116,6 +116,13 @@ enum GroupUpdateFlags
GROUP_UPDATE_FULL = 0x0007FFFF, // all known flags GROUP_UPDATE_FULL = 0x0007FFFF, // all known flags
}; };
enum RemoveMethod
{
GROUP_REMOVEMETHOD_DEFAULT = 0,
GROUP_REMOVEMETHOD_KICK = 1,
GROUP_REMOVEMETHOD_LEAVE = 2,
};
#define GROUP_UPDATE_FLAGS_COUNT 20 #define GROUP_UPDATE_FLAGS_COUNT 20
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18,19 // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18,19
static const uint8 GroupUpdateLength[GROUP_UPDATE_FLAGS_COUNT] = { 0, 2, 2, 2, 1, 2, 2, 2, 2, 4, 8, 8, 1, 2, 2, 2, 1, 2, 2, 8}; static const uint8 GroupUpdateLength[GROUP_UPDATE_FLAGS_COUNT] = { 0, 2, 2, 2, 1, 2, 2, 2, 2, 4, 8, 8, 1, 2, 2, 2, 1, 2, 2, 8};
@@ -191,8 +198,7 @@ class Group
void RemoveAllInvites(); void RemoveAllInvites();
bool AddLeaderInvite(Player *player); bool AddLeaderInvite(Player *player);
bool AddMember(const uint64 &guid, const char* name); bool AddMember(const uint64 &guid, const char* name);
// method: 0=just remove, 1=kick uint32 RemoveMember(const uint64 &guid, const RemoveMethod &method = GROUP_REMOVEMETHOD_DEFAULT);
uint32 RemoveMember(const uint64 &guid, const uint8 &method);
void ChangeLeader(const uint64 &guid); void ChangeLeader(const uint64 &guid);
void SetLootMethod(LootMethod method) { m_lootMethod = method; } void SetLootMethod(LootMethod method) { m_lootMethod = method; }
void SetLooterGuid(const uint64 &guid) { m_looterGuid = guid; } void SetLooterGuid(const uint64 &guid) { m_looterGuid = guid; }