From 2f8e3dcc05eea3bedbfcbf3e8bedaf7f64dc9cc3 Mon Sep 17 00:00:00 2001 From: tron Date: Thu, 23 Feb 2006 08:20:28 +0000 Subject: (svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces --- rail_cmd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'rail_cmd.c') 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); -- cgit v1.2.3-54-g00ecf