Mercurial > hg > openttd
changeset 8912:7a72608476a7 draft
(svn r12682) -Fix [FS#1920]: removing road pieces from a town gave you twice the intended penalty.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sun, 13 Apr 2008 10:32:29 +0000 |
parents | 72fcd1140679 |
children | bd23b0133bdf |
files | src/road_cmd.cpp |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -150,7 +150,7 @@ * @param rt roadtype to remove * @param crossing_check should we check if there is a tram track when we are removing road from crossing? */ -static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, RoadType rt, bool crossing_check) +static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, RoadType rt, bool crossing_check, bool town_check = true) { /* cost for removing inner/edge -roads */ static const uint16 road_remove_cost[2] = {50, 18}; @@ -188,7 +188,7 @@ /* check if you're allowed to remove the street owned by a town * removal allowance depends on difficulty setting */ - if (!CheckforTownRating(flags, t, ROAD_REMOVE)) return CMD_ERROR; + if (town_check && !CheckforTownRating(flags, t, ROAD_REMOVE)) return CMD_ERROR; if (!IsTileType(tile, MP_ROAD)) { /* If it's the last roadtype, just clear the whole tile */ @@ -254,7 +254,7 @@ return CMD_ERROR; } - ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM); + if (town_check) ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM); if (flags & DC_EXEC) { if (present == ROAD_NONE) { RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt)); @@ -291,7 +291,7 @@ if (rt == ROADTYPE_ROAD && HasTileRoadType(tile, ROADTYPE_TRAM) && (flags & DC_EXEC || crossing_check)) return CMD_ERROR; if (rt == ROADTYPE_ROAD) { - ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM); + if (town_check) ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM); } if (flags & DC_EXEC) { @@ -768,7 +768,7 @@ _additional_cash_required = DoCommand(end_tile, start_tile, p2, flags & ~DC_EXEC, CMD_REMOVE_LONG_ROAD).GetCost(); return cost; } - RemoveRoad(tile, flags, bits, rt, true); + RemoveRoad(tile, flags, bits, rt, true, false); } cost.AddCost(ret); }