本文整理汇总了C++中CvUnit::canUnload方法的典型用法代码示例。如果您正苦于以下问题:C++ CvUnit::canUnload方法的具体用法?C++ CvUnit::canUnload怎么用?C++ CvUnit::canUnload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvUnit
的用法示例。
在下文中一共展示了CvUnit::canUnload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AI_tradeRoutes
//.........这里部分代码省略.........
cityValues[pRoute->getDestinationCity()] = 0;
}
}
else
{
FAssertMsg(false, "Unexpected : Unit can't run trade route it's assigned to");
}
}
}
}
}
if ((pPlotCity != NULL) && hasCargo())
{
std::vector<CvUnit*> units;
//Unload everything which we should unload here, or can't unload anywhere...
CLLNode<IDInfo>* pUnitNode = plot()->headUnitNode();
while (pUnitNode != NULL)
{
CvUnit* pLoopUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = plot()->nextUnitNode(pUnitNode);
if (pLoopUnit != NULL)
{
YieldTypes eYield = pLoopUnit->getYield();
CvUnit* pTransport = pLoopUnit->getTransportUnit();
if ((eYield != NO_YIELD) && pTransport != NULL && (yieldsToUnload[eYield] || !(yieldsDelivered[eYield])))
{
if (pTransport->getGroup() == this && pLoopUnit->canUnload())
{
units.push_back(pLoopUnit);
}
}
}
}
for (uint i = 0; i < units.size(); ++i)
{
units[i]->unload();
}
}
short aiYieldsLoaded[NUM_YIELD_TYPES];
AI_getYieldsLoaded(aiYieldsLoaded);
bool bNoCargo = true;
for (int i = 0; i < NUM_YIELD_TYPES; ++i)
{
if (aiYieldsLoaded[i] > 0)
{
bNoCargo = false;
break;
}
}
if (!bNoCargo)
{
//We need to iterate over every destination city and see if we can unload.
for (uint i = 0; i < routes.size(); ++i)
{
CvCity* pDestinationCity = ::getCity(routes[i]->getDestinationCity());