summaryrefslogtreecommitdiff
path: root/src/clear_map.h
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-11-08 19:48:47 +0000
committeryexo <yexo@openttd.org>2011-11-08 19:48:47 +0000
commit5c838ff1c312c240e44bb7da95e5450bcfeaeff6 (patch)
tree0a1e0902aa4874cfbe77fe3c07620e41c3fba28a /src/clear_map.h
parent704dcc0a475e1361a913a43ae0b5d601dde807cc (diff)
downloadopenttd-5c838ff1c312c240e44bb7da95e5450bcfeaeff6.tar.xz
(svn r23168) -Feature [FS#1824]: always draw fences around field tiles
Diffstat (limited to 'src/clear_map.h')
-rw-r--r--src/clear_map.h66
1 files changed, 58 insertions, 8 deletions
diff --git a/src/clear_map.h b/src/clear_map.h
index 8a346fd4e..293b7970f 100644
--- a/src/clear_map.h
+++ b/src/clear_map.h
@@ -216,12 +216,12 @@ static inline void SetIndustryIndexOfField(TileIndex t, IndustryID i)
/**
* Is there a fence at the south eastern border?
* @param t the tile to check for fences
- * @pre IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES)
+ * @pre IsClearGround(t, CLEAR_FIELDS)
* @return 0 if there is no fence, otherwise the fence type
*/
static inline uint GetFenceSE(TileIndex t)
{
- assert(IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES));
+ assert(IsClearGround(t, CLEAR_FIELDS));
return GB(_m[t].m4, 2, 3);
}
@@ -230,23 +230,23 @@ static inline uint GetFenceSE(TileIndex t)
* eastern border.
* @param t the tile to check for fences
* @param h 0 if there is no fence, otherwise the fence type
- * @pre IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES)
+ * @pre IsClearGround(t, CLEAR_FIELDS)
*/
static inline void SetFenceSE(TileIndex t, uint h)
{
- assert(IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES)); // XXX incomplete
+ assert(IsClearGround(t, CLEAR_FIELDS));
SB(_m[t].m4, 2, 3, h);
}
/**
* Is there a fence at the south western border?
* @param t the tile to check for fences
- * @pre IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES)
+ * @pre IsClearGround(t, CLEAR_FIELDS)
* @return 0 if there is no fence, otherwise the fence type
*/
static inline uint GetFenceSW(TileIndex t)
{
- assert(IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES));
+ assert(IsClearGround(t, CLEAR_FIELDS));
return GB(_m[t].m4, 5, 3);
}
@@ -255,14 +255,64 @@ static inline uint GetFenceSW(TileIndex t)
* western border.
* @param t the tile to check for fences
* @param h 0 if there is no fence, otherwise the fence type
- * @pre IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES)
+ * @pre IsClearGround(t, CLEAR_FIELDS)
*/
static inline void SetFenceSW(TileIndex t, uint h)
{
- assert(IsTileType(t, MP_CLEAR) || IsTileType(t, MP_TREES)); // XXX incomplete
+ assert(IsClearGround(t, CLEAR_FIELDS));
SB(_m[t].m4, 5, 3, h);
}
+/**
+ * Is there a fence at the north eastern border?
+ * @param t the tile to check for fences
+ * @pre IsClearGround(t, CLEAR_FIELDS)
+ * @return 0 if there is no fence, otherwise the fence type
+ */
+static inline uint GetFenceNE(TileIndex t)
+{
+ assert(IsClearGround(t, CLEAR_FIELDS));
+ return GB(_m[t].m3, 5, 3);
+}
+
+/**
+ * Sets the type of fence (and whether there is one) for the north
+ * eastern border.
+ * @param t the tile to check for fences
+ * @param h 0 if there is no fence, otherwise the fence type
+ * @pre IsClearGround(t, CLEAR_FIELDS)
+ */
+static inline void SetFenceNE(TileIndex t, uint h)
+{
+ assert(IsClearGround(t, CLEAR_FIELDS));
+ SB(_m[t].m3, 5, 3, h);
+}
+
+/**
+ * Is there a fence at the north western border?
+ * @param t the tile to check for fences
+ * @pre IsClearGround(t, CLEAR_FIELDS)
+ * @return 0 if there is no fence, otherwise the fence type
+ */
+static inline uint GetFenceNW(TileIndex t)
+{
+ assert(IsClearGround(t, CLEAR_FIELDS));
+ return GB(_m[t].m6, 2, 3);
+}
+
+/**
+ * Sets the type of fence (and whether there is one) for the north
+ * western border.
+ * @param t the tile to check for fences
+ * @param h 0 if there is no fence, otherwise the fence type
+ * @pre IsClearGround(t, CLEAR_FIELDS)
+ */
+static inline void SetFenceNW(TileIndex t, uint h)
+{
+ assert(IsClearGround(t, CLEAR_FIELDS));
+ SB(_m[t].m6, 2, 3, h);
+}
+
/**
* Make a clear tile.