diff options
author | celestar <celestar@openttd.org> | 2006-03-30 11:11:35 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2006-03-30 11:11:35 +0000 |
commit | 24f23babd1f2933cb9ffcac1a442aee8e5862d83 (patch) | |
tree | 651dad6adb2d1f363f68c63e2cbaca3a50ec7fb2 /water_map.h | |
parent | ac7c9b6051aef798018cb3bea820eb1e611b0994 (diff) | |
download | openttd-24f23babd1f2933cb9ffcac1a442aee8e5862d83.tar.xz |
(svn r4171) -Codechange: Create map accessor functions for creating ship depots and locks. Make use of them
Diffstat (limited to 'water_map.h')
-rw-r--r-- | water_map.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/water_map.h b/water_map.h index 123e96ae2..2cb884ab7 100644 --- a/water_map.h +++ b/water_map.h @@ -3,6 +3,17 @@ #ifndef WATER_MAP_H #define WATER_MAP_H +typedef enum DepotPart { + DEPOT_NORTH = 0x80, + DEPOT_SOUTH = 0x81 +} DepotPart; + +typedef enum LockPart { + LOCK_MIDDLE = 0x10, + LOCK_LOWER = 0x14, + LOCK_UPPER = 0x18 +} LockPart; + static inline void MakeWater(TileIndex t) { SetTileType(t, MP_WATER); @@ -24,4 +35,33 @@ static inline void MakeShore(TileIndex t) _m[t].m5 = 1; } +static inline void MakeShipDepot(TileIndex t, Owner o, DepotPart base, Axis a) +{ + SetTileType(t, MP_WATER); + SetTileOwner(t, o); + _m[t].m2 = 0; + _m[t].m3 = 0; + _m[t].m4 = 0; + _m[t].m5 = base + a * 2; +} + +static inline void MakeLockTile(TileIndex t, byte section) +{ + SetTileType(t, MP_WATER); + SetTileOwner(t, OWNER_WATER); + _m[t].m2 = 0; + _m[t].m3 = 0; + _m[t].m4 = 0; + _m[t].m5 = section; +} + +static inline void MakeLock(TileIndex t, DiagDirection d) +{ + TileIndexDiff delta = TileOffsByDir(d); + + MakeLockTile(t, LOCK_MIDDLE + d); + MakeLockTile(t - delta, LOCK_LOWER + d); + MakeLockTile(t + delta, LOCK_UPPER + d); +} + #endif |