summaryrefslogtreecommitdiff
path: root/road_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-01 15:03:47 +0000
committertron <tron@openttd.org>2006-03-01 15:03:47 +0000
commitb2c5ecaa22c0600a68530d3b89347ab0f7903a4e (patch)
tree6a08123babc98600805351f0c8e91395c4ae3da0 /road_cmd.c
parent5d6ec6b4f06e9f4885ccd6db105c5978000032fb (diff)
downloadopenttd-b2c5ecaa22c0600a68530d3b89347ab0f7903a4e.tar.xz
(svn r3699) Replace some magic numbers for checking for a suitable slope for a level crossing by some less magic numbers
Diffstat (limited to 'road_cmd.c')
-rw-r--r--road_cmd.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/road_cmd.c b/road_cmd.c
index b48b1803f..3c2fd26a6 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -261,7 +261,7 @@ return_error:;
}
-static const RoadBits _valid_tileh_slopes_road[3][15] = {
+static const RoadBits _valid_tileh_slopes_road[][15] = {
// set of normal ones
{
ROAD_ALL, 0, 0,
@@ -291,14 +291,6 @@ static const RoadBits _valid_tileh_slopes_road[3][15] = {
ROAD_ALL,
ROAD_ALL
},
- // valid railway crossings on slopes
- {
- 1, 0, 0, // 0, 1, 2
- 0, 0, 1, // 3, 4, 5
- 0, 1, 0, // 6, 7, 8
- 0, 1, 1, // 9, 10, 11
- 0, 1, 1, // 12, 13, 14
- }
};
@@ -383,9 +375,12 @@ int32 CmdBuildRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
}
- if (!_valid_tileh_slopes_road[2][ti.tileh]) { // prevent certain slopes
+#define M(x) (1 << (x))
+ /* Level crossings may only be built on these slopes */
+ if (!HASBIT(M(14) | M(13) | M(11) | M(10) | M(7) | M(5) | M(0), ti.tileh)) {
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
}
+#undef M
if (ti.map5 == 2) {
if (pieces & ROAD_Y) goto do_clear;