本文整理汇总了C++中CvPlot::setImprovementType方法的典型用法代码示例。如果您正苦于以下问题:C++ CvPlot::setImprovementType方法的具体用法?C++ CvPlot::setImprovementType怎么用?C++ CvPlot::setImprovementType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvPlot
的用法示例。
在下文中一共展示了CvPlot::setImprovementType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addGoodies
void CvMapGenerator::addGoodies()
{
PROFILE("CvMapGenerator::addGoodies");
if (gDLL->getPythonIFace()->callFunction(gDLL->getPythonIFace()->getMapScriptModule(), "addGoodies"))
{
if (!gDLL->getPythonIFace()->pythonUsingDefaultImpl())
{
return; // Python override
}
}
gDLL->NiTextOut("Adding Goodies...");
if (GC.getEraInfo(GC.getGameINLINE().getStartEra()).isNoGoodies())
{
return;
}
int iNumPlots = GC.getMapINLINE().numPlotsINLINE();
int* piShuffle = shuffle(iNumPlots, GC.getGameINLINE().getMapRand());
for (int iI = 0; iI < GC.getNumImprovementInfos(); iI++)
{
if (GC.getImprovementInfo((ImprovementTypes)iI).isGoody() && GC.getImprovementInfo((ImprovementTypes)iI).getTilesPerGoody() > 0)
{
for (int iJ = 0; iJ < iNumPlots; iJ++)
{
gDLL->callUpdater();
CvPlot *pPlot = GC.getMapINLINE().plotByIndexINLINE(piShuffle[iJ]);
FAssertMsg(pPlot, "pPlot is expected not to be NULL");
if (!(pPlot->isWater()))
{
CvArea *pArea = GC.getMapINLINE().getArea(pPlot->getArea());
FAssertMsg(pArea, "pArea is expected not to be NULL");
if (pArea->getNumImprovements((ImprovementTypes)iI) < ((pArea->getNumTiles() + (GC.getImprovementInfo((ImprovementTypes)iI).getTilesPerGoody() / 2)) / GC.getImprovementInfo((ImprovementTypes) iI).getTilesPerGoody()))
{
if (canPlaceGoodyAt(((ImprovementTypes)iI), pPlot->getX_INLINE(), pPlot->getY_INLINE()))
{
pPlot->setImprovementType((ImprovementTypes)iI);
}
}
}
}
}
}
SAFE_DELETE_ARRAY(piShuffle);
}
示例2: addGoodies
void CvMapGenerator::addGoodies()
{
PROFILE_FUNC();
if (gDLL->getPythonIFace()->pythonAddGoodies() && !gDLL->getPythonIFace()->pythonUsingDefaultImpl())
{
return; // Python override
}
gDLL->NiTextOut("Adding Goodies...");
if (GC.getEraInfo(GC.getGameINLINE().getStartEra()).isNoGoodies())
{
return;
}
int iNumPlots = GC.getMapINLINE().numPlotsINLINE();
std::vector<int> aiShuffle(iNumPlots);
GC.getGameINLINE().getMapRand().shuffleSequence(aiShuffle, "addNonUniqueBonusType shuffle");
for (int iI = 0; iI < GC.getNumImprovementInfos(); iI++)
{
if (GC.getImprovementInfo((ImprovementTypes)iI).isGoody() && GC.getImprovementInfo((ImprovementTypes)iI).getTilesPerGoody() > 0)
{
for (int iJ = 0; iJ < iNumPlots; iJ++)
{
gDLL->callUpdater();
CvPlot *pPlot = GC.getMapINLINE().plotByIndexINLINE(aiShuffle[iJ]);
FAssertMsg(pPlot, "pPlot is expected not to be NULL");
if (!(pPlot->isWater()))
{
CvArea *pArea = GC.getMapINLINE().getArea(pPlot->getArea());
FAssertMsg(pArea, "pArea is expected not to be NULL");
if (pArea->getNumImprovements((ImprovementTypes)iI) < ((pArea->getNumTiles() + (GC.getImprovementInfo((ImprovementTypes)iI).getTilesPerGoody() / 2)) / GC.getImprovementInfo((ImprovementTypes) iI).getTilesPerGoody()))
{
if (canPlaceGoodyAt(((ImprovementTypes)iI), pPlot->getX_INLINE(), pPlot->getY_INLINE()))
{
pPlot->setImprovementType((ImprovementTypes)iI);
}
}
}
}
}
}
}