# HG changeset patch # User smatz # Date 2008-09-13 17:06:44 # Node ID f4940f705b871287fae975d743d781fd6994bd3c # Parent f89df6b20b1674f1c4d26b180b10c15d49778654 (svn r14314) -Fix: pay for two road bits when adding/removing roadtype at drive through road stop/level crossing diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -255,7 +255,8 @@ static CommandCost RemoveRoad(TileIndex } } } 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, 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, 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; }