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


C++ CvPolicyEntry::GetPolicyBranchType方法代码示例

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


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

示例1: WeighBranch

/// Priority for opening up this branch
int CvPolicyAI::WeighBranch(PolicyBranchTypes eBranch)
{
    int iWeight = 0;

    CvPolicyBranchEntry* pkPolicyBranchInfo = GC.getPolicyBranchInfo(eBranch);
    if(pkPolicyBranchInfo)
    {
        for(int iPolicyLoop = 0; iPolicyLoop < m_pCurrentPolicies->GetPolicies()->GetNumPolicies(); iPolicyLoop++)
        {
            const PolicyTypes ePolicyLoop = static_cast<PolicyTypes>(iPolicyLoop);
            CvPolicyEntry* pkLoopPolicyInfo = GC.getPolicyInfo(ePolicyLoop);
            if(pkLoopPolicyInfo)
            {
                // Policy we don't have?
                if(!m_pCurrentPolicies->HasPolicy(ePolicyLoop))
                {
                    // From this branch we are considering opening?
                    if(pkLoopPolicyInfo->GetPolicyBranchType() == eBranch)
                    {
                        // With no prereqs?
                        if(pkLoopPolicyInfo->GetPrereqAndPolicies(0) == NO_POLICY)
                        {
                            iWeight += m_PolicyAIWeights.GetWeight(iPolicyLoop);
                        }
                    }
                }
            }
        }

        // Add weight of free policy from branch
        iWeight += m_PolicyAIWeights.GetWeight(pkPolicyBranchInfo->GetFreePolicy());
    }

    return iWeight;
}
开发者ID:Yonyonnisan,项目名称:Civ5-UAM-Mod,代码行数:36,代码来源:CvPolicyAI.cpp

示例2: GetBranchBuildingHappiness

/// What's the total Happiness benefit we could get from all policies/tenets in the branch based on our current buildings?
int CvPolicyAI::GetBranchBuildingHappiness(CvPlayer* pPlayer, PolicyBranchTypes eBranch)
{
    // Policy Building Mods
    int iSpecialPolicyBuildingHappiness = 0;
    int iBuildingClassLoop;
    BuildingClassTypes eBuildingClass;
    for(int iPolicyLoop = 0; iPolicyLoop < GC.getNumPolicyInfos(); iPolicyLoop++)
    {
        PolicyTypes ePolicy = (PolicyTypes)iPolicyLoop;
        CvPolicyEntry* pkPolicyInfo = GC.getPolicyInfo(ePolicy);
        if(pkPolicyInfo)
        {
            if (pkPolicyInfo->GetPolicyBranchType() == eBranch)
            {
                for(iBuildingClassLoop = 0; iBuildingClassLoop < GC.getNumBuildingClassInfos(); iBuildingClassLoop++)
                {
                    eBuildingClass = (BuildingClassTypes) iBuildingClassLoop;

                    CvBuildingClassInfo* pkBuildingClassInfo = GC.getBuildingClassInfo(eBuildingClass);
                    if (!pkBuildingClassInfo)
                    {
                        continue;
                    }

                    if (pkPolicyInfo->GetBuildingClassHappiness(eBuildingClass) != 0)
                    {
                        BuildingTypes eBuilding = (BuildingTypes)pPlayer->getCivilizationInfo().getCivilizationBuildings(eBuildingClass);
                        if (eBuilding != NO_BUILDING)
                        {
                            CvCity *pCity;
                            int iLoop;
                            for (pCity = pPlayer->firstCity(&iLoop); pCity != NULL; pCity = pPlayer->nextCity(&iLoop))
                            {
                                if (pCity->GetCityBuildings()->GetNumBuilding(eBuilding) > 0)
                                {
                                    iSpecialPolicyBuildingHappiness += pkPolicyInfo->GetBuildingClassHappiness(eBuildingClass);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return iSpecialPolicyBuildingHappiness;
}
开发者ID:Yonyonnisan,项目名称:Civ5-UAM-Mod,代码行数:47,代码来源:CvPolicyAI.cpp

示例3: GetNumHappinessPolicies

/// How many policies in this branch help happiness?
int CvPolicyAI::GetNumHappinessPolicies(CvPlayer* pPlayer, PolicyBranchTypes eBranch)
{
    int iRtnValue = 0;
    int iBuildingClassLoop;
    BuildingClassTypes eBuildingClass;
    for(int iPolicyLoop = 0; iPolicyLoop < GC.getNumPolicyInfos(); iPolicyLoop++)
    {
        PolicyTypes ePolicy = (PolicyTypes)iPolicyLoop;
        CvPolicyEntry* pkPolicyInfo = GC.getPolicyInfo(ePolicy);
        if(pkPolicyInfo)
        {
            if (pkPolicyInfo->GetPolicyBranchType() == eBranch)
            {
                for(iBuildingClassLoop = 0; iBuildingClassLoop < GC.getNumBuildingClassInfos(); iBuildingClassLoop++)
                {
                    eBuildingClass = (BuildingClassTypes) iBuildingClassLoop;

                    CvBuildingClassInfo* pkBuildingClassInfo = GC.getBuildingClassInfo(eBuildingClass);
                    if (!pkBuildingClassInfo)
                    {
                        continue;
                    }

                    BuildingTypes eBuilding = (BuildingTypes)pPlayer->getCivilizationInfo().getCivilizationBuildings(eBuildingClass);
                    if (eBuilding != NO_BUILDING)
                    {
                        // Don't count a building that can only be built in conquered cities
                        CvBuildingEntry *pkEntry = GC.getBuildingInfo(eBuilding);
                        if (!pkEntry || pkEntry->IsNoOccupiedUnhappiness())
                        {
                            continue;
                        }

                        if (pkPolicyInfo->GetBuildingClassHappiness(eBuildingClass) != 0)
                        {
                            iRtnValue++;
                            break;
                        }
                    }
                }
            }
        }
    }
    return iRtnValue;
}
开发者ID:Yonyonnisan,项目名称:Civ5-UAM-Mod,代码行数:46,代码来源:CvPolicyAI.cpp


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