当前位置: 首页>>代码示例>>C++>>正文


C++ CvPlot::getCoords方法代码示例

本文整理汇总了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
    }
开发者ID:Carboniferous,项目名称:AltAI,代码行数:64,代码来源:game.cpp


注:本文中的CvPlot::getCoords方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。