water_cmd.c
changeset 3267 591027d10884
parent 3234 986c30171e92
child 3268 0ee220b09578
--- a/water_cmd.c	Sun Mar 19 09:01:40 2006 +0000
+++ b/water_cmd.c	Sun Mar 19 12:06:12 2006 +0000
@@ -519,14 +519,21 @@
 		// make coast..
 		switch (GetTileType(target)) {
 			case MP_RAILWAY: {
-				uint slope = GetTileSlope(target, NULL);
-				byte tracks = GB(_m[target].m5, 0, 6);
+				TrackBits tracks;
+				uint slope;
+
+				if (!IsPlainRailTile(tile)) break;
+
+				tracks = GetTrackBits(target);
+				slope = GetTileSlope(target, NULL);
 				if (!(
-						(slope == 1 && tracks == 0x20) ||
-						(slope == 2 && tracks == 0x04) ||
-						(slope == 4 && tracks == 0x10) ||
-						(slope == 8 && tracks == 0x08)))
+							(slope == 1 && tracks == TRACK_BIT_RIGHT) &&
+							(slope == 2 && tracks == TRACK_BIT_UPPER) &&
+							(slope == 4 && tracks == TRACK_BIT_LEFT)  &&
+							(slope == 8 && tracks == TRACK_BIT_LOWER)
+						)) {
 					break;
+				}
 			}
 			/* FALLTHROUGH */