当前位置: 首页>>代码示例>>C++>>正文


C++ SubGroup::GetMemberCount方法代码示例

本文整理汇总了C++中SubGroup::GetMemberCount方法的典型用法代码示例。如果您正苦于以下问题:C++ SubGroup::GetMemberCount方法的具体用法?C++ SubGroup::GetMemberCount怎么用?C++ SubGroup::GetMemberCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SubGroup的用法示例。


在下文中一共展示了SubGroup::GetMemberCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SendLfgList

void LfgMgr::SendLfgList(Player* plr, uint32 Dungeon)
{
    if (plr == NULL)
        return;

    if (Dungeon >= MAX_DUNGEONS)
        return;

    LfgPlayerList::iterator itr;
    GroupMembersSet::iterator it2;
    uint32 count = 0;
    Player * pl;
    uint32 i;
    uint64 tguid;
    SubGroup * sgrp;

    m_lock.Acquire();

    WorldPacket data(MSG_LOOKING_FOR_GROUP, ((m_lookingForGroup[Dungeon].size() + m_lookingForMore[Dungeon].size()) * 20) + 20);
    data << LfgDungeonTypes[Dungeon];
    data << Dungeon;
    data << uint32(m_lookingForGroup[Dungeon].size());
    data << uint32(m_lookingForGroup[Dungeon].size());

    for (itr = m_lookingForGroup[Dungeon].begin(); itr != m_lookingForGroup[Dungeon].end(); ++itr)
    {
        pl = *itr;
        if (pl->GetTeam() != plr->GetTeam() || pl == plr)
            continue;

        ++count;
        data << pl->GetNewGUID();
        data << pl->getLevel();
        data << pl->GetZoneId();
        data << uint8(0);		// 1=LFG?

        for (i = 0; i < MAX_LFG_QUEUE_ID; ++i)
            data << pl->LfgDungeonId[i] << uint8(0) << pl->LfgType[i];

        data << pl->Lfgcomment;

        // LFG members are never in parties.
        data << uint32(0);
    }

    for (itr = m_lookingForMore[Dungeon].begin(); itr != m_lookingForMore[Dungeon].end(); ++itr)
    {
        pl = *itr;
        if (pl->GetTeam() != plr->GetTeam() || pl == plr)
            continue;

        ++count;
        data << pl->GetNewGUID();
        data << pl->getLevel();
        data << pl->GetZoneId();
        data << uint8(1);		// 1=LFM?

        for (i = 0; i < MAX_LFG_QUEUE_ID; ++i)
            data << pl->LfgDungeonId[i] << uint8(0) << pl->LfgType[i];

        data << pl->Lfgcomment;

        if (pl->GetGroup() && pl->GetGroup()->GetGroupType() == GROUP_TYPE_PARTY)
        {
            pl->GetGroup()->Lock();
            sgrp = pl->GetGroup()->GetSubGroup(0);
            data << uint32(sgrp->GetMemberCount() - 1);
            for (it2 = sgrp->GetGroupMembersBegin(); it2 != sgrp->GetGroupMembersEnd(); ++it2)
            {
                if ((*it2)->m_loggedInPlayer)
                    data << (*it2)->m_loggedInPlayer->GetNewGUID();
                else
                {
                    tguid = (*it2)->guid;
                    FastGUIDPack(data, tguid);
                }
            }

            pl->GetGroup()->Unlock();
        }
        else
            data << uint32(0);
    }

    m_lock.Release();

    //*(uint32*)(data.contents()[8]) = count;
    //*(uint32*)(data.contents()[12]) = count;
    data.put(8, count);
    data.put(12, count);

    plr->GetSession()->SendPacket(&data);
}
开发者ID:AscEmu,项目名称:AscEmu_TBC,代码行数:93,代码来源:LfgMgr.cpp


注:本文中的SubGroup::GetMemberCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。