本文整理汇总了C++中CvCity::getMaintainLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ CvCity::getMaintainLevel方法的具体用法?C++ CvCity::getMaintainLevel怎么用?C++ CvCity::getMaintainLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvCity
的用法示例。
在下文中一共展示了CvCity::getMaintainLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AI_tradeRoutes
//.........这里部分代码省略.........
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());
if ((pDestinationCity == NULL) || (pDestinationCity != pPlotCity))
{
int iRouteValue = kOwner.AI_transferYieldValue(routes[i]->getDestinationCity(), routes[i]->getYield(), aiYieldsLoaded[routes[i]->getYield()]);
if (iRouteValue > 0)
{
cityValues[routes[i]->getDestinationCity()] += iRouteValue;
routeValues[i] += iRouteValue;
}
}
}
}
//We need to iterate over every source city, and see if there's anything which needs moving to the respective destination city.
//We apply some bias to the city we are presently at, but not too much - sometimes empty runs need to be made...
//Basically this looks at the entire NEXT trade run (source-city to dest-city), with some bias given towards
//starting it from pPlotCity as sourceCity.
//If we are carrying cargo, only count cities where we can unload.
for (uint i = 0; i < routes.size(); ++i)
{
CvCity* pSourceCity = ::getCity(routes[i]->getSourceCity());
if ((pSourceCity != NULL) && (bNoCargo || (cityValues[routes[i]->getSourceCity()] > 0)))
{
CvCity* pDestinationCity = ::getCity(routes[i]->getDestinationCity());
YieldTypes eYield = routes[i]->getYield();
int iAmount = pSourceCity->getYieldStored(eYield) - pSourceCity->getMaintainLevel(eYield);
if (iAmount > 0)
{
int iExportValue = kOwner.AI_transferYieldValue(routes[i]->getSourceCity(), routes[i]->getYield(), -iAmount);
int iImportValue = kOwner.AI_transferYieldValue(routes[i]->getDestinationCity(), routes[i]->getYield(), iAmount);
int iRouteValue = (iExportValue + iImportValue + 2 * std::min(iExportValue, iImportValue)) / 4;
if (pSourceCity == pPlotCity)
{
cityValues[routes[i]->getDestinationCity()] += 2 * iRouteValue;
}
else
{
cityValues[routes[i]->getSourceCity()] += iRouteValue;
}
routeValues[i] = iRouteValue;
}
}
}
// TAC - Trade Routes Advisor - koma13 - START
bool bIgnoreDanger = false;
CLLNode<IDInfo>* pUnitNode = headUnitNode();
while (pUnitNode != NULL)
{
CvUnit* pLoopUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = nextUnitNode(pUnitNode);
if (pLoopUnit != NULL && !pLoopUnit->isCargo())