CvUnit::IsHigherTechThan(UnitTypes) const
- Defined in
- CvUnit.cpp, line 25391
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_IsHigherTechThan
Hooks
static bool BeforeCvUnit_IsHigherTechThan(const CvUnit* self, UnitTypes otherUnit, bool& result);static void AfterCvUnit_IsHigherTechThan(const CvUnit* self, UnitTypes otherUnit, bool& result);static bool ReplaceCvUnit_IsHigherTechThan(bool (*original)(const CvUnit*, UnitTypes), const CvUnit* self, UnitTypes otherUnit);CivRegisterBefore<CivHooks::CvUnit_IsHigherTechThan>(host, &BeforeCvUnit_IsHigherTechThan);CivRegisterAfter<CivHooks::CvUnit_IsHigherTechThan>(host, &AfterCvUnit_IsHigherTechThan);CivRegisterReplace<CivHooks::CvUnit_IsHigherTechThan>(host, &ReplaceCvUnit_IsHigherTechThan);
Code
25391bool CvUnit::IsHigherTechThan(UnitTypes otherUnit) const25392{25393 int iMyTechCost = 0;25394 int iOtherTechCost = 0;2539525396 TechTypes eMyTech = (TechTypes)getUnitInfo().GetPrereqAndTech();25397 if(eMyTech != NO_TECH)25398 {25399 CvTechEntry* pEntry = GC.GetGameTechs()->GetEntry(eMyTech);25400 if(pEntry)25401 {25402 iMyTechCost = pEntry->GetResearchCost();25403 }25404 }2540525406 CvUnitEntry* pUnitEntry = GC.GetGameUnits()->GetEntry(otherUnit);25407 if(pUnitEntry)25408 {25409 TechTypes eOtherTech = (TechTypes)pUnitEntry->GetPrereqAndTech();25410 if(eOtherTech != NO_TECH)25411 {25412 CvTechEntry* pEntry = GC.GetGameTechs()->GetEntry(eOtherTech);25413 if(pEntry)25414 {25415 iOtherTechCost = pEntry->GetResearchCost();25416 }25417 }25418 }2541925420 return iMyTechCost > iOtherTechCost;25421}