本文整理汇总了C++中Objective::GetNeighbor方法的典型用法代码示例。如果您正苦于以下问题:C++ Objective::GetNeighbor方法的具体用法?C++ Objective::GetNeighbor怎么用?C++ Objective::GetNeighbor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Objective
的用法示例。
在下文中一共展示了Objective::GetNeighbor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendSupply
// This sends supply from s to d, subtracting from losses and adding to it's supply traffic field
// Updates values to amount which actually made it. returns 0 if none made it.
int SendSupply (Objective s, Objective d, int *supply, int *fuel)
{
Objective c;
PathClass path;
int i,l,n,loss,type;
if (!*supply && !*fuel)
return 0;
if (GetObjectivePath(&path,s,d,Foot,s->GetTeam(),PATH_MARINE) < 1)
return 0;
c = s;
loss = 0;
AddSupply(s,*supply/10,*fuel/10);
for (i=0; i<path.GetLength(); i++)
{
n = path.GetDirection(i);
c = c->GetNeighbor(n);
type = c->GetType();
if (type == TYPE_ROAD || type == TYPE_INTERSECT || type == TYPE_RAILROAD || type == TYPE_BRIDGE)
{
AddSupply(c,*supply/10,*fuel/10);
l = c->GetObjectiveSupplyLosses() + 2; // Automatic loss rate of 2% per objective
*supply = *supply*(100-l)/100;
*fuel = *fuel*(100-l)/100;
}
if (!*supply && !*fuel)
return 0;
}
return 1;
}