Mercurial > hg > openttd
changeset 4561:7ca58c99be00 draft
(svn r6408) -Fix(r6406): compilation was broken
-Codechange: Rename TileIndexDiffCByDir to TileIndexDiffCByDiagDir because it accepts DiagDirections
author | glx <glx@openttd.org> |
---|---|
date | Wed, 06 Sep 2006 01:56:01 +0000 |
parents | 685eb4d177a9 |
children | bb1a62b6e4f3 |
files | map.h npf.c yapf/unittest/test_yapf.h |
diffstat | 3 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/map.h +++ b/map.h @@ -119,9 +119,11 @@ uint TileAddWrap(TileIndex tile, int addx, int addy); -static inline TileIndexDiffC TileIndexDiffCByDir(uint dir) { - extern const TileIndexDiffC _tileoffs_by_dir[4]; - return _tileoffs_by_dir[dir]; +static inline TileIndexDiffC TileIndexDiffCByDiagDir(uint dir) { + extern const TileIndexDiffC _tileoffs_by_diagdir[4]; + + assert(dir < lengthof(_tileoffs_by_diagdir)); + return _tileoffs_by_diagdir[dir]; } /* Returns tile + the diff given in diff. If the result tile would end up @@ -157,8 +159,7 @@ } while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \ } -typedef enum DiagDirection DiagDirection; -static inline TileIndexDiff TileOffsByDiagDir(DiagDirection dir) +static inline TileIndexDiff TileOffsByDiagDir(uint dir) { extern const TileIndexDiffC _tileoffs_by_diagdir[4]; @@ -166,8 +167,7 @@ return ToTileIndexDiff(_tileoffs_by_diagdir[dir]); } -typedef enum Direction Direction; -static inline TileIndexDiff TileOffsByDir(Direction dir) +static inline TileIndexDiff TileOffsByDir(uint dir) { extern const TileIndexDiffC _tileoffs_by_dir[8];
--- a/npf.c +++ b/npf.c @@ -563,16 +563,16 @@ * outside of the depot. But, because the code layout is cleaner this * way, we will just pretend we are reversed already */ src_trackdir = ReverseTrackdir(src_trackdir); - dst_tile = AddTileIndexDiffCWrap(src_tile, TileIndexDiffCByDir(exitdir)); + dst_tile = AddTileIndexDiffCWrap(src_tile, TileIndexDiffCByDiagDir(exitdir)); } else { dst_tile = INVALID_TILE; /* Road vehicle heading inwards: dead end */ } } else { - dst_tile = AddTileIndexDiffCWrap(src_tile, TileIndexDiffCByDir(exitdir)); + dst_tile = AddTileIndexDiffCWrap(src_tile, TileIndexDiffCByDiagDir(exitdir)); } } else { /* This a normal tile, a bridge, a tunnel exit, etc. */ - dst_tile = AddTileIndexDiffCWrap(src_tile, TileIndexDiffCByDir(TrackdirToExitdir(src_trackdir))); + dst_tile = AddTileIndexDiffCWrap(src_tile, TileIndexDiffCByDiagDir(TrackdirToExitdir(src_trackdir))); } if (dst_tile == INVALID_TILE) { /* We reached the border of the map */
--- a/yapf/unittest/test_yapf.h +++ b/yapf/unittest/test_yapf.h @@ -169,7 +169,7 @@ int z_org = Map::MapZ(x_org, y_org); DiagDirection exitdir = TrackdirToExitdir(org.m_key.m_td); - TileIndexDiffC diff = TileIndexDiffCByDir(exitdir); + TileIndexDiffC diff = TileIndexDiffCByDiagDir(exitdir); int x_new = x_org + diff.x; int y_new = y_org + diff.y; int z_new = Map::MapZ(x_new, y_new);