diff options
author | tron <tron@openttd.org> | 2005-01-31 07:23:15 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-01-31 07:23:15 +0000 |
commit | 7bbcf5875c2fc6a8fa80e417d65e1094947d78b8 (patch) | |
tree | c97da17a330889a788b8654dddbc7507d01b3b38 /misc.c | |
parent | e1c19367f0cebbe90596319e9f82d959fa54621c (diff) | |
download | openttd-7bbcf5875c2fc6a8fa80e417d65e1094947d78b8.tar.xz |
(svn r1749) Move the functions which calculate distances to map.[ch] and give the more meaningful names
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 37 |
1 files changed, 0 insertions, 37 deletions
@@ -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); |