summaryrefslogtreecommitdiff
path: root/src/road_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-09-13 17:06:44 +0000
committersmatz <smatz@openttd.org>2008-09-13 17:06:44 +0000
commit33e46bb75a81bb1675b301c36d3ea8544540f4a6 (patch)
tree2dafff0f48404cef3cd9ffafe030f70d8c64217e /src/road_cmd.cpp
parent869e90ea8643edec7df8c4b5ab94c717fcdb6cc8 (diff)
downloadopenttd-33e46bb75a81bb1675b301c36d3ea8544540f4a6.tar.xz
(svn r14314) -Fix: pay for two road bits when adding/removing roadtype at drive through road stop/level crossing
Diffstat (limited to 'src/road_cmd.cpp')
-rw-r--r--src/road_cmd.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 900dbbd1a..cc0a092ac 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -255,7 +255,8 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa
}
}
} else {
- cost.AddCost(_price.remove_road);
+ assert(IsDriveThroughStopTile(tile));
+ cost.AddCost(_price.remove_road * 2);
if (flags & DC_EXEC) {
SetRoadTypes(tile, GetRoadTypes(tile) & ~RoadTypeToRoadTypes(rt));
MarkTileDirtyByTile(tile);
@@ -525,6 +526,7 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
other_bits = GetCrossingRoadBits(tile);
if (pieces & ComplementRoadBits(other_bits)) goto do_clear;
+ pieces = other_bits; // we need to pay for both roadbits
break;
default:
@@ -577,7 +579,9 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
case MP_STATION:
if (!IsRoadStop(tile)) goto do_clear;
if (IsDriveThroughStopTile(tile)) {
- if (pieces & ~AxisToRoadBits(DiagDirToAxis(GetRoadStopDir(tile)))) goto do_clear;
+ 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;
}