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


C++ Objective::CommandoSite方法代码示例

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


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

示例1: IsValidObjective

// Determine if this objective can accept the passed orders
int GroundTaskingManagerClass::IsValidObjective (int orders, Objective o)
{
	if (!o)
		return 0;

	switch (orders)
	{
			case GORD_CAPTURE:
					if (o->IsSecondary() && o->IsNearfront() && GetRoE(owner,o->GetTeam(),ROE_GROUND_CAPTURE) == ROE_ALLOWED)
						return 1;
					break;
			case GORD_SECURE:
					if (o->IsSecondary() && owner == o->GetTeam() && (o->IsFrontline() || o->IsSecondline()))
						return 1;
					break;
			case GORD_ASSAULT:
					if (o->IsSecondary() && !o->IsNearfront() && o->IsBeach() && GetRoE(owner,o->GetTeam(),ROE_GROUND_CAPTURE) == ROE_ALLOWED)
						return 1;
					break;
			case GORD_AIRBORNE:
					if (o->IsSecondary() && !o->IsNearfront()  && GetRoE(owner,o->GetTeam(),ROE_GROUND_CAPTURE) == ROE_ALLOWED) //  && !defended)
						return 1;
					break;
			case GORD_COMMANDO:
					if (o->CommandoSite() && GetRoE(owner,o->GetTeam(),ROE_GROUND_CAPTURE) == ROE_ALLOWED)
						return 1;
					break;
			case GORD_DEFEND:
					if (o->IsSecondary() && o->IsNearfront() && owner == o->GetTeam() && !o->Abandoned())
						return 1;
					break;
			case GORD_SUPPORT:
					if (owner == o->GetTeam() && o->ArtillerySite())
						return 1;
					break;
			case GORD_REPAIR:
					if (owner == o->GetTeam() && o->NeedRepair() && o->GetObjectiveStatus() < 51)
						return 1;
					break;
			case GORD_AIRDEFENSE:
					if (owner == o->GetTeam() && o->SamSite())
						return 1;
					break;
			case GORD_RECON:
					return 0;
					break;
			case GORD_RADAR:
					if (owner == o->GetTeam() && o->RadarSite())
						return 1;
					break;
			case GORD_RESERVE:
			default:
					if (o->IsSecondary() && owner == o->GetTeam() && !o->IsNearfront())
						return 1;
					break;
	}
	return 0;
}
开发者ID:FreeFalcon,项目名称:freefalcon-central,代码行数:59,代码来源:gtm.cpp

示例2: GetAddBits

// KCK: This is an admittidly hackish way of determining which lists to add the objective to,
// but it's either this or call IsValidObjective() for each order type which would require many
// more checks.. HOWEVER, we need to keep this and IsValidObjective() in sync (they must agree)
int GroundTaskingManagerClass::GetAddBits (Objective o, int to_collect)
{
	int add_now = to_collect;

	if (!o)
		return 0;

	if (!o->IsSecondary())
		add_now &= ~(COLLECT_RESERVE | COLLECT_CAPTURE | COLLECT_SECURE | COLLECT_ASSAULT | COLLECT_AIRBORNE | COLLECT_DEFEND);
	if (o->IsNearfront())
		add_now &= ~(COLLECT_RESERVE | COLLECT_ASSAULT | COLLECT_AIRBORNE);
	else
		add_now &= ~(COLLECT_CAPTURE | COLLECT_DEFEND);
	if (owner != o->GetTeam())
		add_now &= ~(COLLECT_RESERVE | COLLECT_SECURE | COLLECT_DEFEND | COLLECT_SUPPORT | COLLECT_REPAIR | COLLECT_AIRDEFENSE | COLLECT_RADAR);
	if (GetRoE(owner,o->GetTeam(),ROE_GROUND_CAPTURE) != ROE_ALLOWED)
		add_now &= ~(COLLECT_CAPTURE | COLLECT_ASSAULT | COLLECT_AIRBORNE | COLLECT_COMMANDO);
	if (o->Abandoned())
		add_now &= ~COLLECT_DEFEND;
	if (!o->IsFrontline() && !o->IsSecondline())
		add_now &= ~(COLLECT_SECURE);
	if (!o->IsBeach())
		add_now &= ~(COLLECT_ASSAULT);
	if (1) // defended
		add_now &= ~(COLLECT_AIRBORNE);
	if (!o->CommandoSite())
		add_now &= ~(COLLECT_COMMANDO);
	if (!o->ArtillerySite())
		add_now &= ~(COLLECT_SUPPORT);
	if (!o->NeedRepair() || o->GetObjectiveStatus() > 50)
		add_now &= ~(COLLECT_REPAIR);
	if (!o->SamSite())
		add_now &= ~(COLLECT_AIRDEFENSE);
	if (!o->RadarSite())
		add_now &= ~(COLLECT_RADAR);
	return add_now;
}
开发者ID:FreeFalcon,项目名称:freefalcon-central,代码行数:40,代码来源:gtm.cpp


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