diff -r 2c40faeef7a5 -r 889301acc299 src/openttd.cpp --- a/src/openttd.cpp Sun Feb 03 01:34:21 2008 +0000 +++ b/src/openttd.cpp Sun Feb 03 20:34:26 2008 +0000 @@ -78,6 +78,7 @@ #include "tree_map.h" #include "tunnelbridge_map.h" #include "void_map.h" +#include "water.h" #include @@ -1716,8 +1717,8 @@ case MP_TUNNELBRIDGE: /* Middle part of "old" bridges */ - if (old_bridge && IsBridgeTile(t) && HasBit(_m[t].m5, 6)) break; - if ((IsTunnel(t) ? GetTunnelBridgeTransportType(t) : (old_bridge ? (TransportType)GB(_m[t].m5, 1, 2) : GetTunnelBridgeTransportType(t))) == TRANSPORT_ROAD) { + if (old_bridge && IsBridge(t) && HasBit(_m[t].m5, 6)) break; + if (((old_bridge && IsBridge(t)) ? (TransportType)GB(_m[t].m5, 1, 2) : GetTunnelBridgeTransportType(t)) == TRANSPORT_ROAD) { SetRoadTypes(t, ROADTYPES_ROAD); } break; @@ -1759,7 +1760,15 @@ if (GB(_m[t].m5, 3, 2) == 0) { MakeClear(t, CLEAR_GRASS, 3); } else { - MakeCanal(t, (GetTileOwner(t) == OWNER_WATER) ? OWNER_NONE : GetTileOwner(t), Random()); + if (GetTileSlope(t, NULL) != SLOPE_FLAT) { + MakeShore(t); + } else { + if (GetTileOwner(t) == OWNER_WATER) { + MakeWater(t); + } else { + MakeCanal(t, GetTileOwner(t), Random()); + } + } } } SetBridgeMiddle(t, axis); @@ -2364,9 +2373,31 @@ } if (CheckSavegameVersion(86)) { - /* Now all crossings should be in correct state */ for (TileIndex t = 0; t < map_size; t++) { + /* Now all crossings should be in correct state */ if (IsLevelCrossingTile(t)) UpdateLevelCrossing(t, false); + + /* Move river flag and update canals to use water class */ + if (IsTileType(t, MP_WATER)) { + if (_m[t].m5 == 2) { + MakeRiver(t, Random()); + } else { + Owner o = GetTileOwner(t); + if (IsWater(t) && o != OWNER_WATER) { + MakeCanal(t, o, Random()); + } + } + } + } + + /* Update locks, depots, docks and buoys to have a water class based + * on its neighbouring tiles. Done after river and canal updates to + * ensure neighbours are correct. */ + for (TileIndex t = 0; t < map_size; t++) { + if (GetTileSlope(t, NULL) != SLOPE_FLAT) continue; + + if (IsTileType(t, MP_WATER) && (GetWaterTileType(t) == WATER_TILE_LOCK || IsShipDepot(t))) SetWaterClassDependingOnSurroundings(t); + if (IsTileType(t, MP_STATION) && (IsDock(t) || IsBuoy(t))) SetWaterClassDependingOnSurroundings(t); } }