Changeset - r14194:8195fb0c0633
[Not reviewed]
master
0 1 0
yexo - 15 years ago 2010-01-07 20:56:50
yexo@openttd.org
(svn r18755) -Fix [FS#3495] (r14847): CircularTileSearch skipped a few tiles close to the starting tile
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/map.cpp
Show inline comments
 
@@ -242,15 +242,15 @@ bool CircularTileSearch(TileIndex *tile,
 

	
 
	if (size % 2 == 1) {
 
		/* If the length of the side is uneven, the center has to be checked
 
		 * separately, as the pattern of uneven sides requires to go around the center */
 
		if (proc(*tile, user_data)) return true;
 

	
 
		/* If tile test is not successful, get one tile down and left,
 
		/* If tile test is not successful, get one tile up,
 
		 * ready for a test in first circle around center tile */
 
		*tile = TILE_ADD(*tile, TileOffsByDir(DIR_W));
 
		*tile = TILE_ADD(*tile, TileOffsByDir(DIR_N));
 
		return CircularTileSearch(tile, size / 2, 1, 1, proc, user_data);
 
	} else {
 
		return CircularTileSearch(tile, size / 2, 0, 0, proc, user_data);
 
	}
 
}
 

	
 
@@ -258,13 +258,14 @@ bool CircularTileSearch(TileIndex *tile,
 
 * Generalized circular search allowing for rectangles and a hole.
 
 * Function performing a search around a center rectangle and going outward.
 
 * The center rectangle is left out from the search. To do a rectangular search
 
 * without a hole, set either h or w to zero.
 
 * Every tile will be tested by means of the callback function proc,
 
 * which will determine if yes or no the given tile meets criteria of search.
 
 * @param tile to start the search from. Upon completion, it will return the tile matching the search
 
 * @param tile to start the search from. Upon completion, it will return the tile matching the search.
 
 *  This tile should be directly north of the hole (if any).
 
 * @param radius How many tiles to search outwards. Note: This is a radius and thus different
 
 *                from the size parameter of the other CircularTileSearch function, which is a diameter.
 
 * @param w the width of the inner rectangle
 
 * @param h the height of the inner rectangle
 
 * @param proc callback testing function pointer.
 
 * @param user_data to be passed to the callback function. Depends on the implementation
0 comments (0 inline, 0 general)