Changeset - r11040:21c15e24ae2e
[Not reviewed]
master
0 1 0
frosch - 15 years ago 2009-02-06 20:24:44
frosch@openttd.org
(svn r15380) -Fix (r15190)[FS#2603]: Do not use TileY() on negative TileIndexDiffs. But the test was not needed anyway, as those tiles were already tested in previous iterations.
1 file changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/town_cmd.cpp
Show inline comments
 
@@ -716,7 +716,7 @@ static RoadBits GetTownRoadBits(TileInde
 
}
 

	
 
/**
 
 * Check if a neighboring tile has a road
 
 * Check if certain neighboring tiles have a road in a specific direction
 
 *
 
 * @param tile curent tile
 
 * @param dir target direction
 
@@ -726,6 +726,8 @@ static RoadBits GetTownRoadBits(TileInde
 
 */
 
static bool IsNeighborRoadTile(TileIndex tile, const DiagDirection dir, uint dist_multi)
 
{
 
	if (!IsValidTile(tile)) return false;
 

	
 
	/* Lookup table for the used diff values */
 
	const TileIndexDiff tid_lt[3] = {
 
		TileOffsByDiagDir(ChangeDiagDir(dir, DIAGDIRDIFF_90RIGHT)),
 
@@ -747,7 +749,9 @@ static bool IsNeighborRoadTile(TileIndex
 
		if (pos & 2) cur += tid_lt[2];
 

	
 
		cur = (uint)(pos / 4) * cur; // Multiply for the fitting distance
 
		if (IsValidTile(tile + TileXY(TileX(cur) / 2, TileY(cur) / 2)) && IsValidTile(tile + cur) && GetTownRoadBits(TILE_ADD(tile, cur)) & DiagDirToRoadBits((pos & 2) ? dir : ReverseDiagDir(dir))) return true;
 

	
 
		if (IsValidTile(tile + cur) &&
 
			GetTownRoadBits(TILE_ADD(tile, cur)) & DiagDirToRoadBits((pos & 2) ? dir : ReverseDiagDir(dir))) return true;
 
	}
 
	return false;
 
}
0 comments (0 inline, 0 general)