CvUnit::CanRemoveHeresy(const CvPlot *) const
- Defined in
- CvUnit.cpp, line 8775
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_CanRemoveHeresy- Lua events
GameEvents.PlayerCanRemoveHeresy
Hooks
static bool BeforeCvUnit_CanRemoveHeresy(const CvUnit* self, const CvPlot* pPlot, bool& result);static void AfterCvUnit_CanRemoveHeresy(const CvUnit* self, const CvPlot* pPlot, bool& result);static bool ReplaceCvUnit_CanRemoveHeresy(bool (*original)(const CvUnit*, const CvPlot*), const CvUnit* self, const CvPlot* pPlot);CivRegisterBefore<CivHooks::CvUnit_CanRemoveHeresy>(host, &BeforeCvUnit_CanRemoveHeresy);CivRegisterAfter<CivHooks::CvUnit_CanRemoveHeresy>(host, &AfterCvUnit_CanRemoveHeresy);CivRegisterReplace<CivHooks::CvUnit_CanRemoveHeresy>(host, &ReplaceCvUnit_CanRemoveHeresy);
Code
8775bool CvUnit::CanRemoveHeresy(const CvPlot* pPlot) const8776{8777 VALIDATE_OBJECT8778 CvCity* pCity;87798780 if(!m_pUnitInfo->IsRemoveHeresy())8781 {8782 return false;8783 }87848785 if(GetReligionData()->GetReligion() == NO_RELIGION)8786 {8787 return false;8788 }87898790 pCity = pPlot->getPlotCity();8791 if(pCity == NULL)8792 {8793 pCity = pPlot->GetAdjacentCity();8794 if(pCity == NULL)8795 {8796 return false;8797 }8798 else if(pCity->getOwner() != getOwner())8799 {8800 return false;8801 }8802 }88038804 if(!pCity->GetCityReligions()->IsReligionHereOtherThan(GetReligionData()->GetReligion()))8805 {8806 return false;8807 }88088809 if(isDelayedDeath())8810 {8811 return false;8812 }88138814#if defined(MOD_EVENTS_RELIGION)8815 if (MOD_EVENTS_RELIGION) {8816 if (GAMEEVENTINVOKE_TESTALL(GAMEEVENT_PlayerCanRemoveHeresy, getOwner(), GetID(), plot()->getX(), plot()->getY()) == GAMEEVENTRETURN_FALSE) {8817 return false;8818 }8819 }8820#endif88218822 return true;8823}
Calls
- CustomMods::eventTestAll(const char *, const char *, ...)
- CustomMods::isEVENTS_RELIGION()
- CvCity::GetCityReligions() const
- CvCity::getOwner() const
- CvCityReligions::IsReligionHereOtherThan(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::IsRemoveHeresy() const
- CvUnitReligion::GetReligion() const