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


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

本文整理汇总了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;
	}
}
开发者ID:vata,项目名称:wowice,代码行数:58,代码来源:Group.cpp

示例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();
}
开发者ID:vata,项目名称:wowice,代码行数:51,代码来源:Group.cpp

示例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();
}
开发者ID:jameyboor,项目名称:Antrix,代码行数:14,代码来源:Group.cpp


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