src/map.h
branchnoai
changeset 9601 b499fdd106d5
parent 9476 1d1ed96f32ad
child 7036 9f23930e7ded
child 9620 31e38d28a0af
equal deleted inserted replaced
9600:59cc173953ae 9601:b499fdd106d5
   145 uint DistanceMax(TileIndex, TileIndex); ///< also known as L-Infinity-Norm
   145 uint DistanceMax(TileIndex, TileIndex); ///< also known as L-Infinity-Norm
   146 uint DistanceMaxPlusManhattan(TileIndex, TileIndex); ///< Max + Manhattan
   146 uint DistanceMaxPlusManhattan(TileIndex, TileIndex); ///< Max + Manhattan
   147 uint DistanceFromEdge(TileIndex); ///< shortest distance from any edge of the map
   147 uint DistanceFromEdge(TileIndex); ///< shortest distance from any edge of the map
   148 
   148 
   149 
   149 
   150 #define BEGIN_TILE_LOOP(var,w,h,tile)                      \
   150 #define BEGIN_TILE_LOOP(var, w, h, tile)                      \
   151 	{                                                        \
   151 	{                                                        \
   152 		int h_cur = h;                                         \
   152 		int h_cur = h;                                         \
   153 		uint var = tile;                                       \
   153 		uint var = tile;                                       \
   154 		do {                                                   \
   154 		do {                                                   \
   155 			int w_cur = w;                                       \
   155 			int w_cur = w;                                       \
   156 			do {
   156 			do {
   157 
   157 
   158 #define END_TILE_LOOP(var,w,h,tile)                        \
   158 #define END_TILE_LOOP(var, w, h, tile)                        \
   159 			} while (++var, --w_cur != 0);                       \
   159 			} while (++var, --w_cur != 0);                       \
   160 		} while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \
   160 		} while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \
   161 	}
   161 	}
   162 
   162 
   163 static inline TileIndexDiff TileOffsByDiagDir(uint dir)
   163 static inline TileIndexDiff TileOffsByDiagDir(uint dir)