CvUnit::CanSpreadReligion(const CvPlot *) const
- Defined in
- CvUnit.cpp, line 8490
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_CanSpreadReligion- Lua events
GameEvents.PlayerCanSpreadReligion
Hooks
static bool BeforeCvUnit_CanSpreadReligion(const CvUnit* self, const CvPlot* pPlot, bool& result);static void AfterCvUnit_CanSpreadReligion(const CvUnit* self, const CvPlot* pPlot, bool& result);static bool ReplaceCvUnit_CanSpreadReligion(bool (*original)(const CvUnit*, const CvPlot*), const CvUnit* self, const CvPlot* pPlot);CivRegisterBefore<CivHooks::CvUnit_CanSpreadReligion>(host, &BeforeCvUnit_CanSpreadReligion);CivRegisterAfter<CivHooks::CvUnit_CanSpreadReligion>(host, &AfterCvUnit_CanSpreadReligion);CivRegisterReplace<CivHooks::CvUnit_CanSpreadReligion>(host, &ReplaceCvUnit_CanSpreadReligion);
Code
8490bool CvUnit::CanSpreadReligion(const CvPlot* pPlot) const8491{8492 VALIDATE_OBJECT8493 CvCity* pCity;84948495 if(!m_pUnitInfo->IsSpreadReligion())8496 {8497 return false;8498 }84998500 if(GetReligionData()->GetReligion() == NO_RELIGION)8501 {8502 return false;8503 }85048505 pCity = pPlot->getPlotCity();8506 if(pCity == NULL)8507 {8508 pCity = pPlot->GetAdjacentCity();8509 if(pCity == NULL)8510 {8511 return false;8512 }8513 }85148515 // Blocked by Inquisitor?8516 if(pCity->GetCityReligions()->IsDefendedAgainstSpread(GetReligionData()->GetReligion()))8517 {8518 return false;8519 }85208521 if(isDelayedDeath())8522 {8523 return false;8524 }8525 8526#if defined(MOD_EVENTS_RELIGION)8527 if (MOD_EVENTS_RELIGION) {8528 if (GAMEEVENTINVOKE_TESTALL(GAMEEVENT_PlayerCanSpreadReligion, getOwner(), GetID(), plot()->getX(), plot()->getY()) == GAMEEVENTRETURN_FALSE) {8529 return false;8530 }8531 }8532#endif85338534 return true;8535}
Calls
- CustomMods::eventTestAll(const char *, const char *, ...)
- CustomMods::isEVENTS_RELIGION()
- CvCity::GetCityReligions() const
- CvCityReligions::IsDefendedAgainstSpread(ReligionTypes)
- CvPlot::GetAdjacentCity(bool) const
- CvPlot::getPlotCity() const
- CvPlot::getX() const
- CvPlot::getY() const
- CvUnit::GetID() const
- CvUnit::getOwner() const
- CvUnit::GetReligionData() const
- CvUnit::isDelayedDeath() const
- CvUnit::plot() const
- CvUnitEntry::IsSpreadReligion() const
- CvUnitReligion::GetReligion() const