src/openttd.cpp
changeset 8235 fc75e5ad02b6
parent 8206 573a2d359695
child 8236 a8905f3a9af7
--- a/src/openttd.cpp	Tue Oct 16 19:27:24 2007 +0000
+++ b/src/openttd.cpp	Tue Oct 16 19:48:58 2007 +0000
@@ -1626,7 +1626,7 @@
 						if (GB(_m[t].m5, 3, 2) == 0) {
 							MakeClear(t, CLEAR_GRASS, 3);
 						} else {
-							MakeCanal(t, GetTileOwner(t));
+							MakeCanal(t, (GetTileOwner(t) == OWNER_WATER) ? OWNER_NONE : GetTileOwner(t));
 						}
 					}
 					SetBridgeMiddle(t, axis);
@@ -2160,6 +2160,19 @@
 		FOR_ALL_INDUSTRIES(i) i->founder = OWNER_NONE;
 	}
 
+	/* From version 82, old style canals (above sealevel (0), WATER owner) are no longer supported.
+	    Replace the owner for those by OWNER_NONE. */
+	if (CheckSavegameVersion(82)) {
+		for (TileIndex t = 0; t < map_size; t++) {
+			if (IsTileType(t, MP_WATER) &&
+					GetWaterTileType(t) == WATER_TILE_CLEAR &&
+					GetTileOwner(t) == OWNER_WATER &&
+					TileHeight(t) != 0) {
+				SetTileOwner(t, OWNER_NONE);
+			}
+		}
+	}
+
 	/* Recalculate */
 	Group *g;
 	FOR_ALL_GROUPS(g) {