summaryrefslogtreecommitdiff
path: root/water_map.h
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-03-30 11:21:36 +0000
committercelestar <celestar@openttd.org>2006-03-30 11:21:36 +0000
commit75f0e6f19415da0b14577c78b81f25122055f05b (patch)
tree8a7519f158d00865e8aeaa2bd60fa287456478fc /water_map.h
parent06ae3f8ee17d73b70d40cc60cb1cc79ed4a309f6 (diff)
downloadopenttd-75f0e6f19415da0b14577c78b81f25122055f05b.tar.xz
(svn r4172) -Codechange: Added a few accessors to work with ShipDepots and Locks
Diffstat (limited to 'water_map.h')
-rw-r--r--water_map.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/water_map.h b/water_map.h
index 2cb884ab7..8fbc770f1 100644
--- a/water_map.h
+++ b/water_map.h
@@ -5,7 +5,8 @@
typedef enum DepotPart {
DEPOT_NORTH = 0x80,
- DEPOT_SOUTH = 0x81
+ DEPOT_SOUTH = 0x81,
+ DEPOT_END = 0x84,
} DepotPart;
typedef enum LockPart {
@@ -14,6 +15,30 @@ typedef enum LockPart {
LOCK_UPPER = 0x18
} LockPart;
+static inline bool IsClearWaterTile(TileIndex tile)
+{
+ return
+ IsTileType(tile, MP_WATER) &&
+ _m[tile].m5 == 0 &&
+ GetTileSlope(tile, NULL) == 0;
+}
+
+static inline TileIndex GetOtherShipDepotTile(TileIndex t)
+{
+ return t + (HASBIT(_m[t].m5, 0) ? -1 : 1) * (HASBIT(_m[t].m5, 1) ? TileDiffXY(0, 1) : TileDiffXY(1, 0));
+}
+
+static inline TileIndex IsShipDepot(TileIndex t)
+{
+ return IS_INT_INSIDE(_m[t].m5, DEPOT_NORTH, DEPOT_END);
+}
+
+static inline DiagDirection GetLockDirection(TileIndex t)
+{
+ return (DiagDirection)GB(_m[t].m5, 0, 2);
+}
+
+
static inline void MakeWater(TileIndex t)
{
SetTileType(t, MP_WATER);
@@ -24,7 +49,6 @@ static inline void MakeWater(TileIndex t)
_m[t].m5 = 0;
}
-
static inline void MakeShore(TileIndex t)
{
SetTileType(t, MP_WATER);