src/map.cpp
changeset 7930 f12c2437a050
parent 7546 c4f9132d9f1e
child 7970 7d6b9ab57081
equal deleted inserted replaced
7929:6c9b25842b0f 7930:f12c2437a050
   216  */
   216  */
   217 uint DistanceMax(TileIndex t0, TileIndex t1)
   217 uint DistanceMax(TileIndex t0, TileIndex t1)
   218 {
   218 {
   219 	const uint dx = delta(TileX(t0), TileX(t1));
   219 	const uint dx = delta(TileX(t0), TileX(t1));
   220 	const uint dy = delta(TileY(t0), TileY(t1));
   220 	const uint dy = delta(TileY(t0), TileY(t1));
   221 	return dx > dy ? dx : dy;
   221 	return max(dx, dy);
   222 }
   222 }
   223 
   223 
   224 
   224 
   225 /*!
   225 /*!
   226  * Gets the biggest distance component (x or y) between the two given tiles
   226  * Gets the biggest distance component (x or y) between the two given tiles
   246 {
   246 {
   247 	const uint xl = TileX(tile);
   247 	const uint xl = TileX(tile);
   248 	const uint yl = TileY(tile);
   248 	const uint yl = TileY(tile);
   249 	const uint xh = MapSizeX() - 1 - xl;
   249 	const uint xh = MapSizeX() - 1 - xl;
   250 	const uint yh = MapSizeY() - 1 - yl;
   250 	const uint yh = MapSizeY() - 1 - yl;
   251 	const uint minl = xl < yl ? xl : yl;
   251 	const uint minl = min(xl, yl);
   252 	const uint minh = xh < yh ? xh : yh;
   252 	const uint minh = min(xh, yh);
   253 	return minl < minh ? minl : minh;
   253 	return min(minl, minh);
   254 }
   254 }
   255 
   255 
   256 /*!
   256 /*!
   257  * Function performing a search around a center tile and going outward, thus in circle.
   257  * Function performing a search around a center tile and going outward, thus in circle.
   258  * Although it really is a square search...
   258  * Although it really is a square search...