diff options
author | tron <tron@openttd.org> | 2006-03-01 12:31:39 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-03-01 12:31:39 +0000 |
commit | 5d6ec6b4f06e9f4885ccd6db105c5978000032fb (patch) | |
tree | ed7c0e1028b849d33aeafacda8264ad370b8cbd3 /rail_cmd.c | |
parent | 7b106a3d8f2840dc9b2fc4fb9a945d4c8834046a (diff) | |
download | openttd-5d6ec6b4f06e9f4885ccd6db105c5978000032fb.tar.xz |
(svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them
Diffstat (limited to 'rail_cmd.c')
-rw-r--r-- | rail_cmd.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/rail_cmd.c b/rail_cmd.c index 6b33d4d67..22ce7cc3e 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -434,23 +434,15 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2) break; case MP_STREET: { - RoadBits bits; - if (!IsLevelCrossing(tile)) return CMD_ERROR; /* This is a crossing, let's check if the direction is correct */ - if (_m[tile].m5 & 8) { - if (track != TRACK_X) return CMD_ERROR; - bits = ROAD_Y; - } else { - if (track != TRACK_Y) return CMD_ERROR; - bits = ROAD_X; - } + if (GetCrossingRailBits(tile) != trackbit) return CMD_ERROR; if (!(flags & DC_EXEC)) return _price.remove_rail; - MakeRoadNormal(tile, _m[tile].m3, bits, 0); + MakeRoadNormal(tile, _m[tile].m3, GetCrossingRoadBits(tile), 0); break; } |