本文整理汇总了C++中SubGroup::GetID方法的典型用法代码示例。如果您正苦于以下问题:C++ SubGroup::GetID方法的具体用法?C++ SubGroup::GetID怎么用?C++ SubGroup::GetID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubGroup
的用法示例。
在下文中一共展示了SubGroup::GetID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddMember
bool Group::AddMember(PlayerInfo * info, int32 subgroupid/* =-1 */)
{
m_groupLock.Acquire();
Player * pPlayer = info->m_loggedInPlayer;
if( m_isqueued )
{
m_isqueued = false;
BattlegroundManager.RemoveGroupFromQueues(this);
}
if( !IsFull() )
{
SubGroup* subgroup = (subgroupid>0) ? m_SubGroups[subgroupid] : FindFreeSubGroup();
if(subgroup == NULL)
{
m_groupLock.Release();
return false;
}
if( subgroup->AddPlayer( info ) )
{
if( pPlayer != NULL )
sEventMgr.AddEvent( pPlayer,&Player::EventGroupFullUpdate, EVENT_PLAYER_UPDATE, 1500, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT );
if( info->m_Group && info->m_Group != this )
info->m_Group->RemovePlayer( info );
if( m_Leader == NULL && info->m_loggedInPlayer )
m_Leader = info;
info->m_Group = this;
info->subGroup = (int8)subgroup->GetID();
++m_MemberCount;
m_dirty = true;
Update(); // Send group update
m_groupLock.Release();
return true;
}
else
{
m_groupLock.Release();
info->m_Group = NULL;
info->subGroup = -1;
return false;
}
}
else
{
info->m_Group = NULL;
info->subGroup = -1;
m_groupLock.Release();
return false;
}
}
示例2: MovePlayer
void Group::MovePlayer(PlayerInfo *info, uint8 subgroup)
{
if( subgroup >= m_SubGroupCount )
return;
if( m_SubGroups[subgroup]->IsFull() )
return;
m_groupLock.Acquire();
SubGroup *sg = NULL;
if( info->subGroup > 0 && info->subGroup <= 8 )
sg = m_SubGroups[info->subGroup];
if( sg == NULL || sg->m_GroupMembers.find(info) == sg->m_GroupMembers.end() )
{
for( uint8 i = 0; i < m_SubGroupCount; ++i )
{
if( m_SubGroups[i] != NULL )
{
if( m_SubGroups[i]->m_GroupMembers.find(info) != m_SubGroups[i]->m_GroupMembers.end() )
{
sg = m_SubGroups[i];
break;
}
}
}
}
if( sg == NULL )
{
m_groupLock.Release();
return;
}
sg->RemovePlayer( info );
// Grab the new group, and insert
sg = m_SubGroups[subgroup];
if( !sg->AddPlayer( info ) )
{
RemovePlayer( info );
}
else
{
info->subGroup = (int8)sg->GetID();
}
Update();
m_groupLock.Release();
}
示例3: SetSubGroupLeader
void Group::SetSubGroupLeader(Player *pPlayer, uint8 subgroup)
{
sLog.outString("Set subgroup %d leader to %s", (uint32)subgroup, pPlayer->GetName());
ASSERT(subgroup < m_SubGroupCount);
SubGroup *group = m_SubGroups[subgroup];
if(group->GetID() != pPlayer->GetSubGroup())
{
sLog.outString("GROUP: Tried to set leader of subgroup %d and player %s is not in that group", group->GetID(), pPlayer->GetName());
return;
}
group->m_SubGroupLeader = pPlayer;
Update();
}