Hooks
static bool BeforeCvReligionAI_ChooseInquisitorTargetCity(CvReligionAI* self, UnitHandle pUnit, CvCity*& result);static void AfterCvReligionAI_ChooseInquisitorTargetCity(CvReligionAI* self, UnitHandle pUnit, CvCity*& result);static CvCity* ReplaceCvReligionAI_ChooseInquisitorTargetCity(CvCity* (*original)(CvReligionAI*, UnitHandle), CvReligionAI* self, UnitHandle pUnit);CivRegisterBefore<CivHooks::CvReligionAI_ChooseInquisitorTargetCity>(host, &BeforeCvReligionAI_ChooseInquisitorTargetCity);CivRegisterAfter<CivHooks::CvReligionAI_ChooseInquisitorTargetCity>(host, &AfterCvReligionAI_ChooseInquisitorTargetCity);CivRegisterReplace<CivHooks::CvReligionAI_ChooseInquisitorTargetCity>(host, &ReplaceCvReligionAI_ChooseInquisitorTargetCity);
Code
5455/// Find the city where an inquisitor should next remove heresy5456CvCity* CvReligionAI::ChooseInquisitorTargetCity(UnitHandle pUnit)5457{5458 ReligionTypes eMyReligion = GetReligionToSpread();5459 int iBestScore = 0;5460 CvCity* pBestCity = NULL;54615462 if(eMyReligion <= RELIGION_PANTHEON)5463 {5464 return NULL;5465 }54665467#pragma warning ( push )5468#pragma warning ( disable : 6011 ) // Dereferencing NULL pointer5469 AI_PERF_FORMAT("AI-perf-tact.csv", ("ChooseInquisitorTargetCity: %s %d, Turn %03d, %s", pUnit->getName().c_str(), pUnit->GetID(), GC.getGame().getElapsedGameTurns(), m_pPlayer->getCivilizationShortDescription()) );5470#pragma warning ( pop )54715472 // Loop through each of my cities5473 int iLoop;5474 CvCity* pLoopCity;5475 for(pLoopCity = m_pPlayer->firstCity(&iLoop); pLoopCity != NULL; pLoopCity = m_pPlayer->nextCity(&iLoop))5476 {5477 if(pLoopCity)5478 {5479 int iScore = ScoreCityForInquisitor(pLoopCity, pUnit);5480 if(iScore > iBestScore)5481 {5482 iBestScore = iScore;5483 pBestCity = pLoopCity;5484 }5485 }5486 }54875488 return pBestCity;5489}