src/openttd.cpp
changeset 8471 ba4c15fe147b
parent 8404 1dcc835d3b16
child 8495 35c77bdca32a
equal deleted inserted replaced
8470:ea11349a25ed 8471:ba4c15fe147b
    75 #include "industry_map.h"
    75 #include "industry_map.h"
    76 #include "unmovable_map.h"
    76 #include "unmovable_map.h"
    77 #include "tree_map.h"
    77 #include "tree_map.h"
    78 #include "tunnelbridge_map.h"
    78 #include "tunnelbridge_map.h"
    79 #include "void_map.h"
    79 #include "void_map.h"
       
    80 #include "water.h"
    80 
    81 
    81 #include <stdarg.h>
    82 #include <stdarg.h>
    82 
    83 
    83 #include "table/strings.h"
    84 #include "table/strings.h"
    84 
    85 
  2321 			}
  2322 			}
  2322 		}
  2323 		}
  2323 	}
  2324 	}
  2324 
  2325 
  2325 	if (CheckSavegameVersion(86)) {
  2326 	if (CheckSavegameVersion(86)) {
  2326 		/* Now all crossings should be in correct state */
       
  2327 		for (TileIndex t = 0; t < map_size; t++) {
  2327 		for (TileIndex t = 0; t < map_size; t++) {
       
  2328 			/* Now all crossings should be in correct state */
  2328 			if (IsLevelCrossingTile(t)) UpdateLevelCrossing(t, false);
  2329 			if (IsLevelCrossingTile(t)) UpdateLevelCrossing(t, false);
       
  2330 
       
  2331 			/* Move river flag and update canals to use water class */
       
  2332 			if (IsTileType(t, MP_WATER)) {
       
  2333 				if (_m[t].m5 == 2) {
       
  2334 					MakeRiver(t, Random());
       
  2335 				} else {
       
  2336 					Owner o = GetTileOwner(t);
       
  2337 					if (IsWater(t) && o != OWNER_WATER) {
       
  2338 						MakeCanal(t, o, Random());
       
  2339 					}
       
  2340 				}
       
  2341 			}
       
  2342 		}
       
  2343 
       
  2344 		/* Update locks, depots, docks and buoys to have a water class based
       
  2345 		 * on its neighbouring tiles. Done after river and canal updates to
       
  2346 		 * ensure neighbours are correct. */
       
  2347 		for (TileIndex t = 0; t < map_size; t++) {
       
  2348 			if (GetTileSlope(t, NULL) != SLOPE_FLAT) continue;
       
  2349 
       
  2350 			if (IsTileType(t, MP_WATER) && (GetWaterTileType(t) == WATER_TILE_LOCK || IsShipDepot(t))) SetWaterClassDependingOnSurroundings(t);
       
  2351 			if (IsTileType(t, MP_STATION) && (IsDock(t) || IsBuoy(t))) SetWaterClassDependingOnSurroundings(t);
  2329 		}
  2352 		}
  2330 	}
  2353 	}
  2331 
  2354 
  2332 	return InitializeWindowsAndCaches();
  2355 	return InitializeWindowsAndCaches();
  2333 }
  2356 }