本文整理汇总了C++中CvCity::getID方法的典型用法代码示例。如果您正苦于以下问题:C++ CvCity::getID方法的具体用法?C++ CvCity::getID怎么用?C++ CvCity::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvCity
的用法示例。
在下文中一共展示了CvCity::getID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AI_tradeRoutes
bool CvSelectionGroupAI::AI_tradeRoutes()
{
PROFILE_FUNC();
const IDInfo kEurope(getOwnerINLINE(), CvTradeRoute::EUROPE_CITY_ID);
CvCity* pPlotCity = plot()->getPlotCity();
CvPlayerAI& kOwner = GET_PLAYER(getOwnerINLINE());
std::set<int>::iterator it;
std::map<IDInfo, int> cityValues;
std::vector<CvTradeRoute*> routes;
std::vector<int> routeValues;
std::vector<bool> yieldsDelivered(NUM_YIELD_TYPES, false);
std::vector<bool> yieldsToUnload(NUM_YIELD_TYPES, false);
std::vector<int> yieldsOnBoard(NUM_YIELD_TYPES, false);
if (!isHuman() || (getAutomateType() == AUTOMATE_TRANSPORT_FULL))
{
std::vector<CvTradeRoute*> aiRoutes;
kOwner.getTradeRoutes(aiRoutes);
for (uint i = 0; i < aiRoutes.size(); ++i)
{
CvTradeRoute* pRoute = aiRoutes[i];
// transport feeder - start - Nightinggale
CvCity* pDestinationCity = ::getCity(pRoute->getDestinationCity());
if (pDestinationCity != NULL && pDestinationCity->isAutoImportStopped(pRoute->getYield()))
{
// ignore trade routes where destination is using feeder service and is full
continue;
}
// transport feeder - end - Nightinggale
// traderoute fix - start - Nightinggale
if (isHuman() && pRoute->getDestinationCity().eOwner != getOwnerINLINE())
{
// humans can't transport to allied cities with fully automated transports
continue;
}
// traderoute fix - end - Nightinggale
CvCity* pSourceCity = ::getCity(pRoute->getSourceCity());
CvArea* pSourceWaterArea = pSourceCity->waterArea();
if ((pSourceCity != NULL) && ((getDomainType() != DOMAIN_SEA) || (pSourceWaterArea != NULL)))
{
int iSourceArea = (getDomainType() == DOMAIN_SEA) ? pSourceWaterArea->getID() : pSourceCity->getArea();
if (getDomainType() == DOMAIN_SEA ? plot()->isAdjacentToArea(iSourceArea) : (iSourceArea == getArea()))
{
if ((getDomainType() == DOMAIN_SEA) || (pRoute->getDestinationCity() != kEurope))
{
routes.push_back(pRoute);
routeValues.push_back(0);
yieldsDelivered[pRoute->getYield()] = true;
if (pPlotCity != NULL && ::getCity(pRoute->getDestinationCity()) == pPlotCity)
{
yieldsToUnload[pRoute->getYield()] = true;
}
cityValues[pRoute->getSourceCity()] = 0;
cityValues[pRoute->getDestinationCity()] = 0;
}
}
}
}
}
else
{
for (it = m_aTradeRoutes.begin(); it != m_aTradeRoutes.end(); ++it)
{
CvTradeRoute* pRoute = kOwner.getTradeRoute(*it);
CvCity* pSourceCity = ::getCity(pRoute->getSourceCity());
if (pSourceCity != NULL)
{
CvArea* pSourceWaterArea = pSourceCity->waterArea();
if (getDomainType() != DOMAIN_SEA || pSourceWaterArea != NULL)
{
int iSourceArea = (getDomainType() == DOMAIN_SEA) ? pSourceWaterArea->getID() : pSourceCity->getArea();
if (getDomainType() == DOMAIN_SEA ? plot()->isAdjacentToArea(iSourceArea) : (iSourceArea == getArea()))
{
if ((getDomainType() == DOMAIN_SEA) || (pRoute->getDestinationCity() != kEurope))
{
routes.push_back(pRoute);
routeValues.push_back(0);
yieldsDelivered[pRoute->getYield()] = true;
if (pPlotCity != NULL && ::getCity(pRoute->getDestinationCity()) == pPlotCity)
{
yieldsToUnload[pRoute->getYield()] = true;
}
cityValues[pRoute->getSourceCity()] = 0;
cityValues[pRoute->getDestinationCity()] = 0;
//.........这里部分代码省略.........