本文整理汇总了C++中CvPlot::isCity方法的典型用法代码示例。如果您正苦于以下问题:C++ CvPlot::isCity方法的具体用法?C++ CvPlot::isCity怎么用?C++ CvPlot::isCity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvPlot
的用法示例。
在下文中一共展示了CvPlot::isCity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BeginTurn
// ---------------------------------------------------------------------------
/// Called every turn
void CvBarbarians::BeginTurn()
{
CvGame &kGame = GC.getGame();
const ImprovementTypes eCamp = kGame.GetBarbarianCampImprovementType();
CvMap& kMap = GC.getMap();
int iWorldNumPlots = kMap.numPlots();
for (int iPlotLoop = 0; iPlotLoop < iWorldNumPlots; iPlotLoop++)
{
if (m_aiPlotBarbCampSpawnCounter[iPlotLoop] > 0)
{
// No Camp here any more
CvPlot* pPlot = kMap.plotByIndex(iPlotLoop);
if (pPlot->getImprovementType() != eCamp)
{
m_aiPlotBarbCampSpawnCounter[iPlotLoop] = -1;
m_aiPlotBarbCampNumUnitsSpawned[iPlotLoop] = -1;
}
else
{
m_aiPlotBarbCampSpawnCounter[iPlotLoop]--;
}
}
// Counter is negative, meaning a camp was cleared here recently and isn't allowed to respawn in the area for a while
else if (m_aiPlotBarbCampSpawnCounter[iPlotLoop] < -1)
{
m_aiPlotBarbCampSpawnCounter[iPlotLoop]++;
}
#if defined(MOD_DIPLOMACY_CITYSTATES)
if (MOD_DIPLOMACY_CITYSTATES) {
if (m_aiPlotBarbCitySpawnCounter[iPlotLoop] > 0)
{
// No City here any more
CvPlot* pPlot = kMap.plotByIndex(iPlotLoop);
if (pPlot->isCity() && pPlot->getOwner() != BARBARIAN_PLAYER)
{
m_aiPlotBarbCitySpawnCounter[iPlotLoop] = -1;
m_aiPlotBarbCityNumUnitsSpawned[iPlotLoop] = -1;
}
else
{
m_aiPlotBarbCitySpawnCounter[iPlotLoop]--;
}
}
// Counter is negative, meaning a camp was cleared here recently and isn't allowed to respawn in the area for a while
else if (m_aiPlotBarbCitySpawnCounter[iPlotLoop] < -1)
{
m_aiPlotBarbCitySpawnCounter[iPlotLoop]++;
}
}
#endif
}
}
示例2: 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;
//.........这里部分代码省略.........
示例3: syncRandPlot
//.........这里部分代码省略.........
{
///Tks Med
if (bIgnoreNativeTeams)
{
if (!GET_PLAYER(pTestPlot->getOwnerINLINE()).isNative())
{
bValid = false;
}
}
else
{
bValid = false;
}
///TKe
}
}
}
if (bValid)
{
if (iFlags & RANDPLOT_ADJACENT_UNOWNED)
{
if (pTestPlot->isAdjacentOwned())
{
bValid = false;
}
}
}
if (bValid)
{
if (iFlags & RANDPLOT_ADJACENT_LAND)
{
if (!(pTestPlot->isAdjacentToLand()))
{
bValid = false;
}
}
}
if (bValid)
{
if (iFlags & RANDPLOT_PASSIBLE)
{
if (pTestPlot->isImpassable())
{
bValid = false;
}
}
}
if (bValid)
{
if (iFlags & RANDPLOT_NOT_VISIBLE_TO_CIV)
{
///TKs Med
if (pTestPlot->isVisibleToCivTeam(bIgnoreNativeTeams))
{
bValid = false;
}
///TKe
}
}
///TKs Med
if (bValid)
{
if (bIgnoreNativeTeams)
{
if (pTestPlot->isVisibleToWatchingHuman())
{
bValid = false;
}
}
}
///TKe
if (bValid)
{
if (iFlags & RANDPLOT_NOT_CITY)
{
if (pTestPlot->isCity())
{
bValid = false;
}
}
}
if (bValid)
{
pPlot = pTestPlot;
break;
}
}
iCount++;
}
return pPlot;
}
示例4: 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 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;
if ( pPlayer->getCapitalCity() )
iCapitalArea = pPlayer->getCapitalCity()->getArea();
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;
iGoldValue = 0;
iScienceValue = 0;
iHappinessValue = 0;
iResourceValue = 0;
iStrategicValue = 0;
if (iDistance > 0 && iDistance <= NUM_CITY_RINGS)
{
if (eYield == NO_YIELD || eYield == YIELD_FOOD)
{
iFoodValue = iRingModifier * ComputeFoodValue(pLoopPlot, pPlayer) * /*15*/ GC.getSETTLER_FOOD_MULTIPLIER();
}
if (eYield == NO_YIELD || eYield == YIELD_PRODUCTION)
{
iProductionValue = iRingModifier * ComputeProductionValue(pLoopPlot, pPlayer) * /*3*/ GC.getSETTLER_PRODUCTION_MULTIPLIER();
}
if (eYield == NO_YIELD || eYield == YIELD_GOLD)
{
iGoldValue = iRingModifier * ComputeGoldValue(pLoopPlot, pPlayer) * /*2*/ GC.getSETTLER_GOLD_MULTIPLIER();
}
if (eYield == NO_YIELD || eYield == YIELD_SCIENCE)
{
iScienceValue = iRingModifier * ComputeScienceValue(pLoopPlot, pPlayer) * /*1*/ GC.getSETTLER_SCIENCE_MULTIPLIER();
}
if (eYield == NO_YIELD || eYield == YIELD_FAITH)
{
iFaithValue = iRingModifier * ComputeFaithValue(pLoopPlot, pPlayer) * /*1*/ GC.getSETTLER_FAITH_MULTIPLIER();
}
//.........这里部分代码省略.........