summaryrefslogtreecommitdiff
path: root/src/road_cmd.cpp
diff options
context:
space:
mode:
authorgooball <67861995+UnsuspiciousGooball@users.noreply.github.com>2021-01-05 11:45:07 +0100
committerGitHub <noreply@github.com>2021-01-05 11:45:07 +0100
commitc017a3662a1e11be5ec4ea88c916488a1e8a2bca (patch)
tree70b9a2d11ccf9fc58a84c0a1bfca1c9d15a1183c /src/road_cmd.cpp
parente21302f4811ec62a6d6abfa89ad34afba4a3ab4a (diff)
downloadopenttd-c017a3662a1e11be5ec4ea88c916488a1e8a2bca.tar.xz
Change: converting town-owned road types now require town rating (#8457)
Diffstat (limited to 'src/road_cmd.cpp')
-rw-r--r--src/road_cmd.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index d0104cb99..79048b9b5 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -2388,6 +2388,17 @@ CommandCost CmdConvertRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
}
}
+ /* Base the ability to replace town roads and bridges on the town's
+ * acceptance of destructive actions. */
+ if (owner == OWNER_TOWN) {
+ Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
+ CommandCost ret = CheckforTownRating(DC_NONE, t, tt == MP_TUNNELBRIDGE ? TUNNELBRIDGE_REMOVE : ROAD_REMOVE);
+ if (ret.Failed()) {
+ error = ret;
+ continue;
+ }
+ }
+
/* Vehicle on the tile when not converting normal <-> powered
* Tunnels and bridges have special check later */
if (tt != MP_TUNNELBRIDGE) {