diff options
author | Darkvater <darkvater@openttd.org> | 2006-09-05 23:21:41 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-09-05 23:21:41 +0000 |
commit | 80814dbb1d01f651ba7c60547dc1b52c1c209378 (patch) | |
tree | f2f14fca9ac095b0bf6b46615035b8c207e3ce66 /map.h | |
parent | 516d412a77de7fb3d2278515d59a0c46bb9b461b (diff) | |
download | openttd-80814dbb1d01f651ba7c60547dc1b52c1c209378.tar.xz |
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
DiagDirections, and add TileOffsByDir that handles Directions.
-Codechange: Make the treeloop use TileOffsByDir().
Diffstat (limited to 'map.h')
-rw-r--r-- | map.h | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -157,10 +157,19 @@ uint DistanceFromEdge(TileIndex); // shortest distance from any edge of the map } while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \ } +typedef enum DiagDirection DiagDirection; +static inline TileIndexDiff TileOffsByDiagDir(DiagDirection dir) +{ + extern const TileIndexDiffC _tileoffs_by_diagdir[4]; + + assert(dir < lengthof(_tileoffs_by_diagdir)); + return ToTileIndexDiff(_tileoffs_by_diagdir[dir]); +} -static inline TileIndexDiff TileOffsByDir(uint dir) +typedef enum Direction Direction; +static inline TileIndexDiff TileOffsByDir(Direction dir) { - extern const TileIndexDiffC _tileoffs_by_dir[4]; + extern const TileIndexDiffC _tileoffs_by_dir[8]; assert(dir < lengthof(_tileoffs_by_dir)); return ToTileIndexDiff(_tileoffs_by_dir[dir]); |