CvWonderProductionAI::AddFlavorWeights(FlavorTypes, int)
- Defined in
- CvWonderProductionAI.cpp, line 175
- Class
- CvWonderProductionAI
- Hook name
CivHooks::CvWonderProductionAI_AddFlavorWeights
Hooks
static bool BeforeCvWonderProductionAI_AddFlavorWeights(CvWonderProductionAI* self, FlavorTypes eFlavor, int iWeight);static void AfterCvWonderProductionAI_AddFlavorWeights(CvWonderProductionAI* self, FlavorTypes eFlavor, int iWeight);static void ReplaceCvWonderProductionAI_AddFlavorWeights(void (*original)(CvWonderProductionAI*, FlavorTypes, int), CvWonderProductionAI* self, FlavorTypes eFlavor, int iWeight);CivRegisterBefore<CivHooks::CvWonderProductionAI_AddFlavorWeights>(host, &BeforeCvWonderProductionAI_AddFlavorWeights);CivRegisterAfter<CivHooks::CvWonderProductionAI_AddFlavorWeights>(host, &AfterCvWonderProductionAI_AddFlavorWeights);CivRegisterReplace<CivHooks::CvWonderProductionAI_AddFlavorWeights>(host, &ReplaceCvWonderProductionAI_AddFlavorWeights);
Code
174/// Establish weights for one flavor; can be called multiple times to layer strategies175void CvWonderProductionAI::AddFlavorWeights(FlavorTypes eFlavor, int iWeight)176{177 // Loop through all buildings (even though we're only go to do anything on wonders)178 for(int iBldg = 0; iBldg < m_pBuildings->GetNumBuildings(); iBldg++)179 {180 CvBuildingEntry* entry = m_pBuildings->GetEntry(iBldg);181 if(entry)182 {183 CvBuildingEntry& kBuilding = *entry;184 if(IsWonder(kBuilding))185 {186 // Set its weight by looking at wonder's weight for this flavor and using iWeight multiplier passed in187 m_WonderAIWeights.IncreaseWeight(iBldg, kBuilding.GetFlavorValue(eFlavor) * iWeight);188 }189 }190 }191}