mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r6408) -Fix(r6406): compilation was broken
-Codechange: Rename TileIndexDiffCByDir to TileIndexDiffCByDiagDir because it accepts DiagDirections
This commit is contained in:
parent
3fee255543
commit
7c6851b436
14
map.h
14
map.h
|
@ -119,9 +119,11 @@ static inline TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
|
||||||
|
|
||||||
uint TileAddWrap(TileIndex tile, int addx, int addy);
|
uint TileAddWrap(TileIndex tile, int addx, int addy);
|
||||||
|
|
||||||
static inline TileIndexDiffC TileIndexDiffCByDir(uint dir) {
|
static inline TileIndexDiffC TileIndexDiffCByDiagDir(uint dir) {
|
||||||
extern const TileIndexDiffC _tileoffs_by_dir[4];
|
extern const TileIndexDiffC _tileoffs_by_diagdir[4];
|
||||||
return _tileoffs_by_dir[dir];
|
|
||||||
|
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
|
/* Returns tile + the diff given in diff. If the result tile would end up
|
||||||
|
@ -157,8 +159,7 @@ uint DistanceFromEdge(TileIndex); // shortest distance from any edge of the map
|
||||||
} while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \
|
} while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef enum DiagDirection DiagDirection;
|
static inline TileIndexDiff TileOffsByDiagDir(uint dir)
|
||||||
static inline TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
|
|
||||||
{
|
{
|
||||||
extern const TileIndexDiffC _tileoffs_by_diagdir[4];
|
extern const TileIndexDiffC _tileoffs_by_diagdir[4];
|
||||||
|
|
||||||
|
@ -166,8 +167,7 @@ static inline TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
|
||||||
return ToTileIndexDiff(_tileoffs_by_diagdir[dir]);
|
return ToTileIndexDiff(_tileoffs_by_diagdir[dir]);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef enum Direction Direction;
|
static inline TileIndexDiff TileOffsByDir(uint dir)
|
||||||
static inline TileIndexDiff TileOffsByDir(Direction dir)
|
|
||||||
{
|
{
|
||||||
extern const TileIndexDiffC _tileoffs_by_dir[8];
|
extern const TileIndexDiffC _tileoffs_by_dir[8];
|
||||||
|
|
||||||
|
|
6
npf.c
6
npf.c
|
@ -563,16 +563,16 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
|
||||||
* outside of the depot. But, because the code layout is cleaner this
|
* outside of the depot. But, because the code layout is cleaner this
|
||||||
* way, we will just pretend we are reversed already */
|
* way, we will just pretend we are reversed already */
|
||||||
src_trackdir = ReverseTrackdir(src_trackdir);
|
src_trackdir = ReverseTrackdir(src_trackdir);
|
||||||
dst_tile = AddTileIndexDiffCWrap(src_tile, TileIndexDiffCByDir(exitdir));
|
dst_tile = AddTileIndexDiffCWrap(src_tile, TileIndexDiffCByDiagDir(exitdir));
|
||||||
} else {
|
} else {
|
||||||
dst_tile = INVALID_TILE; /* Road vehicle heading inwards: dead end */
|
dst_tile = INVALID_TILE; /* Road vehicle heading inwards: dead end */
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dst_tile = AddTileIndexDiffCWrap(src_tile, TileIndexDiffCByDir(exitdir));
|
dst_tile = AddTileIndexDiffCWrap(src_tile, TileIndexDiffCByDiagDir(exitdir));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* This a normal tile, a bridge, a tunnel exit, etc. */
|
/* 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) {
|
if (dst_tile == INVALID_TILE) {
|
||||||
/* We reached the border of the map */
|
/* We reached the border of the map */
|
||||||
|
|
|
@ -169,7 +169,7 @@ struct CYapfTestBaseT
|
||||||
int z_org = Map::MapZ(x_org, y_org);
|
int z_org = Map::MapZ(x_org, y_org);
|
||||||
DiagDirection exitdir = TrackdirToExitdir(org.m_key.m_td);
|
DiagDirection exitdir = TrackdirToExitdir(org.m_key.m_td);
|
||||||
|
|
||||||
TileIndexDiffC diff = TileIndexDiffCByDir(exitdir);
|
TileIndexDiffC diff = TileIndexDiffCByDiagDir(exitdir);
|
||||||
int x_new = x_org + diff.x;
|
int x_new = x_org + diff.x;
|
||||||
int y_new = y_org + diff.y;
|
int y_new = y_org + diff.y;
|
||||||
int z_new = Map::MapZ(x_new, y_new);
|
int z_new = Map::MapZ(x_new, y_new);
|
||||||
|
|
Loading…
Reference in New Issue