本文整理汇总了C++中MMatchObject::GetEnterBattle方法的典型用法代码示例。如果您正苦于以下问题:C++ MMatchObject::GetEnterBattle方法的具体用法?C++ MMatchObject::GetEnterBattle怎么用?C++ MMatchObject::GetEnterBattle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MMatchObject
的用法示例。
在下文中一共展示了MMatchObject::GetEnterBattle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChooseCommander
const MUID MMatchRuleAssassinate::ChooseCommander(int nTeam)
{
MMatchStage* pStage = GetStage();
if (pStage == NULL) return MUID(0,0);
int nRedAliveCount, nBlueAliveCount, nChooseTeamCount;
if (GetAliveCount(&nRedAliveCount, &nBlueAliveCount) == false) return MUID(0,0);
if (nTeam == MMT_RED) {
if (nRedAliveCount <= 0) return MUID(0,0);
nChooseTeamCount = nRedAliveCount;
}
if (nTeam == MMT_BLUE) {
if (nBlueAliveCount <= 0) return MUID(0,0);
nChooseTeamCount = nBlueAliveCount;
}
if( m_bIsAdminCommander == true )
{
for(MUIDRefCache::iterator itor=pStage->GetObjBegin(); itor!=pStage->GetObjEnd(); itor++) {
MMatchObject* pObj = (MMatchObject*)(*itor).second;
if (pObj->GetEnterBattle() == false)
continue; // 배틀참가하고 있는 플레이어만 체크
if (pObj->GetTeam() == nTeam && pObj->GetAccountInfo()->m_nUGrade == MMUG_ADMIN)
{
return pObj->GetUID();
}
}
}
MTime time;
int nChoose = time.MakeNumber(1, nChooseTeamCount);
int nCount = 0;
for(MUIDRefCache::iterator itor=pStage->GetObjBegin(); itor!=pStage->GetObjEnd(); itor++) {
MMatchObject* pObj = (MMatchObject*)(*itor).second;
if (pObj->GetEnterBattle() == false) continue; // 배틀참가하고 있는 플레이어만 체크
if (pObj->GetTeam() == nTeam) {
nCount++;
if (nCount == nChoose) {
return pObj->GetUID();
}
}
}
return MUID(0,0);
}