Bazaar developer reference

CvTargeting::CanSeeDisplacementPlot(int, int, int, int, int)

Defined in
CvTargeting.cpp, line 599
Class
CvTargeting
Hook name
CivHooks::CvTargeting_CanSeeDisplacementPlot

Hooks

static bool BeforeCvTargeting_CanSeeDisplacementPlot(int startX, int startY, int dx, int dy, int fromLevel, bool& result);static void AfterCvTargeting_CanSeeDisplacementPlot(int startX, int startY, int dx, int dy, int fromLevel, bool& result);static bool ReplaceCvTargeting_CanSeeDisplacementPlot(bool (*original)(int, int, int, int, int), int startX, int startY, int dx, int dy, int fromLevel);CivRegisterBefore<CivHooks::CvTargeting_CanSeeDisplacementPlot>(host, &BeforeCvTargeting_CanSeeDisplacementPlot);CivRegisterAfter<CivHooks::CvTargeting_CanSeeDisplacementPlot>(host, &AfterCvTargeting_CanSeeDisplacementPlot);CivRegisterReplace<CivHooks::CvTargeting_CanSeeDisplacementPlot>(host, &ReplaceCvTargeting_CanSeeDisplacementPlot);

Code

599bool CvTargeting::CanSeeDisplacementPlot(int startX, int startY, int dx, int dy, int fromLevel)600{601	CLEAR_TARGET_PATH_DEBUG;602603	// convert the start coord to hex-space coordinates604	// No need to convert the Y coord, it is the same in both systems605	startX = xToHexspaceX(startX, startY);606607	CvMap& kMap = GC.getMap();608	CvPlot* pPlot = PlotFromHex(kMap, startX + dx, startY + dy);609	if(pPlot != NULL)610	{611		int iHexDistanceBetweenPlots = hexDistance(dx, dy);612		// assume that we can always see our plot and the plot next door613		if(iHexDistanceBetweenPlots <= 1)614			return true;615616		// If over STRICT_LOOSE_CUTOFF away, any blockage past the STRICT_LOOSE_CUTOFF will result in not being able to target.617		if (iHexDistanceBetweenPlots > STRICT_LOOSE_CUTOFF /*&& GC.getGame().isOption("STRICT_RANGE_TARGETING")*/)618			return CanSeeDisplacementPlot_Strict(startX, startY, dx, dy, fromLevel);619		else620			return CanSeeDisplacementPlot_Loose(startX, startY, dx, dy, fromLevel);621622	}623624	return false;625}

Calls

Called by