mirror of https://github.com/OpenTTD/OpenTTD
(svn r15667) -Fix (r15601)[FS#2718]: It was possible to remove rail tunnels/bridges and aqueducts build by rival companies.
parent
fa78027ffd
commit
da0cbb2a2f
|
@ -584,6 +584,8 @@ static inline bool CheckAllowRemoveTunnelBridge(TileIndex tile)
|
|||
/* Floods can remove anything as well as the scenario editor */
|
||||
if (_current_company == OWNER_WATER || _game_mode == GM_EDITOR) return true;
|
||||
|
||||
switch (GetTunnelBridgeTransportType(tile)) {
|
||||
case TRANSPORT_ROAD: {
|
||||
RoadTypes rts = GetRoadTypes(tile);
|
||||
Owner road_owner = _current_company;
|
||||
Owner tram_owner = _current_company;
|
||||
|
@ -596,6 +598,14 @@ static inline bool CheckAllowRemoveTunnelBridge(TileIndex tile)
|
|||
if (tram_owner == OWNER_NONE) tram_owner = _current_company;
|
||||
|
||||
return CheckOwnership(road_owner) && CheckOwnership(tram_owner);
|
||||
}
|
||||
|
||||
case TRANSPORT_RAIL:
|
||||
case TRANSPORT_WATER:
|
||||
return CheckOwnership(GetTileOwner(tile));
|
||||
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlag flags)
|
||||
|
|
Loading…
Reference in New Issue