CvTechAI::WeightPrereqs(int *, int)
- Defined in
- CvTechAI.cpp, line 310
- Class
- CvTechAI
- Hook name
CivHooks::CvTechAI_WeightPrereqs
Hooks
static bool BeforeCvTechAI_WeightPrereqs(CvTechAI* self, int* paiTempWeights, int iPropagationPercent);static void AfterCvTechAI_WeightPrereqs(CvTechAI* self, int* paiTempWeights, int iPropagationPercent);static void ReplaceCvTechAI_WeightPrereqs(void (*original)(CvTechAI*, int*, int), CvTechAI* self, int* paiTempWeights, int iPropagationPercent);CivRegisterBefore<CivHooks::CvTechAI_WeightPrereqs>(host, &BeforeCvTechAI_WeightPrereqs);CivRegisterAfter<CivHooks::CvTechAI_WeightPrereqs>(host, &AfterCvTechAI_WeightPrereqs);CivRegisterReplace<CivHooks::CvTechAI_WeightPrereqs>(host, &ReplaceCvTechAI_WeightPrereqs);
Code
309/// Add weights to techs that are prereqs for the ones already weighted in this strategy310void CvTechAI::WeightPrereqs(int* paiTempWeights, int iPropagationPercent)311{312 int iTechLoop;313314 // Loop through techs looking for ones that are just getting some new weight315 for(iTechLoop = 0; iTechLoop < m_pCurrentTechs->GetTechs()->GetNumTechs(); iTechLoop++)316 {317 // If found one, call our recursive routine to weight everything to the left in the tree318 if(paiTempWeights[iTechLoop] > 0)319 {320 PropagateWeights(iTechLoop, paiTempWeights[iTechLoop], iPropagationPercent, 0);321 }322 }323}