CvUnit::CanEnhanceReligion(const CvPlot *) const
- Defined in
- CvUnit.cpp, line 8353
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_CanEnhanceReligion
Hooks
static bool BeforeCvUnit_CanEnhanceReligion(const CvUnit* self, const CvPlot* pPlot, bool& result);static void AfterCvUnit_CanEnhanceReligion(const CvUnit* self, const CvPlot* pPlot, bool& result);static bool ReplaceCvUnit_CanEnhanceReligion(bool (*original)(const CvUnit*, const CvPlot*), const CvUnit* self, const CvPlot* pPlot);CivRegisterBefore<CivHooks::CvUnit_CanEnhanceReligion>(host, &BeforeCvUnit_CanEnhanceReligion);CivRegisterAfter<CivHooks::CvUnit_CanEnhanceReligion>(host, &AfterCvUnit_CanEnhanceReligion);CivRegisterReplace<CivHooks::CvUnit_CanEnhanceReligion>(host, &ReplaceCvUnit_CanEnhanceReligion);
Code
8353bool CvUnit::CanEnhanceReligion(const CvPlot* pPlot) const8354{8355 VALIDATE_OBJECT8356 CvCity* pCity;8357 CvGameReligions* pReligions = GC.getGame().GetGameReligions();83588359 pCity = pPlot->getPlotCity();83608361 if(!m_pUnitInfo->IsFoundReligion())8362 {8363 return false;8364 }83658366 // If prophet has started spreading religion, can't do other functions8367 if(m_pUnitInfo->IsSpreadReligion())8368 {8369 if(GetReligionData()->GetSpreadsLeft() < m_pUnitInfo->GetReligionSpreads())8370 {8371 return false;8372 }8373 }83748375 if(pCity == NULL)8376 {8377 return false;8378 }83798380 if(getTeam() != pCity->getTeam())8381 {8382 return false;8383 }83848385 if(GET_TEAM(getTeam()).isMinorCiv())8386 {8387 return false;8388 }83898390 if(isDelayedDeath())8391 {8392 return false;8393 }83948395 if(!pReligions->HasCreatedReligion(getOwner()))8396 {8397 return false;8398 }83998400 ReligionTypes eReligion = pReligions->GetReligionCreatedByPlayer(getOwner());8401 const CvReligion* pReligion = pReligions->GetReligion(eReligion, getOwner());8402 if(pReligion->m_bEnhanced)8403 {8404 return false;8405 }84068407 if(getX() != pReligion->m_iHolyCityX || getY() != pReligion->m_iHolyCityY)8408 {8409 return false;8410 }84118412#if defined(MOD_EVENTS_ACQUIRE_BELIEFS)8413 if (pReligions->GetAvailableEnhancerBeliefs(getOwner(), eReligion).size() < 1 || pReligions->GetAvailableFollowerBeliefs(getOwner(), eReligion).size() < 1)8414#else8415 if (pReligions->GetAvailableEnhancerBeliefs().size() < 1 || pReligions->GetAvailableFollowerBeliefs().size() < 1)8416#endif8417 {8418 return false;8419 }84208421 return true;8422}
Calls
- CvCity::getTeam() const
- CvGame::GetGameReligions()
- CvGameReligions::GetAvailableEnhancerBeliefs(PlayerTypes, ReligionTypes)
- CvGameReligions::GetAvailableFollowerBeliefs(PlayerTypes, ReligionTypes)
- CvGameReligions::GetReligion(ReligionTypes, PlayerTypes) const
- CvGameReligions::GetReligionCreatedByPlayer(PlayerTypes) const
- CvGameReligions::HasCreatedReligion(PlayerTypes, bool) const
- CvGlobals::getGame()
- CvPlot::getPlotCity() const
- CvTeam::getTeam(TeamTypes)
- CvTeam::isMinorCiv() const
- CvUnit::getOwner() const
- CvUnit::GetReligionData() const
- CvUnit::getTeam() const
- CvUnit::getX() const
- CvUnit::getY() const
- CvUnit::isDelayedDeath() const
- CvUnitEntry::GetReligionSpreads() const
- CvUnitEntry::IsFoundReligion() const
- CvUnitEntry::IsSpreadReligion() const
- CvUnitReligion::GetSpreadsLeft() const
std::vector::size