diff options
author | smatz <smatz@openttd.org> | 2008-02-10 14:00:52 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-02-10 14:00:52 +0000 |
commit | ad933e1ddb1ca429decb5f4b4fbde4bcfa9e6fca (patch) | |
tree | e75c8fb8c9e7608c561a626ab35b2c4a0cc51403 /src | |
parent | a86921da41cba15505b64a5fdd15e337725a5470 (diff) | |
download | openttd-ad933e1ddb1ca429decb5f4b4fbde4bcfa9e6fca.tar.xz |
(svn r12100) -Fix (r12042): check for water class of surrounding tiles fails for buoys at map borders
Diffstat (limited to 'src')
-rw-r--r-- | src/openttd.cpp | 6 | ||||
-rw-r--r-- | src/water_cmd.cpp | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index d7d36b3a5..98a24d613 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -2364,6 +2364,12 @@ bool AfterLoadGame() if (CheckSavegameVersion(87)) { for (TileIndex t = 0; t < map_size; t++) { + if (!IsTileType(t, MP_VOID) && (TileX(t) == 0 || TileY(t) == 0 || TileX(t) == MapMaxX() || TileY(t) == MapMaxY())) { + /* Some version 86 savegames have wrong water class at map borders (under buoy, or after removing buoy). + * This conversion has to be done before buoys with invalid owner are removed. */ + SetWaterClass(t, WATER_CLASS_SEA); + } + if (IsBuoyTile(t) || IsDriveThroughStopTile(t) || IsTileType(t, MP_WATER)) { Owner o = GetTileOwner(t); if (IsValidPlayer(o) && !GetPlayer(o)->is_active) { diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 99141d795..35864cf83 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -111,6 +111,12 @@ void SetWaterClassDependingOnSurroundings(TileIndex t) /* Mark tile dirty in all cases */ MarkTileDirtyByTile(t); + if (TileX(t) == 0 || TileY(t) == 0 || TileX(t) == MapMaxX() || TileY(t) == MapMaxY()) { + /* tiles at map borders are always WATER_CLASS_SEA */ + SetWaterClass(t, WATER_CLASS_SEA); + return; + } + bool has_water = false; bool has_canal = false; bool has_river = false; |