map.h
changeset 2159 f6284cf5fab0
parent 2051 e369160ce2f3
child 2186 db48cf29b983
equal deleted inserted replaced
2158:722042326977 2159:f6284cf5fab0
   144 uint DistanceMaxPlusManhattan(TileIndex, TileIndex); // Max + Manhattan
   144 uint DistanceMaxPlusManhattan(TileIndex, TileIndex); // Max + Manhattan
   145 uint DistanceTrack(TileIndex, TileIndex); // Returns the shortest distance one could go over tracks
   145 uint DistanceTrack(TileIndex, TileIndex); // Returns the shortest distance one could go over tracks
   146 uint DistanceFromEdge(TileIndex); // shortest distance from any edge of the map
   146 uint DistanceFromEdge(TileIndex); // shortest distance from any edge of the map
   147 
   147 
   148 
   148 
       
   149 #define BEGIN_TILE_LOOP(var,w,h,tile)                      \
       
   150 	{                                                        \
       
   151 		int h_cur = h;                                         \
       
   152 		uint var = tile;                                       \
       
   153 		do {                                                   \
       
   154 			int w_cur = w;                                       \
       
   155 			do {
       
   156 
       
   157 #define END_TILE_LOOP(var,w,h,tile)                        \
       
   158 			} while (++var, --w_cur != 0);                       \
       
   159 		} while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \
       
   160 	}
       
   161 
       
   162 
   149 static inline TileIndexDiff TileOffsByDir(uint dir)
   163 static inline TileIndexDiff TileOffsByDir(uint dir)
   150 {
   164 {
   151 	extern const TileIndexDiffC _tileoffs_by_dir[4];
   165 	extern const TileIndexDiffC _tileoffs_by_dir[4];
   152 
   166 
   153 	assert(dir < lengthof(_tileoffs_by_dir));
   167 	assert(dir < lengthof(_tileoffs_by_dir));