src/openttd.cpp
changeset 8991 072c784ccb82
parent 8967 0b56f973bcf0
child 9009 50bc5cdf4f65
equal deleted inserted replaced
8990:dcaad4072e7b 8991:072c784ccb82
  2331 			/* Move river flag and update canals to use water class */
  2331 			/* Move river flag and update canals to use water class */
  2332 			if (IsTileType(t, MP_WATER)) {
  2332 			if (IsTileType(t, MP_WATER)) {
  2333 				if (_m[t].m5 == 2) {
  2333 				if (_m[t].m5 == 2) {
  2334 					MakeRiver(t, Random());
  2334 					MakeRiver(t, Random());
  2335 				} else {
  2335 				} else {
  2336 					Owner o = GetTileOwner(t);
  2336 					if (IsWater(t)) {
  2337 					if (IsWater(t) && o != OWNER_WATER) {
  2337 						Owner o = GetTileOwner(t);
  2338 						MakeCanal(t, o, Random());
  2338 						if (o == OWNER_WATER) {
       
  2339 							MakeWater(t);
       
  2340 						} else {
       
  2341 							MakeCanal(t, o, Random());
       
  2342 						}
       
  2343 					} else if (IsShipDepot(t)) {
       
  2344 						Owner o = (Owner)_m[t].m4; // Original water owner
       
  2345 						SetWaterClass(t, o == OWNER_WATER ? WATER_CLASS_SEA : WATER_CLASS_CANAL);
  2339 					}
  2346 					}
  2340 				}
  2347 				}
  2341 			}
  2348 			}
  2342 		}
  2349 		}
  2343 
  2350 
  2345 		 * on its neighbouring tiles. Done after river and canal updates to
  2352 		 * on its neighbouring tiles. Done after river and canal updates to
  2346 		 * ensure neighbours are correct. */
  2353 		 * ensure neighbours are correct. */
  2347 		for (TileIndex t = 0; t < map_size; t++) {
  2354 		for (TileIndex t = 0; t < map_size; t++) {
  2348 			if (GetTileSlope(t, NULL) != SLOPE_FLAT) continue;
  2355 			if (GetTileSlope(t, NULL) != SLOPE_FLAT) continue;
  2349 
  2356 
  2350 			if (IsTileType(t, MP_WATER) && (GetWaterTileType(t) == WATER_TILE_LOCK || IsShipDepot(t))) SetWaterClassDependingOnSurroundings(t);
  2357 			if (IsTileType(t, MP_WATER) && IsLock(t)) SetWaterClassDependingOnSurroundings(t);
  2351 			if (IsTileType(t, MP_STATION) && (IsDock(t) || IsBuoy(t))) SetWaterClassDependingOnSurroundings(t);
  2358 			if (IsTileType(t, MP_STATION) && (IsDock(t) || IsBuoy(t))) SetWaterClassDependingOnSurroundings(t);
  2352 		}
  2359 		}
  2353 	}
  2360 	}
  2354 
  2361 
  2355 	return InitializeWindowsAndCaches();
  2362 	return InitializeWindowsAndCaches();