Hooks
static bool BeforeCvBuilderTaskingAI_AddScrubFalloutDirectives(CvBuilderTaskingAI* self, CvUnit* pUnit, CvPlot* pPlot, int iMoveTurnsAway);static void AfterCvBuilderTaskingAI_AddScrubFalloutDirectives(CvBuilderTaskingAI* self, CvUnit* pUnit, CvPlot* pPlot, int iMoveTurnsAway);static void ReplaceCvBuilderTaskingAI_AddScrubFalloutDirectives(void (*original)(CvBuilderTaskingAI*, CvUnit*, CvPlot*, int), CvBuilderTaskingAI* self, CvUnit* pUnit, CvPlot* pPlot, int iMoveTurnsAway);CivRegisterBefore<CivHooks::CvBuilderTaskingAI_AddScrubFalloutDirectives>(host, &BeforeCvBuilderTaskingAI_AddScrubFalloutDirectives);CivRegisterAfter<CivHooks::CvBuilderTaskingAI_AddScrubFalloutDirectives>(host, &AfterCvBuilderTaskingAI_AddScrubFalloutDirectives);CivRegisterReplace<CivHooks::CvBuilderTaskingAI_AddScrubFalloutDirectives>(host, &ReplaceCvBuilderTaskingAI_AddScrubFalloutDirectives);
Code
1693// Everything means less than zero, hey1694void CvBuilderTaskingAI::AddScrubFalloutDirectives(CvUnit* pUnit, CvPlot* pPlot, int iMoveTurnsAway)1695{1696 if(m_eFalloutFeature == NO_FEATURE || m_eFalloutRemove == NO_BUILD)1697 {1698 return;1699 }17001701 CvCity* pCity = GetWorkingCity(pPlot);1702 if(!pCity)1703 {1704 return;1705 }17061707 if(pPlot->getFeatureType() == m_eFalloutFeature && pUnit->canBuild(pPlot, m_eFalloutRemove))1708 {1709 int iWeight = GC.getBUILDER_TASKING_BASELINE_SCRUB_FALLOUT();1710 //int iTurnsAway = FindTurnsAway(pUnit, pPlot);1711 iWeight = iWeight / (iMoveTurnsAway/*iTurnsAway*/ + 1);1712 iWeight = GetBuildCostWeight(iWeight, pPlot, m_eFalloutRemove);1713 int iBuildTimeWeight = GetBuildTimeWeight(pUnit, pPlot, m_eFalloutRemove, false, iMoveTurnsAway);1714 iWeight += iBuildTimeWeight;17151716 BuilderDirective directive;1717 directive.m_eDirective = BuilderDirective::CHOP;1718 directive.m_eBuild = m_eFalloutRemove;1719 directive.m_eResource = NO_RESOURCE;1720 directive.m_sX = pPlot->getX();1721 directive.m_sY = pPlot->getY();1722 directive.m_sMoveTurnsAway = iMoveTurnsAway;1723 m_aDirectives.push_back(directive, iWeight);1724 }1725}