本文整理汇总了C++中CvPlot::canHaveImprovement方法的典型用法代码示例。如果您正苦于以下问题:C++ CvPlot::canHaveImprovement方法的具体用法?C++ CvPlot::canHaveImprovement怎么用?C++ CvPlot::canHaveImprovement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvPlot
的用法示例。
在下文中一共展示了CvPlot::canHaveImprovement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canPlaceGoodyAt
bool CvMapGenerator::canPlaceGoodyAt(ImprovementTypes eImprovement, int iX, int iY)
{
PROFILE_FUNC();
CvPlot* pPlot;
FAssertMsg(eImprovement != NO_IMPROVEMENT, "Improvement is not assigned a valid value");
FAssertMsg(GC.getImprovementInfo(eImprovement).isGoody(), "ImprovementType eImprovement is expected to be a goody");
if (GC.getGameINLINE().isOption(GAMEOPTION_NO_GOODY_HUTS))
{
return false;
}
pPlot = GC.getMapINLINE().plotINLINE(iX, iY);
if (!(pPlot->canHaveImprovement(eImprovement, NO_TEAM)))
{
return false;
}
long result = 0;
if (gDLL->getPythonIFace()->pythonCanPlaceGoodyAt(pPlot, &result) && !gDLL->getPythonIFace()->pythonUsingDefaultImpl()) // Python override
{
if (result >= 0)
{
return result;
}
else
{
FAssertMsg(false, "pythonGetRiverAltitude() must return >= 0");
}
}
if (pPlot->getImprovementType() != NO_IMPROVEMENT)
{
return false;
}
if (pPlot->getBonusType() != NO_BONUS)
{
return false;
}
if (pPlot->isImpassable())
{
return false;
}
int iUniqueRange = GC.getImprovementInfo(eImprovement).getGoodyUniqueRange();
for (int iDX = -iUniqueRange; iDX <= iUniqueRange; iDX++)
{
for (int iDY = -iUniqueRange; iDY <= iUniqueRange; iDY++)
{
CvPlot *pLoopPlot = plotXY(iX, iY, iDX, iDY);
if (pLoopPlot != NULL && pLoopPlot->getImprovementType() == eImprovement)
{
return false;
}
}
}
return true;
}