diff -r fc1723285db9 -r d534f0c8c845 map.h --- a/map.h Mon Apr 11 14:59:06 2005 +0000 +++ b/map.h Mon Apr 11 19:14:48 2005 +0000 @@ -102,10 +102,11 @@ } // Functions to calculate distances -uint DistanceManhattan(TileIndex, TileIndex); // also known as L1-Norm +uint DistanceManhattan(TileIndex, TileIndex); // also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads) uint DistanceSquare(TileIndex, TileIndex); // euclidian- or L2-Norm squared uint DistanceMax(TileIndex, TileIndex); // also known as L-Infinity-Norm uint DistanceMaxPlusManhattan(TileIndex, TileIndex); // Max + Manhattan +uint DistanceTrack(TileIndex, TileIndex); // Returns the shortest distance one could go over tracks uint DistanceFromEdge(TileIndex); // shortest distance from any edge of the map @@ -117,4 +118,10 @@ return ToTileIndexDiff(_tileoffs_by_dir[dir]); } +/* Approximation of the length of a straight track, relative to a diagonal + * track (ie the size of a tile side). #defined instead of const so it can + * stay integer. (no runtime float operations) Is this needed? + * This value should be sqrt(2)/2 ~ 0.7071 */ +#define STRAIGHT_TRACK_LENGTH (7071/10000) + #endif