changeset 20282:97631b9c5cd4 draft

(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.
author frosch <frosch@openttd.org>
date Mon, 06 May 2013 15:41:34 +0000
parents 16fcc6f376f3
children 230dd2200d03
files src/tunnelbridge_cmd.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -325,13 +325,16 @@
 		}
 
 		/* 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. */