//	---------------------------------------------------------------------------
//	Test if the team can see from the supplied hex to a displacement in HEXSPACE
//	from the start hex.
//	This is the strict version that prevents you from seeing through partially blocked hexes
//	after a certain distance threshold is reached.  Even when below the distance threshold
//	more than one blockage will cause the LOS to fail.
static bool CanSeeDisplacementPlot_Strict(int startX, int startY, int dx, int dy, int fromLevel)
{
	int originalDX = dx;
	int originalDY = dy;

	CvMap& kMap = GC.getMap();

	// Use Bresenham's line algorithm, with a slight modification, to step through the cells.
	// The modification is that if we are stepping in the upper-right or lower-left quadrant,
	// and we need to take a step on the 'short' axis, we will check the plot with just the
	// adjustment to the X axis, before we do the normal check for the step on the X and Y
	// axis.  This is needed because in those quadrants a change on both the X and Y axis 
	// is not contiguous.

	// Because the hex grid is low-resolution, checks are also made to allow the ray to continue 
	// around a blockage if that blockage obscures only part of the next hex cell along the ray.
	// This is done by 'looking back' at the alternate path the ray could have taken as it is 
	// traversing the hex grid.

	// Make DX and DY positive and adjust the step constant for the opposite axis.
	int stepY;
	if (dy < 0) 
	{ 
		dy = -dy;  
		stepY = -1; 
	} 
	else 
		stepY = 1; 

	int stepX;
	if (dx < 0) 
	{ 
		dx = -dx;  
		stepX = -1; 
	} 
	else 
		stepX = 1;

	dy <<= 1;
	dx <<= 1;

	int currentDX = 0;
	int currentDY = 0;

	// If in an odd quadrant, stepping down on the short axis requires two checks to be contiguous
	bool oddQuadrant = stepX != stepY;
	// Is the line going to go such that it travels through the centers of the hexes?
	// If so, we don't have to worry about testing to see if we can look around blocked hexes.
	bool straightThrough = dx == 0 || dy == 0;

	// Start from the next cell after the source plot
	int lastDX = currentDX;
	int lastDY = currentDY;
	int lookbackDirection = -1;
	int stepCount = 0;
	int iBlockedCount = 0;

	// If dx is greater than dy, scan along the x axis, adjusting the Y as needed
	if (dx > dy) 
	{
		int shortAxisStepFactor = (dx >> 1); 
		while (currentDX != originalDX) 
		{
			shortAxisStepFactor += dy;

			if (shortAxisStepFactor >= dx) 
			{
				shortAxisStepFactor -= dx;

				if (oddQuadrant)
				{
					currentDX += stepX;
					currentDY += stepY;
				}
				else
				{
					currentDX += stepX;

					// Look back to see if we were possibly blocked by the alternate route to this hex.  We will ignore the check if inside the rings that allow the user to look around obstacles.
					if (!straightThrough && lookbackDirection != -1)
					{
						CvPlot* passThroughPlot = PlotFromHex(kMap, startX + currentDX + ms_LookBackX[lookbackDirection], startY + currentDY + ms_LookBackY[lookbackDirection]);
						TRACK_LAST_TARGET_PATH_ENTRY(passThroughPlot);
						if(!passThroughPlot || fromLevel < passThroughPlot->seeThroughLevel())
						{
							++iBlockedCount;
							if (stepCount > STRICT_LOOSE_CUTOFF || iBlockedCount >= 2)
								return false;
						}
					}

					// Don't test the destination, we only want to test the plots between the start and the destination
					if (currentDX == originalDX && currentDY == originalDY)
						break;	

					CvPlot* passThroughPlot = PlotFromHex(kMap, startX + currentDX, startY + currentDY);
					TRACK_LAST_TARGET_PATH_ENTRY(passThroughPlot);
					if(!passThroughPlot || fromLevel < passThroughPlot->seeThroughLevel())
						return false;

					lookbackDirection = ms_HexDirection[(currentDX - lastDX) + 1][(currentDY - lastDY) + 1];

					++stepCount;
					lastDX = currentDX; lastDY = currentDY;

					currentDY += stepY;
				}
			}
			else
				currentDX += stepX;

			// Look back to see if we were possibly blocked by the alternate route to this hex.
			if (!straightThrough && lookbackDirection != -1)
			{
				CvPlot* passThroughPlot = PlotFromHex(kMap, startX + currentDX + ms_LookBackX[lookbackDirection], startY + currentDY + ms_LookBackY[lookbackDirection]);
				TRACK_LAST_TARGET_PATH_ENTRY(passThroughPlot);
				if(!passThroughPlot || fromLevel < passThroughPlot->seeThroughLevel())
				{
					if (stepCount > STRICT_LOOSE_CUTOFF || ++iBlockedCount >= 2)
						return false;
				}
			}

			// Don't test the destination, we only want to test the plots between the start and the destination
			if (currentDX == originalDX && currentDY == originalDY)
				break;	

			CvPlot* passThroughPlot = PlotFromHex(kMap, startX + currentDX, startY + currentDY);
			TRACK_LAST_TARGET_PATH_ENTRY(passThroughPlot);
			if(!passThroughPlot || fromLevel < passThroughPlot->seeThroughLevel())
				return false;

			lookbackDirection = ms_HexDirection[(currentDX - lastDX) + 1][(currentDY - lastDY) + 1];

			++stepCount;
			lastDX = currentDX; lastDY = currentDY;
		}
	}