CvPlayerAI::GetDirectiveProphet(CvUnit *)
- Defined in
- CvPlayerAI.cpp, line 1378
- Class
- CvPlayerAI
- Hook name
CivHooks::CvPlayerAI_GetDirectiveProphet
Hooks
static bool BeforeCvPlayerAI_GetDirectiveProphet(CvPlayerAI* self, CvUnit* arg0, GreatPeopleDirectiveTypes& result);static void AfterCvPlayerAI_GetDirectiveProphet(CvPlayerAI* self, CvUnit* arg0, GreatPeopleDirectiveTypes& result);static GreatPeopleDirectiveTypes ReplaceCvPlayerAI_GetDirectiveProphet(GreatPeopleDirectiveTypes (*original)(CvPlayerAI*, CvUnit*), CvPlayerAI* self, CvUnit* arg0);CivRegisterBefore<CivHooks::CvPlayerAI_GetDirectiveProphet>(host, &BeforeCvPlayerAI_GetDirectiveProphet);CivRegisterAfter<CivHooks::CvPlayerAI_GetDirectiveProphet>(host, &AfterCvPlayerAI_GetDirectiveProphet);CivRegisterReplace<CivHooks::CvPlayerAI_GetDirectiveProphet>(host, &ReplaceCvPlayerAI_GetDirectiveProphet);
Code
1378GreatPeopleDirectiveTypes CvPlayerAI::GetDirectiveProphet(CvUnit*)1379{1380 GreatPeopleDirectiveTypes eDirective = NO_GREAT_PEOPLE_DIRECTIVE_TYPE;13811382 ReligionTypes eReligion = GetReligions()->GetReligionCreatedByPlayer();1383 const CvReligion* pMyReligion = GC.getGame().GetGameReligions()->GetReligion(eReligion, GetID());13841385 // CASE 1: I have an enhanced religion1386 if (pMyReligion && pMyReligion->m_bEnhanced)1387 {1388 // Spread religion if there is any city that needs it1389 if (GetReligionAI()->ChooseProphetConversionCity(false/*bOnlyBetterThanEnhancingReligion*/))1390 {1391 eDirective = GREAT_PEOPLE_DIRECTIVE_SPREAD_RELIGION;1392 }1393 else1394 {1395 eDirective = GREAT_PEOPLE_DIRECTIVE_CONSTRUCT_IMPROVEMENT;1396 }1397 }139813991400 // CASE 2: I have a religion that hasn't yet been enhanced1401 else if (pMyReligion)1402 {1403 // Spread religion if there is a city that needs it CRITICALLY1404 if (GetReligionAI()->ChooseProphetConversionCity(true/*bOnlyBetterThanEnhancingReligion*/))1405 {1406 eDirective = GREAT_PEOPLE_DIRECTIVE_SPREAD_RELIGION;1407 }1408 else1409 {1410 eDirective = GREAT_PEOPLE_DIRECTIVE_USE_POWER;1411 }1412 }14131414 // CASE 3: No religion for me yet1415 else1416 {1417 // Locked out?1418 if (GC.getGame().GetGameReligions()->GetNumReligionsStillToFound() <= 0)1419 {1420 eDirective = GREAT_PEOPLE_DIRECTIVE_CONSTRUCT_IMPROVEMENT;1421 }14221423 // Not locked out1424 else1425 {1426 eDirective = GREAT_PEOPLE_DIRECTIVE_USE_POWER;1427 }1428 }14291430 return eDirective;1431}
Calls
- CvGame::GetGameReligions()
- CvGameReligions::GetNumReligionsStillToFound(bool) const
- CvGameReligions::GetReligion(ReligionTypes, PlayerTypes) const
- CvGlobals::getGame()
- CvPlayer::GetID() const
- CvPlayer::GetReligionAI() const
- CvPlayer::GetReligions() const
- CvPlayerReligions::GetReligionCreatedByPlayer(bool) const
- CvReligionAI::ChooseProphetConversionCity(bool) const