Bazaar developer reference

CvUnit::DoEnhanceReligion()

Defined in
CvUnit.cpp, line 8425
Class
CvUnit
Hook name
CivHooks::CvUnit_DoEnhanceReligion

Hooks

static bool BeforeCvUnit_DoEnhanceReligion(CvUnit* self, bool& result);static void AfterCvUnit_DoEnhanceReligion(CvUnit* self, bool& result);static bool ReplaceCvUnit_DoEnhanceReligion(bool (*original)(CvUnit*), CvUnit* self);CivRegisterBefore<CivHooks::CvUnit_DoEnhanceReligion>(host, &BeforeCvUnit_DoEnhanceReligion);CivRegisterAfter<CivHooks::CvUnit_DoEnhanceReligion>(host, &AfterCvUnit_DoEnhanceReligion);CivRegisterReplace<CivHooks::CvUnit_DoEnhanceReligion>(host, &ReplaceCvUnit_DoEnhanceReligion);

Code

8425bool CvUnit::DoEnhanceReligion()8426{8427	CvGameReligions* pReligions = GC.getGame().GetGameReligions();84288429	CvPlot* pkPlot = plot();8430	CvCity* pkCity = (NULL != pkPlot)? pkPlot->getPlotCity() : NULL;84318432	if(pkPlot != NULL && pkCity != NULL)8433	{8434		if(CanEnhanceReligion(pkPlot))8435		{8436			CvPlayerAI& kOwner = GET_PLAYER(getOwner());8437			if(kOwner.isHuman())8438			{8439				CvAssertMsg(pkCity != NULL, "No City??");84408441				CvNotifications* pNotifications = kOwner.GetNotifications();8442				if(pNotifications)8443				{8444					CvString strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_ENHANCE_RELIGION");8445					CvString strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_ENHANCE_RELIGION");8446					pNotifications->Add(NOTIFICATION_ENHANCE_RELIGION, strBuffer, strSummary, pkPlot->getX(), pkPlot->getY(), -1, pkCity->GetID());8447				}8448#if defined(MOD_EVENTS_GREAT_PEOPLE)8449				kOwner.DoGreatPersonExpended(getUnitType(), this);8450#else8451				kOwner.DoGreatPersonExpended(getUnitType());8452#endif8453				kill(true);8454			}8455			else8456			{8457				ReligionTypes eReligion = pReligions->GetReligionCreatedByPlayer(getOwner());8458				if(eReligion != NO_RELIGION)8459				{8460					// Pick a belief for this religion8461#if defined(MOD_EVENTS_ACQUIRE_BELIEFS)8462					BeliefTypes eBelief1 = kOwner.GetReligionAI()->ChooseFollowerBelief(kOwner.GetID(), eReligion);  // temporary8463					BeliefTypes eBelief2 = kOwner.GetReligionAI()->ChooseEnhancerBelief(kOwner.GetID(), eReligion);  // temporary8464#else8465					BeliefTypes eBelief1 = kOwner.GetReligionAI()->ChooseFollowerBelief();  // temporary8466					BeliefTypes eBelief2 = kOwner.GetReligionAI()->ChooseEnhancerBelief();  // temporary8467#endif84688469					pReligions->EnhanceReligion(getOwner(), eReligion, eBelief1, eBelief2);84708471#if defined(MOD_EVENTS_GREAT_PEOPLE)8472					kOwner.DoGreatPersonExpended(getUnitType(), this);8473#else8474					kOwner.DoGreatPersonExpended(getUnitType());8475#endif8476					kill(true);8477				}8478				else8479				{8480					CvAssertMsg(false, "No religions available to found.");8481				}8482			}8483		}8484	}84858486	return false;8487}

Calls

Called by