本文整理汇总了C++中CvUnit::AI_setUnitAIType方法的典型用法代码示例。如果您正苦于以下问题:C++ CvUnit::AI_setUnitAIType方法的具体用法?C++ CvUnit::AI_setUnitAIType怎么用?C++ CvUnit::AI_setUnitAIType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvUnit
的用法示例。
在下文中一共展示了CvUnit::AI_setUnitAIType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveUnit
/// Remove a unit from the army
bool CvArmyAI::RemoveUnit(int iUnitToRemoveID)
{
for(int iI = 0; iI < (int)m_FormationEntries.size(); iI++)
{
CvArmyFormationSlot slot = m_FormationEntries[iI];
if(slot.GetUnitID() == iUnitToRemoveID)
{
CvUnit* pThisUnit = GET_PLAYER(GetOwner()).getUnit(iUnitToRemoveID);
if(pThisUnit)
{
// Clears unit's army ID and erase from formation entries
pThisUnit->setArmyID(-1);
pThisUnit->AI_setUnitAIType(pThisUnit->getUnitInfo().GetDefaultUnitAIType());
// Tell the associate operation that a unit was lost
CvAIOperation* pThisOperation = GET_PLAYER(GetOwner()).getAIOperation(m_iOperationID);
if(pThisOperation)
pThisOperation->UnitWasRemoved(GetID(), iI);
return true;
}
}
}
return false;
}
示例2: ReleaseUnits
/// Deallocate memory
void CvArmyAI::ReleaseUnits(bool bAddUnitsToTacticalAI)
{
for (size_t i = 0; i<m_FormationEntries.size(); i++)
{
if (!m_FormationEntries[i].IsUsed())
continue;
CvUnit* pThisUnit = GET_PLAYER(GetOwner()).getUnit(m_FormationEntries[i].GetUnitID());
if (pThisUnit)
{
pThisUnit->setArmyID(-1);
pThisUnit->AI_setUnitAIType(pThisUnit->getUnitInfo().GetDefaultUnitAIType());
if (bAddUnitsToTacticalAI) //for stupid reasons we first recruit units and then disband armies ...
GET_PLAYER(GetOwner()).GetTacticalAI()->AddCurrentTurnUnit(pThisUnit);
}
}
m_FormationEntries.clear();
}