summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-05-06 15:41:34 +0000
committerfrosch <frosch@openttd.org>2013-05-06 15:41:34 +0000
commitd3b9a5553551a54995a88085ba2a96c6c2997dfe (patch)
tree1b8ba59500509773ff89dde602c08d8b214969b4 /src
parent266bdfaffe9727afafcec21f2d2fddc8900e1575 (diff)
downloadopenttd-d3b9a5553551a54995a88085ba2a96c6c2997dfe.tar.xz
(svn r25227) -Fix [FS#5541]: Give bridges owned by noone (from bankrupt companies) to the first company which replaces the bridge. Everyone could have removed/rebuild the bridge anyway.
Diffstat (limited to 'src')
-rw-r--r--src/tunnelbridge_cmd.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 1abb0c1a7..2eae016c9 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -325,13 +325,16 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u
}
/* Do not allow replacing another company's bridges. */
- if (!IsTileOwner(tile_start, company) && !IsTileOwner(tile_start, OWNER_TOWN)) {
+ if (!IsTileOwner(tile_start, company) && !IsTileOwner(tile_start, OWNER_TOWN) && !IsTileOwner(tile_start, OWNER_NONE)) {
return_cmd_error(STR_ERROR_AREA_IS_OWNED_BY_ANOTHER);
}
cost.AddCost((bridge_len + 1) * _price[PR_CLEAR_BRIDGE]); // The cost of clearing the current bridge.
owner = GetTileOwner(tile_start);
+ /* If bridge belonged to bankrupt company, it has a new owner now */
+ if (owner == OWNER_NONE) owner = company;
+
switch (transport_type) {
case TRANSPORT_RAIL:
/* Keep the reservation, the path stays valid. */