CvUnitPromotions::GetAllowFeaturePassable(FeatureTypes) const
- Defined in
- CvPromotionClasses.cpp, line 2254
- Class
- CvUnitPromotions
- Hook name
CivHooks::CvUnitPromotions_GetAllowFeaturePassable
Hooks
static bool BeforeCvUnitPromotions_GetAllowFeaturePassable(const CvUnitPromotions* self, FeatureTypes eFeatureType, bool& result);static void AfterCvUnitPromotions_GetAllowFeaturePassable(const CvUnitPromotions* self, FeatureTypes eFeatureType, bool& result);static bool ReplaceCvUnitPromotions_GetAllowFeaturePassable(bool (*original)(const CvUnitPromotions*, FeatureTypes), const CvUnitPromotions* self, FeatureTypes eFeatureType);CivRegisterBefore<CivHooks::CvUnitPromotions_GetAllowFeaturePassable>(host, &BeforeCvUnitPromotions_GetAllowFeaturePassable);CivRegisterAfter<CivHooks::CvUnitPromotions_GetAllowFeaturePassable>(host, &AfterCvUnitPromotions_GetAllowFeaturePassable);CivRegisterReplace<CivHooks::CvUnitPromotions_GetAllowFeaturePassable>(host, &ReplaceCvUnitPromotions_GetAllowFeaturePassable);
Code
2253/// determines if the terrain feature is passable given the unit's current promotions2254bool CvUnitPromotions::GetAllowFeaturePassable(FeatureTypes eFeatureType) const2255{2256 CvTeamTechs* teamTechs = GET_TEAM(m_pUnit->getTeam()).GetTeamTechs();2257 CvAssert(teamTechs);2258 if(!teamTechs) return false;22592260 int iNumPromos = GC.getNumPromotionInfos();2261 for(int iLoop = 0; iLoop < iNumPromos; iLoop++)2262 {2263 PromotionTypes ePromotion = (PromotionTypes) iLoop;2264 if(m_kHasPromotion.GetBit(ePromotion))2265 {2266 CvPromotionEntry* promotion = GC.getPromotionInfo(ePromotion);2267 if(promotion)2268 {2269 TechTypes eTech = (TechTypes) promotion->GetFeaturePassableTech(eFeatureType);2270 if(eTech != NO_TECH && teamTechs->HasTech(eTech))2271 {2272 return true;2273 }2274 }2275 }2276 }22772278 return false;2279}