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


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

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


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

示例1: DoCalculations

void GroundTaskingManagerClass::DoCalculations(void)
{
	Objective		o;
	int				score,fs,es,i;
	float			d;
	Team			t;
	GridIndex		x,y;
	POData			pd;

	// Don't do this if we're not active, or not owned by this machine
	if (!(TeamInfo[owner]->flags & TEAM_ACTIVE) || !IsLocal())
		return;

	topPriority = 0;
	VuListIterator	poit(POList);
	o = GetFirstObjective(&poit);
	while (o != NULL)
	{
		// Get score for proximity to front
		o->GetLocation(&x,&y);
		d = DistanceToFront(x,y);
		fs = FloatToInt32((200.0F - d) * 0.2F);

		t = o->GetTeam();
		pd = GetPOData(o);
		es = 0;
		// Get score for enemy strength
		if (d < 100.0F)
		{
			for (i=1; i<NUM_TEAMS; i++)
			{
				if (GetRoE(owner,i,ROE_GROUND_FIRE))
					es += pd->ground_assigned[i]/50;	// 1 assignment pt = 1 vehicle, so 1 enemy strength pt per 50 vehs..
			}
			if (es > 30)
				es = 30;								// Cap enemy strength after 1500 vehicles
			if (owner != t)
				es = -es + (rand()%5) - 2;
		}

		score = fs + es + (rand()%5);
		if (o->GetObjectivePriority() > 95)
			score += 50;
		if (o->GetObjectivePriority() > 90)
			score += 20;
		else
			score += o->GetObjectivePriority() - 80;

		//		os = (o->GetObjectivePriority()-80)*3;
		//		score = os + fs + es + (rand()%5);

		if (score < 0)
			score = 0;
		if (score > 100)
			score = 100;
		// Minimum of 1 priority if it's owned by us.
		if (!score && t == owner)
			score = 1;

		// KCK: AI's air and ground priorities are identical for now
		if (!(pd->flags & GTMOBJ_SCRIPTED_PRIORITY))
		{
			pd->ground_priority[owner] = score;
			pd->air_priority[owner] = score;
			// KCK: player_priority only used now if it's >= 0
			//			if (!(pd->flags & GTMOBJ_PLAYER_SET_PRIORITY))
			//				pd->player_priority[owner] = pd->air_priority[owner];
		}

		if (!GetRoE(owner,t,ROE_GROUND_CAPTURE) && owner != t)
			pd->ground_priority[owner] = 0;
		if (!GetRoE(owner,t,ROE_AIR_ATTACK) && owner != t)
			pd->air_priority[owner] = 0;

		if (score > topPriority)
		{
			topPriority = score;
			priorityObj = o->GetCampID();
		}
		o = GetNextObjective(&poit);
	}
}
开发者ID:FreeFalcon,项目名称:freefalcon-central,代码行数:82,代码来源:gtm.cpp


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