CvCityReligions::IsDefendedAgainstSpread(ReligionTypes)
- Defined in
- CvReligionClasses.cpp, line 3521
- Class
- CvCityReligions
- Hook name
CivHooks::CvCityReligions_IsDefendedAgainstSpread
Hooks
static bool BeforeCvCityReligions_IsDefendedAgainstSpread(CvCityReligions* self, ReligionTypes eReligion, bool& result);static void AfterCvCityReligions_IsDefendedAgainstSpread(CvCityReligions* self, ReligionTypes eReligion, bool& result);static bool ReplaceCvCityReligions_IsDefendedAgainstSpread(bool (*original)(CvCityReligions*, ReligionTypes), CvCityReligions* self, ReligionTypes eReligion);CivRegisterBefore<CivHooks::CvCityReligions_IsDefendedAgainstSpread>(host, &BeforeCvCityReligions_IsDefendedAgainstSpread);CivRegisterAfter<CivHooks::CvCityReligions_IsDefendedAgainstSpread>(host, &AfterCvCityReligions_IsDefendedAgainstSpread);CivRegisterReplace<CivHooks::CvCityReligions_IsDefendedAgainstSpread>(host, &ReplaceCvCityReligions_IsDefendedAgainstSpread);
Code
3520/// Is there an inquisitor from another religion here?3521bool CvCityReligions::IsDefendedAgainstSpread(ReligionTypes eReligion)3522{3523 CvUnit* pLoopUnit;35243525 CvPlot* pCityPlot = m_pCity->plot();3526 if(pCityPlot)3527 {3528 for(int iUnitLoop = 0; iUnitLoop < pCityPlot->getNumUnits(); iUnitLoop++)3529 {3530 pLoopUnit = pCityPlot->getUnitByIndex(iUnitLoop);3531 CvUnitEntry* pkEntry = GC.getUnitInfo(pLoopUnit->getUnitType());3532 if(pkEntry && pkEntry->IsProhibitsSpread())3533 {3534#if defined(MOD_RELIGION_ALLIED_INQUISITORS)3535 bool bProtected = (pLoopUnit->getOwner() == m_pCity->getOwner() && pLoopUnit->GetReligionData()->GetReligion() != eReligion);3536 if (!bProtected && MOD_RELIGION_ALLIED_INQUISITORS) {3537 CvPlayer* pCityPlayer = &GET_PLAYER(m_pCity->getOwner());3538 if (pCityPlayer->isMinorCiv() && pCityPlayer->GetMinorCivAI()->GetAlly() == pLoopUnit->getOwner()) {3539 bProtected = true;3540 }3541 }3542 3543 if (bProtected)3544#else3545 if(pLoopUnit->getOwner() == m_pCity->getOwner() && pLoopUnit->GetReligionData()->GetReligion() != eReligion)3546#endif3547 {3548 return true;3549 }3550 }3551 }3552 }35533554 CvPlot* pAdjacentPlot;3555 for(int iDirectionLoop = 0; iDirectionLoop < NUM_DIRECTION_TYPES; iDirectionLoop++)3556 {3557 pAdjacentPlot = plotDirection(m_pCity->getX(), m_pCity->getY(), ((DirectionTypes)iDirectionLoop));35583559 if(pAdjacentPlot != NULL)3560 {3561 for(int iUnitLoop = 0; iUnitLoop < pAdjacentPlot->getNumUnits(); iUnitLoop++)3562 {3563 pLoopUnit = pAdjacentPlot->getUnitByIndex(iUnitLoop);3564 CvUnitEntry* pkEntry = GC.getUnitInfo(pLoopUnit->getUnitType());3565 if(pkEntry && pkEntry->IsProhibitsSpread())3566 {3567#if defined(MOD_RELIGION_ALLIED_INQUISITORS)3568 bool bProtected = (pLoopUnit->getOwner() == m_pCity->getOwner() && pLoopUnit->GetReligionData()->GetReligion() != eReligion);3569 if (!bProtected && MOD_RELIGION_ALLIED_INQUISITORS) {3570 CvPlayer* pCityPlayer = &GET_PLAYER(m_pCity->getOwner());3571 if (pCityPlayer->isMinorCiv() && pCityPlayer->GetMinorCivAI()->GetAlly() == pLoopUnit->getOwner()) {3572 bProtected = true;3573 }3574 }3575 3576 if (bProtected)3577#else3578 if(pLoopUnit->getOwner() == m_pCity->getOwner() && pLoopUnit->GetReligionData()->GetReligion() != eReligion)3579#endif3580 {3581 return true;3582 }3583 }3584 }3585 }3586 }35873588 return false;3589}
Calls
- CustomMods::isRELIGION_ALLIED_INQUISITORS()
- CvCity::getOwner() const
- CvCity::getX() const
- CvCity::getY() const
- CvCity::plot() const
- CvGlobals::getUnitInfo(UnitTypes)
- CvMinorCivAI::GetAlly() const
- CvPlayer::GetMinorCivAI() const
- CvPlayer::isMinorCiv() const
- CvPlayerAI::getPlayer(PlayerTypes)
- CvPlot::getNumUnits() const
- CvPlot::getUnitByIndex(int) const
- CvUnit::getOwner() const
- CvUnit::GetReligionData() const
- CvUnit::getUnitType() const
- CvUnitEntry::IsProhibitsSpread() const
- CvUnitReligion::GetReligion() const
- plotDirection(int, int, DirectionTypes)