CvReligionAI::HaveNearbyConversionTarget(ReligionTypes, bool) const
- Defined in
- CvReligionClasses.cpp, line 6894
- Class
- CvReligionAI
- Hook name
CivHooks::CvReligionAI_HaveNearbyConversionTarget
Hooks
static bool BeforeCvReligionAI_HaveNearbyConversionTarget(const CvReligionAI* self, ReligionTypes eReligion, bool bCanIncludeReligionStarter, bool& result);static void AfterCvReligionAI_HaveNearbyConversionTarget(const CvReligionAI* self, ReligionTypes eReligion, bool bCanIncludeReligionStarter, bool& result);static bool ReplaceCvReligionAI_HaveNearbyConversionTarget(bool (*original)(const CvReligionAI*, ReligionTypes, bool), const CvReligionAI* self, ReligionTypes eReligion, bool bCanIncludeReligionStarter);CivRegisterBefore<CivHooks::CvReligionAI_HaveNearbyConversionTarget>(host, &BeforeCvReligionAI_HaveNearbyConversionTarget);CivRegisterAfter<CivHooks::CvReligionAI_HaveNearbyConversionTarget>(host, &AfterCvReligionAI_HaveNearbyConversionTarget);CivRegisterReplace<CivHooks::CvReligionAI_HaveNearbyConversionTarget>(host, &ReplaceCvReligionAI_HaveNearbyConversionTarget);
Code
6893// Is there a civ nearby that isn't pressing religion?6894bool CvReligionAI::HaveNearbyConversionTarget(ReligionTypes eReligion, bool bCanIncludeReligionStarter) const6895{6896 int iLoop;6897 bool bStartedOwnReligion;6898 TeamTypes eTeam = m_pPlayer->getTeam();6899#if defined(MOD_BUGFIX_UNITCLASS_NOT_UNIT)6900 UnitTypes eMissionary = m_pPlayer->GetSpecificUnitType("UNITCLASS_MISSIONARY");6901#else6902 UnitTypes eMissionary = (UnitTypes)GC.getInfoTypeForString("UNIT_MISSIONARY");6903#endif6904 int iMissionaryMoves = GC.getUnitInfo(eMissionary)->GetMoves();69056906 CvCity* pCapital = m_pPlayer->getCapitalCity();6907 if(pCapital == NULL)6908 {6909 return false;6910 }69116912 for(int iPlayer = 0; iPlayer < MAX_PLAYERS; iPlayer++)6913 {6914 PlayerTypes ePlayer = (PlayerTypes)iPlayer;69156916 // Must be someone else6917 if(ePlayer == m_pPlayer->GetID())6918 {6919 continue;69206921 }6922 CvPlayer& kPlayer = GET_PLAYER(ePlayer);6923 if(kPlayer.isAlive())6924 {6925 if(kPlayer.isMinorCiv())6926 {6927 bStartedOwnReligion = false;6928 }6929 else6930 {6931 if (!kPlayer.isBarbarian())6932 {6933 if (m_pPlayer->GetDiplomacyAI()->IsPlayerAgreeNotToConvert(ePlayer))6934 {6935 continue;6936 }6937 }69386939 if(kPlayer.GetReligionAI()->GetReligionToSpread() > RELIGION_PANTHEON)6940 {6941 bStartedOwnReligion = true;6942 }6943 else6944 {6945 bStartedOwnReligion = false;6946 }6947 }69486949 if(!bStartedOwnReligion || bCanIncludeReligionStarter)6950 {6951 for(CvCity* pCity = kPlayer.firstCity(&iLoop); pCity != NULL; pCity = kPlayer.nextCity(&iLoop))6952 {6953 // Revealed and not currently our religion6954 if(pCity->isRevealed(eTeam, false) && pCity->GetCityReligions()->GetReligiousMajority() != eReligion)6955 {6956 // Within 10 times Missionary movement allowance of our6957 if(plotDistance(pCapital->getX(), pCapital->getY(), pCity->getX(), pCity->getY()) <= (iMissionaryMoves * GC.getRELIGION_MISSIONARY_RANGE_IN_TURNS()))6958 {6959 return true;6960 }6961 }6962 }6963 }6964 }6965 }6966 return false;6967}
Calls
- CvCity::GetCityReligions() const
- CvCity::getX() const
- CvCity::getY() const
- CvCity::isRevealed(TeamTypes, bool) const
- CvCityReligions::GetReligiousMajority()
- CvDiplomacyAI::IsPlayerAgreeNotToConvert(PlayerTypes)
- CvGlobals::getRELIGION_MISSIONARY_RANGE_IN_TURNS()
- CvGlobals::getUnitInfo(UnitTypes)
- CvPlayer::firstCity(int *, bool)
- CvPlayer::getCapitalCity()
- CvPlayer::GetDiplomacyAI() const
- CvPlayer::GetID() const
- CvPlayer::GetReligionAI() const
- CvPlayer::GetSpecificUnitType(const char *, bool)
- CvPlayer::getTeam() const
- CvPlayer::isAlive() const
- CvPlayer::isBarbarian() const
- CvPlayer::isMinorCiv() const
- CvPlayer::nextCity(int *, bool)
- CvPlayerAI::getPlayer(PlayerTypes)
- CvReligionAI::GetReligionToSpread() const
- CvUnitEntry::GetMoves() const
- plotDistance(int, int, int, int)