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 | bb680056b1004ca5e8e74786764061aeedf9c188 (patch) | |
tree | c97da17a330889a788b8654dddbc7507d01b3b38 /misc.c | |
parent | 77072aedabd1e5acd2d380defac707c88d287c88 (diff) | |
download | openttd-bb680056b1004ca5e8e74786764061aeedf9c188.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); |