summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rail_cmd.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index f27aa877b..8a15808c2 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -485,31 +485,31 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
RoadTypes roadtypes = GetRoadTypes(tile);
RoadBits road = GetRoadBits(tile, ROADTYPE_ROAD);
RoadBits tram = GetRoadBits(tile, ROADTYPE_TRAM);
- switch (roadtypes) {
- default: break;
- case ROADTYPES_TRAM:
- /* Tram crossings must always have road. */
- if (flags & DC_EXEC) {
- SetRoadOwner(tile, ROADTYPE_ROAD, _current_company);
- Company *c = Company::GetIfValid(_current_company);
- if (c != NULL) {
- /* A full diagonal tile has two road bits. */
- c->infrastructure.road[ROADTYPE_ROAD] += 2;
- DirtyCompanyInfrastructureWindows(c->index);
+ if ((track == TRACK_X && (road | tram) == ROAD_Y) ||
+ (track == TRACK_Y && (road | tram) == ROAD_X)) {
+ switch (roadtypes) {
+ default: break;
+ case ROADTYPES_TRAM:
+ /* Tram crossings must always have road. */
+ if (flags & DC_EXEC) {
+ SetRoadOwner(tile, ROADTYPE_ROAD, _current_company);
+ Company *c = Company::GetIfValid(_current_company);
+ if (c != NULL) {
+ /* A full diagonal tile has two road bits. */
+ c->infrastructure.road[ROADTYPE_ROAD] += 2;
+ DirtyCompanyInfrastructureWindows(c->index);
+ }
}
- }
- roadtypes |= ROADTYPES_ROAD;
- break;
+ roadtypes |= ROADTYPES_ROAD;
+ break;
- case ROADTYPES_ALL:
- if (road != tram) return CMD_ERROR;
- break;
- }
+ case ROADTYPES_ALL:
+ if (road != tram) return CMD_ERROR;
+ break;
+ }
- road |= tram;
+ road |= tram;
- if ((track == TRACK_X && road == ROAD_Y) ||
- (track == TRACK_Y && road == ROAD_X)) {
if (flags & DC_EXEC) {
MakeRoadCrossing(tile, GetRoadOwner(tile, ROADTYPE_ROAD), GetRoadOwner(tile, ROADTYPE_TRAM), _current_company, (track == TRACK_X ? AXIS_Y : AXIS_X), railtype, roadtypes, GetTownIndex(tile));
UpdateLevelCrossing(tile, false);