本文整理汇总了C++中CvImprovementEntry::GetRequiredCivilization方法的典型用法代码示例。如果您正苦于以下问题:C++ CvImprovementEntry::GetRequiredCivilization方法的具体用法?C++ CvImprovementEntry::GetRequiredCivilization怎么用?C++ CvImprovementEntry::GetRequiredCivilization使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvImprovementEntry
的用法示例。
在下文中一共展示了CvImprovementEntry::GetRequiredCivilization方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlotFoundValue
/// Retrieve the relative value of this plot (including plots that would be in city radius)
int CvCitySiteEvaluator::PlotFoundValue(CvPlot* pPlot, CvPlayer* pPlayer, YieldTypes eYield, bool)
{
CvAssert(pPlot);
if(!pPlot)
return 0;
// Make sure this player can even build a city here
if(!CanFound(pPlot, pPlayer, false))
{
return 0;
}
int rtnValue = 0;
int iFoodValue = 0;
int iHappinessValue = 0;
int iProductionValue = 0;
int iGoldValue = 0;
int iScienceValue = 0;
int iFaithValue = 0;
int iResourceValue = 0;
int iStrategicValue = 0;
int iCelticForestCount = 0;
int iIroquoisForestCount = 0;
int iBrazilJungleCount = 0;
int iNaturalWonderCount = 0;
int iDesertCount = 0;
int iWetlandsCount = 0;
#if defined(MOD_BALANCE_CORE_SETTLER)
int iWaterPlot = 0;
int iBadPlot = 0;
int iLoopPlots = 0;
#endif
int iTotalFoodValue = 0;
int iTotalHappinessValue = 0;
int iTotalProductionValue = 0;
int iTotalGoldValue = 0;
int iTotalScienceValue = 0;
int iTotalFaithValue = 0;
int iTotalResourceValue = 0;
int iTotalStrategicValue = 0;
int iClosestCityOfMine = 999;
int iClosestEnemyCity = 999;
int iCapitalArea = NULL;
bool bIsInca = false;
int iAdjacentMountains = 0;
if ( pPlayer->getCapitalCity() )
iCapitalArea = pPlayer->getCapitalCity()->getArea();
// Custom code for Inca ideal terrace farm locations
ImprovementTypes eIncaImprovement = (ImprovementTypes)GC.getInfoTypeForString("IMPROVEMENT_TERRACE_FARM", true);
if(eIncaImprovement != NO_IMPROVEMENT)
{
CvImprovementEntry* pkEntry = GC.getImprovementInfo(eIncaImprovement);
if(pkEntry != NULL && pkEntry->IsSpecificCivRequired())
{
CivilizationTypes eCiv = pkEntry->GetRequiredCivilization();
if(eCiv == pPlayer->getCivilizationType())
{
bIsInca = true;
}
}
}
for (int iDX = -7; iDX <= 7; iDX++)
{
for (int iDY = -7; iDY <= 7; iDY++)
{
CvPlot* pLoopPlot = plotXY(pPlot->getX(), pPlot->getY(), iDX, iDY);
if (pLoopPlot != NULL)
{
int iDistance = plotDistance(pPlot->getX(), pPlot->getY(), pLoopPlot->getX(), pLoopPlot->getY());
if (iDistance <= 7)
{
if ((pLoopPlot->getOwner() == NO_PLAYER) || (pLoopPlot->getOwner() == pPlayer->GetID()))
{
// See if there are other cities nearby
if (iClosestCityOfMine > iDistance)
{
if (pLoopPlot->isCity())
{
iClosestCityOfMine = iDistance;
}
}
// Skip the city plot itself for now
if (iDistance <= 5)
{
int iRingModifier = m_iRingModifier[iDistance];
iFoodValue = 0;
iProductionValue = 0;
//.........这里部分代码省略.........
示例2: PlotFoundValue
/// Retrieve the relative value of this plot (including plots that would be in city radius)
int CvCitySiteEvaluator::PlotFoundValue(CvPlot* pPlot, const CvPlayer* pPlayer, YieldTypes eYield, bool /*bCoastOnly*/, CvString* pDebug)
{
CvAssert(pPlot);
if(!pPlot)
return -1;
// Make sure this player can even build a city here
if(!CanFound(pPlot, pPlayer, false))
{
if(pDebug)
*pDebug = "cannot found";
return -1;
}
//for debugging
std::vector<std::string> vQualifiersPositive;
std::vector<std::string> vQualifiersNegative;
//total
int iTotalPlotValue = 0;
int iValueModifier = 0; //general modifiers
int iCivModifier = 0; //civ-specific modifiers
int iStratModifier = 0; //strategic modifiers
int iCelticForestCount = 0;
int iIroquoisForestCount = 0;
int iBrazilJungleCount = 0;
int iNaturalWonderCount = 0;
int iDesertCount = 0;
int iWetlandsCount = 0;
int iLakeCount = 0;
int iLuxuryCount = 0;
//currently just for debugging
int iTotalFoodValue = 0;
int iTotalHappinessValue = 0;
int iTotalProductionValue = 0;
int iTotalGoldValue = 0;
int iTotalScienceValue = 0;
int iTotalFaithValue = 0;
int iTotalResourceValue = 0;
int iTotalStrategicValue = 0;
//use a slightly negative base value to discourage settling in bad lands
int iDefaultPlotValue = -100;
int iBorderlandRange = 6;
int iCapitalArea = NULL;
bool bIsAlmostCoast = false;
bool bIsInca = false;
int iAdjacentMountains = 0;
std::vector<SPlotWithScore> workablePlots;
workablePlots.reserve(49);
TeamTypes eTeam = pPlayer ? pPlayer->getTeam() : NO_TEAM;
PlayerTypes ePlayer = pPlayer ? pPlayer->GetID() : NO_PLAYER;
if (pPlayer)
{
if ( pPlayer->getCapitalCity() )
{
iCapitalArea = pPlayer->getCapitalCity()->getArea();
}
// Custom code for Inca ideal terrace farm locations
ImprovementTypes eIncaImprovement = (ImprovementTypes)GC.getInfoTypeForString("IMPROVEMENT_TERRACE_FARM", true);
if(eIncaImprovement != NO_IMPROVEMENT)
{
CvImprovementEntry* pkEntry = GC.getImprovementInfo(eIncaImprovement);
if(pkEntry != NULL && pkEntry->IsSpecificCivRequired())
{
CivilizationTypes eCiv = pkEntry->GetRequiredCivilization();
if(eCiv == pPlayer->getCivilizationType())
{
bIsInca = true;
}
}
}
}
int iRange = pPlayer ? pPlayer->getWorkPlotDistance() : 3;
for (int iDX = -iRange; iDX <= iRange; iDX++)
{
for (int iDY = -iRange; iDY <= iRange; iDY++)
{
CvPlot* pLoopPlot = plotXY(pPlot->getX(), pPlot->getY(), iDX, iDY);
if (pLoopPlot != NULL)
{
int iDistance = plotDistance(pPlot->getX(), pPlot->getY(), pLoopPlot->getX(), pLoopPlot->getY());
if (iDistance <= iRange)
{
int iRingModifier = m_iRingModifier[iDistance];
//.........这里部分代码省略.........