CvPolicyAI::WeightPrereqs(int *, int)
- Defined in
- CvPolicyAI.cpp, line 778
- Class
- CvPolicyAI
- Hook name
CivHooks::CvPolicyAI_WeightPrereqs
Hooks
static bool BeforeCvPolicyAI_WeightPrereqs(CvPolicyAI* self, int* paiTempWeights, int iPropagationPercent);static void AfterCvPolicyAI_WeightPrereqs(CvPolicyAI* self, int* paiTempWeights, int iPropagationPercent);static void ReplaceCvPolicyAI_WeightPrereqs(void (*original)(CvPolicyAI*, int*, int), CvPolicyAI* self, int* paiTempWeights, int iPropagationPercent);CivRegisterBefore<CivHooks::CvPolicyAI_WeightPrereqs>(host, &BeforeCvPolicyAI_WeightPrereqs);CivRegisterAfter<CivHooks::CvPolicyAI_WeightPrereqs>(host, &AfterCvPolicyAI_WeightPrereqs);CivRegisterReplace<CivHooks::CvPolicyAI_WeightPrereqs>(host, &ReplaceCvPolicyAI_WeightPrereqs);
Code
777/// Add weights to policies that are prereqs for the ones already weighted in this strategy778void CvPolicyAI::WeightPrereqs(int* paiTempWeights, int iPropagationPercent)779{780 int iPolicyLoop;781782 // Loop through policies looking for ones that are just getting some new weight783 for(iPolicyLoop = 0; iPolicyLoop < m_pCurrentPolicies->GetPolicies()->GetNumPolicies(); iPolicyLoop++)784 {785 // If found one, call our recursive routine to weight everything to the left in the tree786 if(paiTempWeights[iPolicyLoop] > 0)787 {788 PropagateWeights(iPolicyLoop, paiTempWeights[iPolicyLoop], iPropagationPercent, 0);789 }790 }791}