From 7bbcf5875c2fc6a8fa80e417d65e1094947d78b8 Mon Sep 17 00:00:00 2001 From: tron Date: Mon, 31 Jan 2005 07:23:15 +0000 Subject: (svn r1749) Move the functions which calculate distances to map.[ch] and give the more meaningful names --- misc.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'misc.c') diff --git a/misc.c b/misc.c index d8bd83b3f..f4e363585 100644 --- a/misc.c +++ b/misc.c @@ -533,43 +533,6 @@ void InitializeLandscapeVariables(bool only_constants) } } -// distance in Manhattan metric -uint GetTileDist(TileIndex xy1, TileIndex xy2) -{ - return myabs(TileX(xy1) - TileX(xy2)) + - myabs(TileY(xy1) - TileY(xy2)); -} - -// maximum distance in x _or_ y -uint GetTileDist1D(TileIndex xy1, TileIndex xy2) -{ - return max(myabs(TileX(xy1) - TileX(xy2)), - myabs(TileY(xy1) - TileY(xy2))); -} - -uint GetTileDist1Db(TileIndex xy1, TileIndex xy2) -{ - int a = myabs(TileX(xy1) - TileX(xy2)); - int b = myabs(TileY(xy1) - TileY(xy2)); - - if (a > b) - return a*2+b; - else - return b*2+a; -} - -uint GetTileDistAdv(TileIndex xy1, TileIndex xy2) -{ - uint a = myabs(TileX(xy1) - TileX(xy2)); - uint b = myabs(TileY(xy1) - TileY(xy2)); - return a*a+b*b; -} - -bool CheckDistanceFromEdge(TileIndex tile, uint distance) -{ - return IS_INT_INSIDE(TileX(tile), distance, MapSizeX() - distance) && - IS_INT_INSIDE(TileY(tile), distance, MapSizeY() - distance); -} void OnNewDay_Train(Vehicle *v); void OnNewDay_RoadVeh(Vehicle *v); -- cgit v1.2.3-54-g00ecf