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


C++ CTeamControlPointMaster::IsBaseControlPoint方法代码示例

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


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

示例1: MakePlayable

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CTeamControlPointRound::MakePlayable( void )
{
	CTeamControlPointMaster *pMaster = g_hControlPointMasters.Count() ? g_hControlPointMasters[0] : NULL;
	if ( pMaster )
	{
		if ( !IsPlayable() )
		{
			// we need to try switching the owners of the teams to make this round playable
			for ( int i = FIRST_GAME_TEAM ; i < GetNumberOfTeams() ; i++ )
			{
				for ( int j = 0 ; j < m_ControlPoints.Count() ; j++ )
				{
					if ( ( !pMaster->IsBaseControlPoint( m_ControlPoints[j]->GetPointIndex() ) ) && // this is NOT the base point for one of the teams (we don't want to assign the base to the wrong team)
						 ( !WouldNewCPOwnerWinGame( m_ControlPoints[j], i ) ) ) // making this change would make this round playable
					{
						// need to find the trigger area associated with this point
						CBaseEntity *pEnt = gEntList.FindEntityByClassname( NULL, pMaster->GetTriggerAreaCaptureName() );
						while( pEnt )
						{
							CTriggerAreaCapture *pArea = assert_cast<CTriggerAreaCapture*>( pEnt );
							if ( pArea )
							{	
								if ( pArea->TeamCanCap( i ) )
								{
									CHandle<CTeamControlPoint> hPoint = pArea->GetControlPoint();
									if ( hPoint == m_ControlPoints[j] )
									{
										// found! 
										pArea->ForceOwner( i ); // this updates the trigger_area *and* the control_point
										return true;
									}
								}
							}

							pEnt = gEntList.FindEntityByClassname( pEnt, pMaster->GetTriggerAreaCaptureName() );
						}
					}
				}
			}
		}
	}

	return false;
}
开发者ID:Baer42,项目名称:source-sdk-2013,代码行数:47,代码来源:team_control_point_round.cpp

示例2: MakePlayable

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CTeamControlPointRound::MakePlayable( void )
{
	CTeamControlPointMaster *pMaster = g_hControlPointMasters.Count() ? g_hControlPointMasters[0] : NULL;
	if ( pMaster )
	{
		if ( !IsPlayable() )
		{
			// we need to try switching the owners of the teams to make this round playable
			for ( int iTeam = FIRST_GAME_TEAM ; iTeam < GetNumberOfTeams() ; iTeam++ )
			{
				for ( int iControlPoint = 0 ; iControlPoint < m_ControlPoints.Count() ; iControlPoint++ )
				{
					if ( ( !pMaster->IsBaseControlPoint( m_ControlPoints[iControlPoint]->GetPointIndex() ) ) && // this is NOT the base point for one of the teams (we don't want to assign the base to the wrong team)
						 ( !WouldNewCPOwnerWinGame( m_ControlPoints[iControlPoint], iTeam ) ) ) // making this change would make this round playable
					{
						// need to find the trigger area associated with this point
						for ( int iObj=0; iObj<ITriggerAreaCaptureAutoList::AutoList().Count(); ++iObj )
						{
							CTriggerAreaCapture *pArea = static_cast< CTriggerAreaCapture * >( ITriggerAreaCaptureAutoList::AutoList()[iObj] );	
							if ( pArea->TeamCanCap( iTeam ) )
							{
								CHandle<CTeamControlPoint> hPoint = pArea->GetControlPoint();
								if ( hPoint == m_ControlPoints[iControlPoint] )
								{
									// found! 
									pArea->ForceOwner( iTeam ); // this updates the trigger_area *and* the control_point
									return true;
								}
							}
						}
					}
				}
			}
		}
	}

	return false;
}
开发者ID:staticfox,项目名称:TF2Classic,代码行数:41,代码来源:team_control_point_round.cpp


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