summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-09-13 17:26:44 +0000
committersmatz <smatz@openttd.org>2008-09-13 17:26:44 +0000
commitc4d49dfc2115ff1c857c7f676a4bdacdfcf94ffa (patch)
tree7a288207bcd3568a036e2127ca18497653ee1523 /src
parentd5ca29a5ab286825ed4bb2f6939ed2d51d483f41 (diff)
downloadopenttd-c4d49dfc2115ff1c857c7f676a4bdacdfcf94ffa.tar.xz
(svn r14315) -Fix: allow adding roadtypes only to drive-through road stops
Diffstat (limited to 'src')
-rw-r--r--src/road_cmd.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index cc0a092ac..6d1d878c6 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -576,17 +576,14 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return CommandCost(EXPENSES_CONSTRUCTION, _price.build_road * (rt == ROADTYPE_ROAD ? 2 : 4));
}
- case MP_STATION:
- if (!IsRoadStop(tile)) goto do_clear;
- if (IsDriveThroughStopTile(tile)) {
- RoadBits curbits = AxisToRoadBits(DiagDirToAxis(GetRoadStopDir(tile)));
- if (pieces & ~curbits) goto do_clear;
- pieces = curbits; // we need to pay for both roadbits
- } else {
- if (pieces & ~DiagDirToRoadBits(GetRoadStopDir(tile))) goto do_clear;
- }
+ case MP_STATION: {
+ if (!IsDriveThroughStopTile(tile)) goto do_clear;
if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
- break;
+
+ RoadBits curbits = AxisToRoadBits(DiagDirToAxis(GetRoadStopDir(tile)));
+ if (pieces & ~curbits) goto do_clear;
+ pieces = curbits; // we need to pay for both roadbits
+ } break;
case MP_TUNNELBRIDGE:
if (GetTunnelBridgeTransportType(tile) != TRANSPORT_ROAD) return CMD_ERROR;
@@ -674,8 +671,9 @@ do_clear:;
} break;
case MP_STATION:
+ assert(IsDriveThroughStopTile(tile));
SetRoadTypes(tile, GetRoadTypes(tile) | RoadTypeToRoadTypes(rt));
- if (IsDriveThroughStopTile(tile) && rt == ROADTYPE_ROAD) SetStopBuiltOnTownRoad(tile, false);
+ if (rt == ROADTYPE_ROAD) SetStopBuiltOnTownRoad(tile, false);
break;
default: