CvBuilderTaskingAI::GetBuildCostWeight(int, CvPlot *, BuildTypes)
- Defined in
- CvBuilderTaskingAI.cpp, line 1922
- Class
- CvBuilderTaskingAI
- Hook name
CivHooks::CvBuilderTaskingAI_GetBuildCostWeight
Hooks
static bool BeforeCvBuilderTaskingAI_GetBuildCostWeight(CvBuilderTaskingAI* self, int iWeight, CvPlot* pPlot, BuildTypes eBuild, int& result);static void AfterCvBuilderTaskingAI_GetBuildCostWeight(CvBuilderTaskingAI* self, int iWeight, CvPlot* pPlot, BuildTypes eBuild, int& result);static int ReplaceCvBuilderTaskingAI_GetBuildCostWeight(int (*original)(CvBuilderTaskingAI*, int, CvPlot*, BuildTypes), CvBuilderTaskingAI* self, int iWeight, CvPlot* pPlot, BuildTypes eBuild);CivRegisterBefore<CivHooks::CvBuilderTaskingAI_GetBuildCostWeight>(host, &BeforeCvBuilderTaskingAI_GetBuildCostWeight);CivRegisterAfter<CivHooks::CvBuilderTaskingAI_GetBuildCostWeight>(host, &AfterCvBuilderTaskingAI_GetBuildCostWeight);CivRegisterReplace<CivHooks::CvBuilderTaskingAI_GetBuildCostWeight>(host, &ReplaceCvBuilderTaskingAI_GetBuildCostWeight);
Code
1921/// Get the weight determined by the cost of building the item1922int CvBuilderTaskingAI::GetBuildCostWeight(int iWeight, CvPlot* pPlot, BuildTypes eBuild)1923{1924 int iBuildCost = m_pPlayer->getBuildCost(pPlot, eBuild);1925 if(iBuildCost > 0)1926 {1927 iWeight = (iWeight * 100) / iBuildCost;1928 }1929 else1930 {1931 //if (m_bLogging)1932 //{1933 // LogInfo("Build cost is zero", m_pPlayer);1934 //}1935 iWeight = (iWeight * 100);1936 }1937 return iWeight;1938}
Calls
Called by
- CvBuilderTaskingAI::AddChopDirectives(CvUnit *, CvPlot *, int)
- CvBuilderTaskingAI::AddImprovingPlotsDirectives(CvUnit *, CvPlot *, int)
- CvBuilderTaskingAI::AddImprovingResourcesDirectives(CvUnit *, CvPlot *, int)
- CvBuilderTaskingAI::AddRouteDirectives(CvUnit *, CvPlot *, int)
- CvBuilderTaskingAI::AddScrubFalloutDirectives(CvUnit *, CvPlot *, int)