mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[9951] Fixed bug with raid subgroup size update at move member to another.
Also some code cleanups
This commit is contained in:
parent
5940bd7d07
commit
29c0efe9b4
3 changed files with 43 additions and 35 deletions
|
|
@ -41,7 +41,7 @@ Group::Group() : m_Id(0), m_leaderGuid(0), m_mainTank(0), m_mainAssistant(0), m
|
|||
m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_looterGuid(0), m_lootThreshold(ITEM_QUALITY_UNCOMMON),
|
||||
m_subGroupsCounts(NULL)
|
||||
{
|
||||
for (int i = 0; i < TARGETICONCOUNT; ++i)
|
||||
for (int i = 0; i < TARGET_ICON_COUNT; ++i)
|
||||
m_targetIcons[i] = 0;
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ bool Group::LoadGroupFromDB(Field* fields)
|
|||
m_looterGuid = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
m_lootThreshold = (ItemQualities)fields[4].GetUInt16();
|
||||
|
||||
for(int i = 0; i < TARGETICONCOUNT; ++i)
|
||||
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
|
||||
m_targetIcons[i] = fields[5+i].GetUInt64();
|
||||
|
||||
return true;
|
||||
|
|
@ -869,12 +869,12 @@ void Group::CountTheRoll(Rolls::iterator& rollI)
|
|||
|
||||
void Group::SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid)
|
||||
{
|
||||
if(id >= TARGETICONCOUNT)
|
||||
if(id >= TARGET_ICON_COUNT)
|
||||
return;
|
||||
|
||||
// clean other icons
|
||||
if( targetGuid != 0 )
|
||||
for(int i = 0; i < TARGETICONCOUNT; ++i)
|
||||
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
|
||||
if( m_targetIcons[i] == targetGuid )
|
||||
SetTargetIcon(i, 0, 0);
|
||||
|
||||
|
|
@ -934,10 +934,10 @@ void Group::SendTargetIconList(WorldSession *session)
|
|||
if(!session)
|
||||
return;
|
||||
|
||||
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+TARGETICONCOUNT*9));
|
||||
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+TARGET_ICON_COUNT*9));
|
||||
data << uint8(1); // list targets
|
||||
|
||||
for(int i = 0; i < TARGETICONCOUNT; ++i)
|
||||
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
|
||||
{
|
||||
if(m_targetIcons[i] == 0)
|
||||
continue;
|
||||
|
|
@ -1066,9 +1066,9 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant)
|
|||
if (m_subGroupsCounts)
|
||||
{
|
||||
bool groupFound = false;
|
||||
for (; groupid < MAXRAIDSIZE / MAXGROUPSIZE; ++groupid)
|
||||
for (; groupid < MAX_RAID_SUBGROUPS; ++groupid)
|
||||
{
|
||||
if (m_subGroupsCounts[groupid] < MAXGROUPSIZE)
|
||||
if (m_subGroupsCounts[groupid] < MAX_GROUP_SIZE)
|
||||
{
|
||||
groupFound = true;
|
||||
break;
|
||||
|
|
@ -1121,7 +1121,7 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant, u
|
|||
|
||||
if(!isRaidGroup()) // reset targetIcons for non-raid-groups
|
||||
{
|
||||
for(int i = 0; i < TARGETICONCOUNT; ++i)
|
||||
for(int i = 0; i < TARGET_ICON_COUNT; ++i)
|
||||
m_targetIcons[i] = 0;
|
||||
}
|
||||
|
||||
|
|
@ -1260,7 +1260,7 @@ void Group::_removeRolls(const uint64 &guid)
|
|||
}
|
||||
}
|
||||
|
||||
bool Group::_setMembersGroup(const uint64 &guid, const uint8 &group)
|
||||
bool Group::_setMembersGroup(const uint64 &guid, uint8 group)
|
||||
{
|
||||
member_witerator slot = _getMemberWSlot(guid);
|
||||
if(slot == m_memberSlots.end())
|
||||
|
|
@ -1327,21 +1327,24 @@ bool Group::SameSubGroup(Player const* member1, Player const* member2) const
|
|||
}
|
||||
|
||||
// allows setting subgroup for offline members
|
||||
void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group)
|
||||
void Group::ChangeMembersGroup(const uint64 &guid, uint8 group)
|
||||
{
|
||||
if(!isRaidGroup())
|
||||
if (!isRaidGroup())
|
||||
return;
|
||||
|
||||
Player *player = sObjectMgr.GetPlayer(guid);
|
||||
|
||||
if (!player)
|
||||
{
|
||||
uint8 prevSubGroup;
|
||||
prevSubGroup = GetMemberGroup(guid);
|
||||
|
||||
SubGroupCounterDecrease(prevSubGroup);
|
||||
uint8 prevSubGroup = GetMemberGroup(guid);
|
||||
if (prevSubGroup == group)
|
||||
return;
|
||||
|
||||
if(_setMembersGroup(guid, group))
|
||||
{
|
||||
SubGroupCounterDecrease(prevSubGroup);
|
||||
SendUpdate();
|
||||
}
|
||||
}
|
||||
else
|
||||
// This methods handles itself groupcounter decrease
|
||||
|
|
@ -1349,14 +1352,18 @@ void Group::ChangeMembersGroup(const uint64 &guid, const uint8 &group)
|
|||
}
|
||||
|
||||
// only for online members
|
||||
void Group::ChangeMembersGroup(Player *player, const uint8 &group)
|
||||
void Group::ChangeMembersGroup(Player *player, uint8 group)
|
||||
{
|
||||
if(!player || !isRaidGroup())
|
||||
if (!player || !isRaidGroup())
|
||||
return;
|
||||
if(_setMembersGroup(player->GetGUID(), group))
|
||||
|
||||
uint8 prevSubGroup = player->GetSubGroup();
|
||||
if (prevSubGroup == group)
|
||||
return;
|
||||
|
||||
if (_setMembersGroup(player->GetGUID(), group))
|
||||
{
|
||||
uint8 prevSubGroup = player->GetSubGroup();
|
||||
if( player->GetGroup() == this )
|
||||
if (player->GetGroup() == this)
|
||||
player->GetGroupRef().setSubGroup(group);
|
||||
//if player is in BG raid, it is possible that he is also in normal raid - and that normal raid is stored in m_originalGroup reference
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue