CvPlayerTraits::IsFreeMayaGreatPersonChoice() const
- Defined in
- CvTraitClasses.cpp, line 3547
- Class
- CvPlayerTraits
- Hook name
CivHooks::CvPlayerTraits_IsFreeMayaGreatPersonChoice
Hooks
static bool BeforeCvPlayerTraits_IsFreeMayaGreatPersonChoice(const CvPlayerTraits* self, bool& result);static void AfterCvPlayerTraits_IsFreeMayaGreatPersonChoice(const CvPlayerTraits* self, bool& result);static bool ReplaceCvPlayerTraits_IsFreeMayaGreatPersonChoice(bool (*original)(const CvPlayerTraits*), const CvPlayerTraits* self);CivRegisterBefore<CivHooks::CvPlayerTraits_IsFreeMayaGreatPersonChoice>(host, &BeforeCvPlayerTraits_IsFreeMayaGreatPersonChoice);CivRegisterAfter<CivHooks::CvPlayerTraits_IsFreeMayaGreatPersonChoice>(host, &AfterCvPlayerTraits_IsFreeMayaGreatPersonChoice);CivRegisterReplace<CivHooks::CvPlayerTraits_IsFreeMayaGreatPersonChoice>(host, &ReplaceCvPlayerTraits_IsFreeMayaGreatPersonChoice);
Code
3546/// Have Maya unlocked free choice of Great People?3547bool CvPlayerTraits::IsFreeMayaGreatPersonChoice() const3548{3549 // True if have already selected each GP type once3550 int iNumGreatPeopleTypes = 0;3551 SpecialUnitTypes eSpecialUnitGreatPerson = (SpecialUnitTypes) GC.getInfoTypeForString("SPECIALUNIT_PEOPLE");35523553 // Loop through adding the available units3554 for(int iI = 0; iI < GC.getNumUnitClassInfos(); iI++)3555 {3556 const UnitClassTypes eUnitClass = static_cast<UnitClassTypes>(iI);3557 CvUnitClassInfo* pkUnitClassInfo = GC.getUnitClassInfo(eUnitClass);3558 if(pkUnitClassInfo)3559 {3560 const UnitTypes eUnit = (UnitTypes)m_pPlayer->getCivilizationInfo().getCivilizationUnits(eUnitClass);3561 if (eUnit != NO_UNIT)3562 {3563 CvUnitEntry* pUnitEntry = GC.getUnitInfo(eUnit);3564 if (pUnitEntry)3565 {3566 if (pUnitEntry->GetSpecialUnitType() == eSpecialUnitGreatPerson)3567 {3568 iNumGreatPeopleTypes++;3569 }3570 }3571 } 3572 }3573 }35743575 return ((int)m_aMayaBonusChoices.size() >= iNumGreatPeopleTypes);3576}
Calls
- CvCivilizationInfo::getCivilizationUnits(int) const
- CvGlobals::getInfoTypeForString(const char *, bool) const
- CvGlobals::getNumUnitClassInfos()
- CvGlobals::getUnitClassInfo(UnitClassTypes)
- CvGlobals::getUnitInfo(UnitTypes)
- CvPlayer::getCivilizationInfo() const
- CvUnitEntry::GetSpecialUnitType() const
std::vector::size