diff options
author | celestar <celestar@openttd.org> | 2006-04-07 15:57:03 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2006-04-07 15:57:03 +0000 |
commit | c0cb020c801d4f03f535faa18228eb7194bf6dc1 (patch) | |
tree | 9666f074e1b301695932ece7fdebdba4477a7b0d /station_map.h | |
parent | da095bc9412cea7ecdffffe0b561274d727b1f3b (diff) | |
download | openttd-c0cb020c801d4f03f535faa18228eb7194bf6dc1.tar.xz |
(svn r4317) -Codechange: More map accessors for ship_cmd. it is now map-access free, but still requires a huge cleanup
Diffstat (limited to 'station_map.h')
-rw-r--r-- | station_map.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/station_map.h b/station_map.h index 9ebf7803f..9c608af9b 100644 --- a/station_map.h +++ b/station_map.h @@ -184,6 +184,25 @@ static inline DiagDirection GetDockDirection(TileIndex t) return (DiagDirection)(_m[t].m5 - DOCK_BASE); } +static inline TileIndexDiffC GetDockOffset(TileIndex t) +{ + static const TileIndexDiffC buoy_offset = {0, 0}; + static const TileIndexDiffC oilrig_offset = {2, 0}; + static const TileIndexDiffC dock_offset[DIAGDIR_END] = { + {-2, 0}, + { 0, 2}, + { 2, 0}, + { 0, -2}, + }; + assert(IsTileType(t, MP_STATION)); + + if (IsBuoy_(t)) return buoy_offset; + if (IsOilRig(t)) return oilrig_offset; + + assert(IsDock(t)); + + return dock_offset[GetDockDirection(t)]; +} static inline bool IsCustomStationSprite(TileIndex t) { |