Bazaar developer reference

CvUnit::GetRange() const

Defined in
CvUnit.cpp, line 11681
Class
CvUnit
Hook name
CivHooks::CvUnit_GetRange

Hooks

static bool BeforeCvUnit_GetRange(const CvUnit* self, int& result);static void AfterCvUnit_GetRange(const CvUnit* self, int& result);static int ReplaceCvUnit_GetRange(int (*original)(const CvUnit*), const CvUnit* self);CivRegisterBefore<CivHooks::CvUnit_GetRange>(host, &BeforeCvUnit_GetRange);CivRegisterAfter<CivHooks::CvUnit_GetRange>(host, &AfterCvUnit_GetRange);CivRegisterReplace<CivHooks::CvUnit_GetRange>(host, &ReplaceCvUnit_GetRange);

Code

11681int CvUnit::GetRange() const11682{11683	VALIDATE_OBJECT1168411685#if defined(MOD_UNITS_HOVERING_COASTAL_ATTACKS)11686	// Hovering units over coast/ice become ranged units11687	if (MOD_UNITS_HOVERING_COASTAL_ATTACKS && m_pUnitInfo->GetRangedCombat() == 0 && IsHoveringUnit() && (plot()->isShallowWater() || plot()->getFeatureType() == FEATURE_ICE)) {11688		int iRange = std::max(1, gCustomMods.getOption("UNITS_HOVERING_COASTAL_ATTACKS_RANGE", 1));11689		return (iRange + m_iExtraRange);11690	}11691#endif1169211693	return (m_pUnitInfo->GetRange() + m_iExtraRange);11694}

Calls

Called by

31 functions in 8 files