Changeset - r20227:0f07e05b4228
[Not reviewed]
master
0 1 0
frosch - 11 years ago 2013-05-06 15:41:34
frosch@openttd.org
(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.
1 file changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -322,19 +322,22 @@ CommandCost CmdBuildBridge(TileIndex end
 
		/* Do not replace the bridge with the same bridge type. */
 
		if (!(flags & DC_QUERY_COST) && (bridge_type == GetBridgeType(tile_start)) && (transport_type != TRANSPORT_ROAD || (roadtypes & ~GetRoadTypes(tile_start)) == 0)) {
 
			return_cmd_error(STR_ERROR_ALREADY_BUILT);
 
		}
 

	
 
		/* 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. */
 
				pbs_reservation = HasTunnelBridgeReservation(tile_start);
 
				break;
 

	
0 comments (0 inline, 0 general)