本文整理汇总了C++中CvImprovementEntry类的典型用法代码示例。如果您正苦于以下问题:C++ CvImprovementEntry类的具体用法?C++ CvImprovementEntry怎么用?C++ CvImprovementEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CvImprovementEntry类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetEntry
/// Tell which improvement unlocks a resource
CvImprovementEntry* CvImprovementXMLEntries::GetImprovementForResource(int eResource)
{
for(unsigned int iImprovement = 0; iImprovement < m_paImprovementEntries.size(); ++iImprovement)
{
CvImprovementEntry* pImprovement = GetEntry((ImprovementTypes)iImprovement);
if(pImprovement && pImprovement->IsImprovementResourceMakesValid(eResource))
{
return pImprovement;
}
}
return NULL;
}
示例2: defined
/// Value of plot for providing food
int CvCitySiteEvaluator::ComputeFoodValue(CvPlot* pPlot, const CvPlayer* pPlayer)
{
int rtnValue = 0;
// From tile yield
if(pPlayer == NULL)
{
rtnValue += pPlot->calculateNatureYield(YIELD_FOOD, NO_PLAYER);
}
else
{
rtnValue += pPlot->calculateNatureYield(YIELD_FOOD, pPlayer->GetID());
}
#if defined(MOD_BALANCE_CORE_SETTLER)
// assume a farm or similar on suitable terrain ... should be build sooner or later. value averages out with other improvements ...
if (MOD_BALANCE_CORE_SETTLER && (pPlot->getTerrainType()==TERRAIN_GRASS || pPlot->getTerrainType()==TERRAIN_PLAINS || pPlot->getFeatureType()==FEATURE_FLOOD_PLAINS))
rtnValue += 1;
//Help with island settling - assume a lighthouse
if(pPlot->isShallowWater())
{
rtnValue += 1;
}
#endif
// From resource
TeamTypes eTeam = NO_TEAM;
if(pPlayer != NULL)
{
eTeam = pPlayer->getTeam();
}
ResourceTypes eResource;
eResource = pPlot->getResourceType(eTeam);
if(eResource != NO_RESOURCE)
{
//can we build an improvement on this resource? assume we will do it (natural yield is already considered)
CvImprovementEntry* pImprovement = GC.GetGameImprovements()->GetImprovementForResource(eResource);
if(pImprovement)
{
rtnValue += pImprovement->GetImprovementResourceYield(eResource, YIELD_FOOD);
}
}
return rtnValue * m_iFlavorMultiplier[YIELD_FOOD];
}
示例3: CvAssert
/// Vale of plot for providing faith
int CvCitySiteEvaluator::ComputeFaithValue(CvPlot* pPlot, CvPlayer* pPlayer)
{
int rtnValue = 0;
CvAssert(pPlot);
if(!pPlot) return rtnValue;
// From tile yield
if(pPlayer == NULL)
{
rtnValue += pPlot->calculateNatureYield(YIELD_FAITH, NO_TEAM);
}
else
{
rtnValue += pPlot->calculateNatureYield(YIELD_FAITH, pPlayer->getTeam());
}
// From resource
TeamTypes eTeam = NO_TEAM;
if(pPlayer != NULL)
{
eTeam = pPlayer->getTeam();
}
ResourceTypes eResource;
eResource = pPlot->getResourceType(eTeam);
if(eResource != NO_RESOURCE)
{
rtnValue += GC.getResourceInfo(eResource)->getYieldChange(YIELD_FAITH);
CvImprovementEntry* pImprovement = GC.GetGameImprovements()->GetImprovementForResource(eResource);
if(pImprovement)
{
rtnValue += pImprovement->GetImprovementResourceYield(eResource, YIELD_FAITH);
}
}
return rtnValue * m_iFlavorMultiplier[YIELD_FAITH];
}
示例4: CvAssert
/// Vale of plot for providing faith
int CvCitySiteEvaluator::ComputeFaithValue(CvPlot* pPlot, const CvPlayer* pPlayer)
{
int rtnValue = 0;
CvAssert(pPlot);
if(!pPlot) return rtnValue;
// From tile yield
if(pPlayer == NULL)
{
rtnValue += pPlot->calculateNatureYield(YIELD_FAITH, NO_PLAYER);
}
else
{
rtnValue += pPlot->calculateNatureYield(YIELD_FAITH, pPlayer->GetID());
}
// From resource
TeamTypes eTeam = NO_TEAM;
if(pPlayer != NULL)
{
eTeam = pPlayer->getTeam();
}
ResourceTypes eResource;
eResource = pPlot->getResourceType(eTeam);
if(eResource != NO_RESOURCE)
{
//can we build an improvement on this resource? assume we will do it (natural yield is already considered)
CvImprovementEntry* pImprovement = GC.GetGameImprovements()->GetImprovementForResource(eResource);
if(pImprovement)
{
rtnValue += pImprovement->GetImprovementResourceYield(eResource, YIELD_FAITH);
}
}
return rtnValue * m_iFlavorMultiplier[YIELD_FAITH];
}
示例5: CvAssertMsg
CvPlot* CvPlayerAI::FindBestArtistTargetPlot(CvUnit* pGreatArtist, int& iResultScore)
{
CvAssertMsg(pGreatArtist, "pGreatArtist is null");
if(!pGreatArtist)
{
return NULL;
}
iResultScore = 0;
CvPlotsVector& m_aiPlots = GetPlots();
CvPlot* pBestPlot = NULL;
int iBestScore = 0;
// loop through plots and wipe out ones that are invalid
const uint nPlots = m_aiPlots.size();
for(uint ui = 0; ui < nPlots; ui++)
{
if(m_aiPlots[ui] == -1)
{
continue;
}
CvPlot* pPlot = GC.getMap().plotByIndex(m_aiPlots[ui]);
if(pPlot->isWater())
{
continue;
}
if(!pPlot->IsAdjacentOwnedByOtherTeam(getTeam()))
{
continue;
}
// don't build over luxury resources
ResourceTypes eResource = pPlot->getResourceType();
if(eResource != NO_RESOURCE)
{
CvResourceInfo* pkResource = GC.getResourceInfo(eResource);
if(pkResource != NULL)
{
if (pkResource->getResourceUsage() == RESOURCEUSAGE_LUXURY)
{
continue;
}
}
}
// if no improvement can be built on this plot, then don't consider it
FeatureTypes eFeature = pPlot->getFeatureType();
if (eFeature != NO_FEATURE && GC.getFeatureInfo(eFeature)->isNoImprovement())
{
continue;
}
// Improvement already here?
ImprovementTypes eImprovement = (ImprovementTypes)pPlot->getImprovementType();
if (eImprovement != NO_IMPROVEMENT)
{
CvImprovementEntry* pkImprovementInfo = GC.getImprovementInfo(eImprovement);
if(pkImprovementInfo)
{
if (pkImprovementInfo->GetCultureBombRadius() > 0)
{
continue;
}
}
}
int iScore = 0;
for(int iI = 0; iI < NUM_DIRECTION_TYPES; ++iI)
{
CvPlot* pAdjacentPlot = plotDirection(pPlot->getX(), pPlot->getY(), ((DirectionTypes)iI));
// if there's no plot, bail
if(pAdjacentPlot == NULL)
{
continue;
}
// if the plot is ours or no one's, bail
if(pAdjacentPlot->getTeam() == NO_TEAM || pAdjacentPlot->getTeam() == getTeam())
{
continue;
}
// don't evaluate city plots since we don't get ownership of them with the bomb
if(pAdjacentPlot->getPlotCity())
{
continue;
}
const PlayerTypes eOtherPlayer = pAdjacentPlot->getOwner();
if(GET_PLAYER(eOtherPlayer).isMinorCiv())
{
MinorCivApproachTypes eMinorApproach = GetDiplomacyAI()->GetMinorCivApproach(eOtherPlayer);
// if we're friendly or protective, don't be a jerk. Bail out.
if(eMinorApproach != MINOR_CIV_APPROACH_CONQUEST && eMinorApproach != MINOR_CIV_APPROACH_IGNORE)
//.........这里部分代码省略.........