diff options
Diffstat (limited to 'src/map_func.h')
-rw-r--r-- | src/map_func.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/map_func.h b/src/map_func.h index 4687668a2..dc40b1011 100644 --- a/src/map_func.h +++ b/src/map_func.h @@ -244,6 +244,20 @@ static inline TileIndexDiffC TileIndexDiffCByDiagDir(DiagDirection dir) } /** + * Returns the TileIndexDiffC offset from a Direction. + * + * @param dir The given direction + * @return The offset as TileIndexDiffC value + */ +static inline TileIndexDiffC TileIndexDiffCByDir(Direction dir) +{ + extern const TileIndexDiffC _tileoffs_by_dir[DIR_END]; + + assert(IsValidDirection(dir)); + return _tileoffs_by_dir[dir]; +} + +/** * Add a TileIndexDiffC to a TileIndex and returns the new one. * * Returns tile + the diff given in diff. If the result tile would end up |