summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-02-02 09:28:43 +0000
committerpeter1138 <peter1138@openttd.org>2008-02-02 09:28:43 +0000
commit1d891a8b15f750ea7aaa14622536e87765c59e7a (patch)
tree44979390033d921d0bb48f8dddd3dec3c4d7267b /src/openttd.cpp
parent7cf2c834627ee41e89f5167ed05d18ec4cc7df62 (diff)
downloadopenttd-1d891a8b15f750ea7aaa14622536e87765c59e7a.tar.xz
(svn r12042) -Fix [FS#1676]: Reimplement how rivers and canals are stored in the map, allowing the sea/river/canal status to also be
stored for buoys, docks, locks and depots. All these are now allowed on rivers and removal of them will revert to the original water type.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 736acb978..1b298de8b 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -77,6 +77,7 @@
#include "tree_map.h"
#include "tunnelbridge_map.h"
#include "void_map.h"
+#include "water.h"
#include <stdarg.h>
@@ -2323,9 +2324,31 @@ bool AfterLoadGame()
}
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);
}
}