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


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

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


在下文中一共展示了Objective::IsSecondary方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ChooseTactic

int BrigadeClass::ChooseTactic (void)
	{
	int			priority=0,tid;

	haveWeaps = -1;
	tid = GTACTIC_BRIG_SECURE;
	while (tid < FirstGroundTactic + GroundTactics && !priority)
		{
		priority = CheckTactic(tid);
		if (!priority)
			tid++;
		}

	// Make Adjustments due to tactic
	if (tid == GTACTIC_BRIG_WITHDRAW)
		{
		Objective	o;
		o = GetUnitObjective();
		if (!o || !o->IsSecondary())
			{
			// Find a retreat path
			o = FindRetreatPath(this,3,FIND_SECONDARYONLY);
			if (o)
				SetUnitOrders(GORD_RESERVE,o->Id());
			// KCK: This will cause the whole brigade to surrender if the first element get's 
			// cutoff and we're withdrawing. So I'm axing it. Instead, we'll just wait until
			// the element surrenders.
//			else
//				CheckForSurrender();
			SetOrdered(1);
			}
		}
	if (GetUnitTactic() != tid)
		SetOrdered(1);
	SetUnitTactic(tid);
#ifdef ROBIN_GDEBUG
	if (TrackingOn[GetCampID()])
		MonoPrint("Brigade %d (%s) chose tactic %s.\n",GetCampID(),OrderStr[GetUnitOrders()],TacticsTable[tid].name);
#endif
	return tid;
	}
开发者ID:FreeFalcon,项目名称:freefalcon-central,代码行数:41,代码来源:brigade.cpp

示例3: RebuildObjectiveLists

// This only needs to be called at the start of the campaign (after objs loaded)
// or if any new objectives have been added
int RebuildObjectiveLists(void){
	Objective		o;
	
	POList->Purge();
	SOList->Purge();

	{
		// destroy iterator here
		VuListIterator	myit(AllObjList);
		o = GetFirstObjective(&myit);
		while (o != NULL){
			if (o->IsPrimary())
				POList->ForcedInsert(o);
			if (o->IsSecondary())
				SOList->ForcedInsert(o);
			o = GetNextObjective(&myit);
		}
	}
	CleanupObjList();
	return 1;
}
开发者ID:FreeFalcon,项目名称:freefalcon-central,代码行数:23,代码来源:camplist.cpp

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