summaryrefslogtreecommitdiff
path: root/rail_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-02-23 08:20:28 +0000
committertron <tron@openttd.org>2006-02-23 08:20:28 +0000
commit2f8e3dcc05eea3bedbfcbf3e8bedaf7f64dc9cc3 (patch)
tree902fe3272275a4a3b554d21b247e7f5811687ebe /rail_cmd.c
parentd239ec0e967b3f078c1c09cdd9fae05c0771e840 (diff)
downloadopenttd-2f8e3dcc05eea3bedbfcbf3e8bedaf7f64dc9cc3.tar.xz
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
Diffstat (limited to 'rail_cmd.c')
-rw-r--r--rail_cmd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 6db554fdb..e166c2290 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -4,6 +4,7 @@
#include "openttd.h"
#include "debug.h"
#include "functions.h"
+#include "road.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "map.h"
@@ -348,9 +349,9 @@ int32 CmdBuildSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
if (!EnsureNoVehicle(tile)) return CMD_ERROR;
- if ((m5 & 0xF0) == 0 && ( // normal road?
- (track == TRACK_DIAG1 && m5 == 0x05) ||
- (track == TRACK_DIAG2 && m5 == 0x0A) // correct direction?
+ if (GetRoadType(tile) == ROAD_NORMAL && (
+ (track == TRACK_DIAG1 && m5 == ROAD_Y) ||
+ (track == TRACK_DIAG2 && m5 == ROAD_X) // correct direction?
)) {
if (flags & DC_EXEC) {
_m[tile].m3 = GetTileOwner(tile);