本文整理汇总了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);
}
}