本文整理汇总了C++中SubGroup::AddPlayer方法的典型用法代码示例。如果您正苦于以下问题:C++ SubGroup::AddPlayer方法的具体用法?C++ SubGroup::AddPlayer怎么用?C++ SubGroup::AddPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubGroup
的用法示例。
在下文中一共展示了SubGroup::AddPlayer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddMember
bool Group::AddMember(Player* pPlayer)
{
if(!IsFull())
{
SubGroup* subgroup = FindFreeSubGroup();
if(subgroup == NULL)
{
// weird shit..
sLog.outDebug("GROUP: Tried to add member %s but FindFreeSubGroup returned NULL!", pPlayer->GetName());
return false;
}
subgroup->AddPlayer(pPlayer);
pPlayer->SetGroup(this);
if(m_MemberCount == 1)
{
// We're the only member? Set us to the leader.
SetLeader(pPlayer);
}
UpdateAllOutOfRangePlayersFor(pPlayer);
Update(); // Send group update
return true;
}
else
{
return false;
}
}
示例2: 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;
}
}
示例3: MovePlayer
void Group::MovePlayer(Player *pPlayer, uint8 subgroup)
{
ASSERT(subgroup < m_SubGroupCount);
SubGroup *sgr = GetSubGroup(pPlayer->GetSubGroup());
sgr->RemovePlayer(pPlayer);
// Grab the new group, and insert
sgr = m_SubGroups[subgroup];
sgr->AddPlayer(pPlayer);
Update();
}
示例4: 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();
}