diff options
author | smatz <smatz@openttd.org> | 2008-02-09 17:30:13 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-02-09 17:30:13 +0000 |
commit | e3301db2134fca18c2dfabe782b4b8a55b0cc0ae (patch) | |
tree | e6417e0b62166f7f70376d52251478b4877f5d00 /src/water_cmd.cpp | |
parent | 802c94975523114d472cc2c37ccd858d3e6358a2 (diff) | |
download | openttd-e3301db2134fca18c2dfabe782b4b8a55b0cc0ae.tar.xz |
(svn r12095) -Fix [FS#1703]: when a company bankrupts, remove drive-through road stops, ship depots and buoys too. Update owners of water and road.
Diffstat (limited to 'src/water_cmd.cpp')
-rw-r--r-- | src/water_cmd.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 5f316dac2..99141d795 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -220,15 +220,15 @@ void MakeWaterKeepingClass(TileIndex tile, Owner o) static CommandCost RemoveShipDepot(TileIndex tile, uint32 flags) { - TileIndex tile2; - if (!IsShipDepot(tile)) return CMD_ERROR; if (!CheckTileOwnership(tile)) return CMD_ERROR; - if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR; - tile2 = GetOtherShipDepotTile(tile); + TileIndex tile2 = GetOtherShipDepotTile(tile); - if (!EnsureNoVehicleOnGround(tile2)) return CMD_ERROR; + /* do not check for ship on tile when company goes bankrupt */ + if (!(flags & DC_BANKRUPT)) { + if (!EnsureNoVehicleOnGround(tile) || !EnsureNoVehicleOnGround(tile2)) return CMD_ERROR; + } if (flags & DC_EXEC) { /* Kill the depot, which is registered at the northernmost tile. Use that one */ @@ -1139,11 +1139,15 @@ static void ChangeTileOwner_Water(TileIndex tile, PlayerID old_player, PlayerID if (new_player != PLAYER_SPECTATOR) { SetTileOwner(tile, new_player); - } else if (IsShipDepot(tile)) { - DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR); - } else { - SetTileOwner(tile, OWNER_NONE); + return; } + + /* Remove depot */ + if (IsShipDepot(tile)) DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR); + + /* Set owner of canals and locks ... and also canal under dock there was before. + * Check if the new owner after removing depot isn't OWNER_WATER. */ + if (IsTileOwner(tile, old_player)) SetTileOwner(tile, OWNER_NONE); } static VehicleEnterTileStatus VehicleEnter_Water(Vehicle *v, TileIndex tile, int x, int y) |