Bazaar developer reference

CvUnitPromotions::GetAllowTerrainPassable(TerrainTypes) const

Defined in
CvPromotionClasses.cpp, line 2282
Class
CvUnitPromotions
Hook name
CivHooks::CvUnitPromotions_GetAllowTerrainPassable

Hooks

static bool BeforeCvUnitPromotions_GetAllowTerrainPassable(const CvUnitPromotions* self, TerrainTypes eTerrainType, bool& result);static void AfterCvUnitPromotions_GetAllowTerrainPassable(const CvUnitPromotions* self, TerrainTypes eTerrainType, bool& result);static bool ReplaceCvUnitPromotions_GetAllowTerrainPassable(bool (*original)(const CvUnitPromotions*, TerrainTypes), const CvUnitPromotions* self, TerrainTypes eTerrainType);CivRegisterBefore<CivHooks::CvUnitPromotions_GetAllowTerrainPassable>(host, &BeforeCvUnitPromotions_GetAllowTerrainPassable);CivRegisterAfter<CivHooks::CvUnitPromotions_GetAllowTerrainPassable>(host, &AfterCvUnitPromotions_GetAllowTerrainPassable);CivRegisterReplace<CivHooks::CvUnitPromotions_GetAllowTerrainPassable>(host, &ReplaceCvUnitPromotions_GetAllowTerrainPassable);

Code

2281/// determines if the terrain type is passable given the unit's current promotions2282bool CvUnitPromotions::GetAllowTerrainPassable(TerrainTypes eTerrainType) const2283{2284	CvTeamTechs* teamTechs = GET_TEAM(m_pUnit->getTeam()).GetTeamTechs();2285	CvAssert(teamTechs);2286	if(!teamTechs) return false;22872288	int iNumPromos = GC.getNumPromotionInfos();2289	for(int iLoop = 0; iLoop < iNumPromos; iLoop++)2290	{2291		PromotionTypes ePromotion = (PromotionTypes) iLoop;2292		if(m_kHasPromotion.GetBit(ePromotion))2293		{2294			CvPromotionEntry* promotion = GC.getPromotionInfo(ePromotion);22952296			if(promotion)2297			{2298				TechTypes eTech = (TechTypes) promotion->GetTerrainPassableTech(eTerrainType);2299				if(eTech != NO_TECH && teamTechs->HasTech(eTech))2300				{2301					return true;2302				}2303			}2304		}2305	}2306	return false;2307}

Calls

Called by