diff options
author | rubidium <rubidium@openttd.org> | 2007-10-16 19:48:58 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-10-16 19:48:58 +0000 |
commit | ba7c595d846245659c569e0510c3642e88d6992c (patch) | |
tree | 45653866becd6ad493d17cf4b6e65801597a47b5 /src/openttd.cpp | |
parent | 4f512a70c360e2aa45e80aacdbcc95d2a754b987 (diff) | |
download | openttd-ba7c595d846245659c569e0510c3642e88d6992c.tar.xz |
(svn r11276) -Codechange: be more consistent with naming of some accessors.
-Fix: make sure canals are never owned by water. Based on a patch by boekabart.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index 1b6407720..af3360b78 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1626,7 +1626,7 @@ bool AfterLoadGame() 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 @@ bool AfterLoadGame() 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) { |