(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts

DiagDirections, and add TileOffsByDir that handles Directions.
-Codechange: Make the treeloop use TileOffsByDir().
This commit is contained in:
Darkvater
2006-09-05 23:21:41 +00:00
parent a53c92464f
commit 7e4d0f112e
29 changed files with 111 additions and 102 deletions

15
map.h
View File

@@ -157,10 +157,19 @@ uint DistanceFromEdge(TileIndex); // shortest distance from any edge of the map
} while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \
}
static inline TileIndexDiff TileOffsByDir(uint dir)
typedef enum DiagDirection DiagDirection;
static inline TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
{
extern const TileIndexDiffC _tileoffs_by_dir[4];
extern const TileIndexDiffC _tileoffs_by_diagdir[4];
assert(dir < lengthof(_tileoffs_by_diagdir));
return ToTileIndexDiff(_tileoffs_by_diagdir[dir]);
}
typedef enum Direction Direction;
static inline TileIndexDiff TileOffsByDir(Direction dir)
{
extern const TileIndexDiffC _tileoffs_by_dir[8];
assert(dir < lengthof(_tileoffs_by_dir));
return ToTileIndexDiff(_tileoffs_by_dir[dir]);