本文整理汇总了C++中CvPlot::getCoords方法的典型用法代码示例。如果您正苦于以下问题:C++ CvPlot::getCoords方法的具体用法?C++ CvPlot::getCoords怎么用?C++ CvPlot::getCoords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvPlot
的用法示例。
在下文中一共展示了CvPlot::getCoords方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logMap
// todo - get area counting code out of here; separate to logging
void Game::logMap(const CvMap& map) const
{
#ifdef ALTAI_DEBUG
std::ostream& os = CivLog::getLog(CvPlayerAI::getPlayer((PlayerTypes)0))->getStream();
#endif
std::map<int, std::pair<int, int> > irrigatableAreaCounts;
// TODO check that at least one plot in the area has fresh water if it is irrigatable
for (int plotIndex = 0, plotCount = map.numPlots(); plotIndex < plotCount; ++plotIndex)
{
CvPlot* pPlot = map.plotByIndex(plotIndex);
int irrigatableAreaID = pPlot->getIrrigatableArea();
if (irrigatableAreaID != FFreeList::INVALID_INDEX)
{
int subAreaID = pPlot->getSubArea();
std::map<int, std::pair<int, int> >::iterator iter = irrigatableAreaCounts.find(irrigatableAreaID);
if (iter == irrigatableAreaCounts.end())
{
irrigatableAreaCounts.insert(std::make_pair(irrigatableAreaID, std::make_pair(subAreaID, 1)));
}
else
{
FAssertMsg(iter->second.first == subAreaID, "Irrigatable Area has inconsistent SubArea IDs");
++iter->second.second;
}
}
}
#ifdef ALTAI_DEBUG
os << "\n";
#endif
for (std::map<int, std::pair<int, int> >::const_iterator ci(irrigatableAreaCounts.begin()), ciEnd(irrigatableAreaCounts.end()); ci != ciEnd; ++ci)
{
boost::shared_ptr<AltAI::IrrigatableArea> pIrrigatableArea = map.getIrrigatableArea(ci->first);
pIrrigatableArea->setNumTiles(ci->second.second);
#ifdef ALTAI_DEBUG
{
os << "\nIrrigatable Area: " << ci->first << " irrigatable = " << pIrrigatableArea->isIrrigatable()
<< " wet = " << pIrrigatableArea->hasFreshWaterAccess()
<< " (Sub Area ID = " << pIrrigatableArea->getSubAreaID() << ") has: "
<< ci->second.second << " plots (out of " << map.getSubArea(ci->second.first)->getNumTiles() << ")\n";
}
#endif
if (pIrrigatableArea->isIrrigatable() && !pIrrigatableArea->hasFreshWaterAccess())
{
#ifdef ALTAI_DEBUG
os << "\n";
for (int plotIndex = 0, plotCount = map.numPlots(); plotIndex < plotCount; ++plotIndex)
{
CvPlot* pPlot = map.plotByIndex(plotIndex);
int irrigatableAreaID = pPlot->getIrrigatableArea();
if (irrigatableAreaID == ci->first)
{
os << pPlot->getCoords() << ", ";
}
}
os << "\n";
#endif
}
}
#ifdef ALTAI_DEBUG
os << "\n";
#endif
}