本文整理汇总了C++中CvCity::isImport方法的典型用法代码示例。如果您正苦于以下问题:C++ CvCity::isImport方法的具体用法?C++ CvCity::isImport怎么用?C++ CvCity::isImport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvCity
的用法示例。
在下文中一共展示了CvCity::isImport方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findTraderCity
CvCity* CvMap::findTraderCity(int iX, int iY, PlayerTypes eOwner, TeamTypes eTeam, bool bSameArea, bool bCoastalOnly, bool bNative, YieldTypes eNativeYield, int iMinAttitude, CvUnit* pUnit, bool bRandom)
{
int iBestValue = MAX_INT;
CvCity* pBestCity = NULL;
CvCity* pHomeCity = NULL;
if (pUnit != NULL)
{
pHomeCity = pUnit->getHomeCity();
if (pHomeCity == NULL)
{
return NULL;
}
}
std::vector<CvCity*> aCitys;
for (int iI = 0; iI < MAX_PLAYERS; iI++)
{
if (GET_PLAYER((PlayerTypes)iI).isAlive() && (!bNative || GET_PLAYER((PlayerTypes)iI).isNative()))
{
if ((eOwner == NO_PLAYER) || (eOwner != NO_PLAYER && (GET_PLAYER(eOwner).isNative() != GET_PLAYER((PlayerTypes)iI).isNative())))
{
if ((eTeam == NO_TEAM) || GET_TEAM(GET_PLAYER((PlayerTypes)iI).getTeam()).isOpenBorders(eTeam))
{
int iLoop;
for (CvCity* pLoopCity = GET_PLAYER((PlayerTypes)iI).firstCity(&iLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER((PlayerTypes)iI).nextCity(&iLoop))
{
int iNativeCityPathTurns;
if (pUnit == NULL || pUnit->generatePath(pLoopCity->plot(), 0, true, &iNativeCityPathTurns))
{
if (!bSameArea || (pLoopCity->area() == plotINLINE(iX, iY)->area()) || (bCoastalOnly && (pLoopCity->waterArea() == plotINLINE(iX, iY)->area())))
{
if (!bCoastalOnly || pLoopCity->isCoastal(GC.getMIN_WATER_SIZE_FOR_OCEAN()))
{
//if(!bNative || pLoopCity->isNative())
//{
if (eNativeYield == NO_YIELD || (iMinAttitude <= 0 && pLoopCity->AI_getDesiredYield() == eNativeYield) || (pLoopCity->isHuman() && pLoopCity->isImport(eNativeYield)))
{
int iValue = plotDistance(iX, iY, pLoopCity->getX_INLINE(), pLoopCity->getY_INLINE());
if ((iValue <= iMinAttitude) || iMinAttitude <= 0)
{
if (!bRandom)
{
if (iValue < iBestValue)
{
iBestValue = iValue;
pBestCity = pLoopCity;
}
}
else
{
aCitys.push_back(pLoopCity);
}
}
}
//}
}
}
}
}
}
}
}
}
if (bRandom)
{
int iRandom = aCitys.size();
if (iRandom >= 1)
{
iRandom = GC.getGameINLINE().getSorenRandNum(iRandom, "Random Find City");
return aCitys[iRandom];
}
else
{
return NULL;
}
}
return pBestCity;
}