本文整理汇总了C++中CvUnit::AI_europeUpdate方法的典型用法代码示例。如果您正苦于以下问题:C++ CvUnit::AI_europeUpdate方法的具体用法?C++ CvUnit::AI_europeUpdate怎么用?C++ CvUnit::AI_europeUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvUnit
的用法示例。
在下文中一共展示了CvUnit::AI_europeUpdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AI_update
//.........这里部分代码省略.........
groupAttack(m_iGroupAttackX, m_iGroupAttackY, MOVE_DIRECT_ATTACK, bFailedAlreadyFighting);
}
// else pick AI action
else
{
CvUnit* pHeadUnit = getHeadUnit();
if (pHeadUnit == NULL || pHeadUnit->isDelayedDeath())
{
break;
}
if (pHeadUnit->AI_update())
{
// AI_update returns true when we should abort the loop and wait until next slice
break;
}
}
if (doDelayedDeath())
{
bDead = true;
break;
}
// if no longer group attacking, and force separate is true, then bail, decide what to do after group is split up
// (UnitAI of head unit may have changed)
if (!m_bGroupAttack && AI_isForceSeparate())
{
AI_separate(); // pointers could become invalid...
return true;
}
}
if (!bDead)
{
CvUnit* pHeadUnit = getHeadUnit();
if (pHeadUnit != NULL)
{
if ((pHeadUnit->getUnitTravelState() == UNIT_TRAVEL_STATE_IN_EUROPE) && AI_isControlled())
{
pEntityNode = headUnitNode();
while (pEntityNode != NULL)
{
pLoopUnit = ::getUnit(pEntityNode->m_data);
pEntityNode = nextUnitNode(pEntityNode);
pLoopUnit->AI_europeUpdate();
}
}
}
if (!isHuman())
{
bFollow = false;
// if we not group attacking, then check for follow action
if (!m_bGroupAttack)
{
pEntityNode = headUnitNode();
while ((pEntityNode != NULL) && readyToMove(true))
{
pLoopUnit = ::getUnit(pEntityNode->m_data);
pEntityNode = nextUnitNode(pEntityNode);
if (pLoopUnit->canMove())
{
if (pLoopUnit->AI_follow())
{
bFollow = true;
break;
}
}
}
}
if (doDelayedDeath())
{
bDead = true;
}
if (!bDead)
{
if (!bFollow && readyToMove(true))
{
pushMission(MISSION_SKIP);
}
}
}
}
if (bDead)
{
return true;
}
return (isBusy() || isCargoBusy());
}