Bazaar developer reference

isTechRequiredForUnit(TechTypes, UnitTypes)

Defined in
CvGameCoreUtils.cpp, line 509
Hook name
CivHooks::isTechRequiredForUnit

Hooks

static bool BeforeisTechRequiredForUnit(TechTypes eTech, UnitTypes eUnit, bool& result);static void AfterisTechRequiredForUnit(TechTypes eTech, UnitTypes eUnit, bool& result);static bool ReplaceisTechRequiredForUnit(bool (*original)(TechTypes, UnitTypes), TechTypes eTech, UnitTypes eUnit);CivRegisterBefore<CivHooks::isTechRequiredForUnit>(host, &BeforeisTechRequiredForUnit);CivRegisterAfter<CivHooks::isTechRequiredForUnit>(host, &AfterisTechRequiredForUnit);CivRegisterReplace<CivHooks::isTechRequiredForUnit>(host, &ReplaceisTechRequiredForUnit);

Code

509bool isTechRequiredForUnit(TechTypes eTech, UnitTypes eUnit)510{511	CvUnitEntry* info = GC.getUnitInfo(eUnit);512	if(info == NULL)513	{514		return false;515	}516517	if(info->GetPrereqAndTech() == eTech)518	{519		return true;520	}521522	for(int iI = 0; iI < GC.getNUM_UNIT_AND_TECH_PREREQS(); iI++)523	{524		if(info->GetPrereqAndTechs(iI) == eTech)525		{526			return true;527		}528	}529530	return false;531}

Calls