src/map.h
changeset 6571 6a8a1d0835d9
parent 6540 d30795308feb
child 7317 e61af9d8a2b3
equal deleted inserted replaced
6570:0db336a1b931 6571:6a8a1d0835d9
   207 		return INVALID_TILE;
   207 		return INVALID_TILE;
   208 	else
   208 	else
   209 		return TileXY(x, y);
   209 		return TileXY(x, y);
   210 }
   210 }
   211 
   211 
       
   212 /**
       
   213  * Returns the diff between two tiles
       
   214  *
       
   215  * @param tile_a from tile
       
   216  * @param tile_b to tile
       
   217  * @return the difference between tila_a and tile_b
       
   218  */
       
   219 static inline TileIndexDiffC TileIndexToTileIndexDiffC(TileIndex tile_a, TileIndex tile_b)
       
   220 {
       
   221 	TileIndexDiffC difference;
       
   222 
       
   223 	difference.x = TileX(tile_a) - TileX(tile_b);
       
   224 	difference.y = TileY(tile_a) - TileY(tile_b);
       
   225 
       
   226 	return difference;
       
   227 }
       
   228 
   212 /* Functions to calculate distances */
   229 /* Functions to calculate distances */
   213 uint DistanceManhattan(TileIndex, TileIndex); ///< also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads)
   230 uint DistanceManhattan(TileIndex, TileIndex); ///< also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads)
   214 uint DistanceSquare(TileIndex, TileIndex); ///< euclidian- or L2-Norm squared
   231 uint DistanceSquare(TileIndex, TileIndex); ///< euclidian- or L2-Norm squared
   215 uint DistanceMax(TileIndex, TileIndex); ///< also known as L-Infinity-Norm
   232 uint DistanceMax(TileIndex, TileIndex); ///< also known as L-Infinity-Norm
   216 uint DistanceMaxPlusManhattan(TileIndex, TileIndex); ///< Max + Manhattan
   233 uint DistanceMaxPlusManhattan(TileIndex, TileIndex); ///< Max + Manhattan