本文整理汇总了C++中CvCity::IsResistance方法的典型用法代码示例。如果您正苦于以下问题:C++ CvCity::IsResistance方法的具体用法?C++ CvCity::IsResistance怎么用?C++ CvCity::IsResistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvCity
的用法示例。
在下文中一共展示了CvCity::IsResistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AI_considerAnnex
void CvPlayerAI::AI_considerAnnex()
{
AI_PERF("AI-perf.csv", "AI_ considerAnnex");
// if the empire is unhappy, don't consider annexing
if (IsEmpireUnhappy())
{
return;
}
// if we're going for a culture victory, don't consider annexing
if (GetDiplomacyAI()->IsGoingForCultureVictory())
{
return;
}
// for Venice
if (GetPlayerTraits()->IsNoAnnexing())
{
return;
}
// if their capital city is puppeted, annex it
CvCity* pCity = getCapitalCity();
if (pCity && pCity->IsPuppet())
{
// we should only annex one city a turn, and sense this is one, we're done!
pCity->DoAnnex();
return;
}
std::vector<CityAndProduction> aCityAndProductions;
int iLoop = 0;
pCity = NULL;
// Find first coastal city in same area as settler
for(pCity = firstCity(&iLoop); pCity != NULL; pCity = nextCity(&iLoop))
{
CityAndProduction kEval;
kEval.pCity = pCity;
kEval.iProduction = pCity->getYieldRateTimes100(YIELD_PRODUCTION, false);
aCityAndProductions.push_back(kEval);
}
std::stable_sort(aCityAndProductions.begin(), aCityAndProductions.end(), CityAndProductionEval());
CvCity* pTargetCity = NULL;
float fCutoffValue = GC.getNORMAL_ANNEX();
BuildingClassTypes eCourthouseType = NO_BUILDINGCLASS;
// find courthouse
for(int eBuildingType = 0; eBuildingType < GC.getNumBuildingInfos(); eBuildingType++)
{
const BuildingTypes eBuilding = static_cast<BuildingTypes>(eBuildingType);
CvBuildingEntry* buildingInfo = GC.getBuildingInfo(eBuilding);
if(buildingInfo)
{
if (buildingInfo->IsNoOccupiedUnhappiness())
{
eCourthouseType = (BuildingClassTypes)buildingInfo->GetBuildingClassType();
break;
}
}
}
bool bCourthouseImprovement = false;
if (eCourthouseType != NO_BUILDINGCLASS)
{
if (GetPlayerPolicies()->GetBuildingClassProductionModifier(eCourthouseType) > 0)
{
bCourthouseImprovement = true;
}
}
if (bCourthouseImprovement)
{
fCutoffValue = GC.getAGGRESIVE_ANNEX();
}
uint uiCutOff = (uint)(aCityAndProductions.size() * fCutoffValue);
for (uint ui = 0; ui < uiCutOff; ui++)
{
if (aCityAndProductions[ui].pCity->IsPuppet())
{
pTargetCity = aCityAndProductions[ui].pCity;
break;
}
}
if (pTargetCity)
{
if (!pTargetCity->IsResistance())
{
pTargetCity->DoAnnex();
}
}
}