Mercurial > hg > openttd
changeset 7270:f3e4aa684b21 draft
(svn r10593) -Fix [FS#1038]: one could not remove locks that were build in a (very) old version of OpenTTD.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Mon, 16 Jul 2007 21:00:40 +0000 |
parents | 02970ab71491 |
children | e8d9809b864e |
files | src/openttd.cpp src/water_cmd.cpp |
diffstat | 2 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -2086,6 +2086,16 @@ FOR_ALL_INDUSTRIES(i) i->founder = OWNER_NONE; } + if (CheckSavegameVersion(72)) { + /* Locks/shiplifts in very old savegames had OWNER_WATER as owner */ + for (TileIndex t = 0; t < MapSize(); t++) { + if (IsTileType(t, MP_WATER) && GetWaterTileType(t) == WATER_TILE_LOCK && + GetTileOwner(t) == OWNER_WATER) { + SetTileOwner(t, OWNER_NONE); + } + } + } + /* Recalculate */ Group *g; FOR_ALL_GROUPS(g) {
--- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -169,7 +169,7 @@ { TileIndexDiff delta = TileOffsByDiagDir(GetLockDirection(tile)); - if (!CheckTileOwnership(tile)) return CMD_ERROR; + if (!CheckTileOwnership(tile) && GetTileOwner(tile) != OWNER_NONE) return CMD_ERROR; /* make sure no vehicle is on the tile. */ if (!EnsureNoVehicle(tile) || !EnsureNoVehicle(tile + delta) || !EnsureNoVehicle(tile - delta)) @@ -296,7 +296,7 @@ return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP); } - if (GetTileOwner(tile) != OWNER_WATER && !CheckTileOwnership(tile)) return CMD_ERROR; + if (GetTileOwner(tile) != OWNER_WATER && GetTileOwner(tile) != OWNER_NONE && !CheckTileOwnership(tile)) return CMD_ERROR; if (flags & DC_EXEC) DoClearSquare(tile); return CommandCost(_price.clear_water); @@ -798,8 +798,10 @@ if (new_player != PLAYER_SPECTATOR) { SetTileOwner(tile, new_player); + } else if (IsShipDepot(tile)) { + DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); } else { - DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR); + SetTileOwner(tile, OWNER_NONE); } }