本文整理汇总了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;
}
示例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;
}
示例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;
}