GreatPeopleDirectiveTypes CvPlayerAI::GetDirectiveGeneral(CvUnit* pGreatGeneral) { GreatPeopleDirectiveTypes eDirective = NO_GREAT_PEOPLE_DIRECTIVE_TYPE; SpecialUnitTypes eSpecialUnitGreatPerson = (SpecialUnitTypes) GC.getInfoTypeForString("SPECIALUNIT_PEOPLE"); int iGreatGeneralCount = 0; int iLoop; for(CvUnit* pLoopUnit = firstUnit(&iLoop); pLoopUnit; pLoopUnit = nextUnit(&iLoop)) { if(pLoopUnit->getSpecialUnitType() != eSpecialUnitGreatPerson) { continue; } if(pLoopUnit->AI_getUnitAIType() == UNITAI_GENERAL && pLoopUnit->GetGreatPeopleDirective() != GREAT_PEOPLE_DIRECTIVE_GOLDEN_AGE) { iGreatGeneralCount++; } } if(iGreatGeneralCount > 2 && pGreatGeneral->plot()->getOwner() == pGreatGeneral->getOwner()) { // we're using a power at this point because constructing the improvement goes through different code eDirective = GREAT_PEOPLE_DIRECTIVE_USE_POWER; } return eDirective; }
GreatPeopleDirectiveTypes CvPlayerAI::GetDirectiveGeneral (CvUnit*) { GreatPeopleDirectiveTypes eDirective = NO_GREAT_PEOPLE_DIRECTIVE_TYPE; SpecialUnitTypes eSpecialUnitGreatPerson = (SpecialUnitTypes) GC.getInfoTypeForString("SPECIALUNIT_PEOPLE"); int iGreatGeneralCount = 0; int iLoop; for (CvUnit* pLoopUnit = firstUnit(&iLoop); pLoopUnit; pLoopUnit = nextUnit(&iLoop)) { if (pLoopUnit->getSpecialUnitType() != eSpecialUnitGreatPerson) { continue; } if (pLoopUnit->AI_getUnitAIType() == UNITAI_GENERAL && pLoopUnit->GetGreatPeopleDirective() != GREAT_PEOPLE_DIRECTIVE_GOLDEN_AGE) { iGreatGeneralCount++; } } if (iGreatGeneralCount > 2) { eDirective = GREAT_PEOPLE_DIRECTIVE_GOLDEN_AGE; } return eDirective; }