summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-13 10:32:29 +0000
committerrubidium <rubidium@openttd.org>2008-04-13 10:32:29 +0000
commit372830b731ea067e1aedb67554362456bbf318c5 (patch)
treebaa4b98f5382e9bae086818d46ab018b1d8c6cff
parent9349767e1dd83370b81030489224b4234445ceba (diff)
downloadopenttd-372830b731ea067e1aedb67554362456bbf318c5.tar.xz
(svn r12682) -Fix [FS#1920]: removing road pieces from a town gave you twice the intended penalty.
-rw-r--r--src/road_cmd.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 09d7afc93..cd0582082 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -150,7 +150,7 @@ static bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, bool *edge_roa
* @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 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa
/* 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 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa
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 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa
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 @@ CommandCost CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint3
_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);
}