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


C++ CvCity::getNumActiveBuilding方法代码示例

本文整理汇总了C++中CvCity::getNumActiveBuilding方法的典型用法代码示例。如果您正苦于以下问题:C++ CvCity::getNumActiveBuilding方法的具体用法?C++ CvCity::getNumActiveBuilding怎么用?C++ CvCity::getNumActiveBuilding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CvCity的用法示例。


在下文中一共展示了CvCity::getNumActiveBuilding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: hasGOM

bool CvGameObjectPlot::hasGOM(GOMTypes eType, int iID)
{
    switch (eType)
    {
    case GOM_BUILDING:
    {
        // return true if the building is present in the city on this plot and active
        BuildingTypes eBuilding = (BuildingTypes) iID;
        CvCity* pCity = m_pPlot->getPlotCity();
        if (pCity)
        {
            return pCity->getNumActiveBuilding(eBuilding) > 0;
        }
        else
        {
            return false;
        }
        break;
    }

    case GOM_PROMOTION:
    {
        // Defer to units on the plot, combine with OR
        bool bHasGOM = false;
        foreach(GAMEOBJECT_UNIT, boost::bind(aggregateHasGOM, _1, eType, iID, &bHasGOM));
        return bHasGOM;
        break;
    }

    case GOM_TRAIT:
    {
        // Return true if the owner has the trait
        TraitTypes eTrait = (TraitTypes) iID;
        PlayerTypes ePlayer = m_pPlot->getOwnerINLINE();
        if (ePlayer != NO_PLAYER)
        {
            return GET_PLAYER(ePlayer).hasTrait(eTrait);
        }
        else
        {
            return false;
        }
        break;
    }

    case GOM_FEATURE:
    {
        // Check feature type
        FeatureTypes eFeature = (FeatureTypes) iID;
#ifdef MULTI_FEATURE_MOD
        return m_pPlot->getHasFeature(eFeature);
#else
        return m_pPlot->getFeatureType() == eFeature;
#endif
        break;
    }

    case GOM_OPTION:
    {
        GameOptionTypes eOption = (GameOptionTypes) iID;
        return GC.getGameINLINE().isOption(eOption);
        break;
    }

    case GOM_TERRAIN:
    {
        // Check terrain type
        TerrainTypes eTerrain = (TerrainTypes) iID;
        return m_pPlot->getTerrainType() == eTerrain;
        break;
    }

    case GOM_GAMESPEED:
    {
        GameSpeedTypes eSpeed = (GameSpeedTypes) iID;
        return GC.getGameINLINE().getGameSpeedType() == eSpeed;
        break;
    }

    case GOM_ROUTE:
    {
        // Check route type
        RouteTypes eRoute = (RouteTypes) iID;
        return m_pPlot->getRouteType() == eRoute;
        break;
    }

    case GOM_BONUS:
    {
        // Check bonus type
        BonusTypes eBonus = (BonusTypes) iID;
        return m_pPlot->getBonusType() == eBonus;
        break;
    }

    case GOM_UNITTYPE:
    {
        // Defer to units on the plot, combine with OR
        bool bHasGOM = false;
        foreach(GAMEOBJECT_UNIT, boost::bind(aggregateHasGOM, _1, eType, iID, &bHasGOM));
//.........这里部分代码省略.........
开发者ID:gdambrauskas,项目名称:anewdawn1.74Hspinoff,代码行数:101,代码来源:CvGameObject.cpp


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