| | | 1 | /**
|
|---|
| | | 2 | * Make a connected lake; fill all tiles in the circular tile search that are connected.
|
|---|
| | | 3 | * @param tile The tile to consider for lake making.
|
|---|
| | | 4 | * @param user_data The height of the lake.
|
|---|
| | | 5 | * @return Always false, so it continues searching.
|
|---|
| | | 6 | */
|
|---|
| | | 7 | static bool MakeLake(TileIndex tile, void *user_data)
|
|---|
| | | 8 | {
|
|---|
| | | 9 | uint height = *(uint*)user_data;
|
|---|
| | | 10 | if (!IsValidTile(tile) || TileHeight(tile) != height || !IsTileFlat(tile)) return false;
|
|---|
| | | 11 | if (_settings_game.game_creation.landscape == LT_TROPIC && GetTropicZone(tile) == TROPICZONE_DESERT) return false;
|
|---|
| | | 12 |
|
|---|
| | | 13 | for (DiagDirection d = DIAGDIR_BEGIN; d < DIAGDIR_END; d++) {
|
|---|
| | | 14 | TileIndex t2 = tile + TileOffsByDiagDir(d);
|
|---|
| | | 15 | if (IsWaterTile(t2)) {
|
|---|
| | | 16 | MakeRiver(tile, Random());
|
|---|
| | | 17 | return false;
|
|---|
| | | 18 | }
|
|---|
| | | 19 | }
|
|---|
| | | 20 |
|
|---|
| | | 21 | return false;
|
|---|
| | | 22 | }
|
|---|
| | | 23 |
|
|---|
| 27 | if (IsValidTile(tile + m * 2 * delta_mid)) {
| 51 | for (int d = -1; d <= 1; d += 2) {
|
|---|
| 28 | if (!IsTileFlat(tile + m * 2 * delta_mid)) {
| 52 | if (IsValidTile(t_dm + d * delta)) {
|
|---|
| | | 53 | if (!IsTileFlat(t_dm + d * delta) &&
|
|---|
| | | 54 | (GetInclinedSlopeDirection(GetTileSlope(t_dm + d * delta)) == dir_rot ||
|
|---|
| | | 55 | GetInclinedSlopeDirection(GetTileSlope(t_dm + d * delta)) == ReverseDiagDir(dir_rot)) &&
|
|---|
| | | 56 | FlowsLock(t_dm + d * delta)) {
|
|---|
| | | 57 | return false;
|
|---|
| | | 58 | }
|
|---|
| | | 59 |
|
|---|
| | | 60 | if (IsValidTile(t_dm + d * 2 * delta)) {
|
|---|
| | | 61 | if (!IsTileFlat(t_dm + d * 2 * delta) &&
|
|---|
| | | 62 | (GetInclinedSlopeDirection(GetTileSlope(t_dm + d * 2 * delta)) == dir_rot ||
|
|---|
| | | 63 | GetInclinedSlopeDirection(GetTileSlope(t_dm + d * 2 * delta)) == ReverseDiagDir(dir_rot)) &&
|
|---|
| | | 64 | FlowsLock(t_dm + d * 2 * delta)) {
|
|---|
| | | 65 | return false;
|
|---|
| | | 66 | }
|
|---|
| | | 67 | }
|
|---|
| | | 68 | }
|
|---|
| | | 69 | }
|
|---|
| | | 70 |
|
|---|
| | | 71 | TileIndex t_2dm = t_dm + m * delta_mid;
|
|---|
| | | 72 | if (IsValidTile(t_2dm)) {
|
|---|
| | | 73 | if (!IsTileFlat(t_2dm)) {
|
|---|
| 32 | if (IsValidTile(tile + m * 3 * delta_mid)) {
| 77 | for (int d = -1; d <= 1; d += 2) {
|
|---|
| 33 | if ((GetInclinedSlopeDirection(GetTileSlope(tile + m * 3 * delta_mid)) == dir ||
| 78 | if (IsValidTile(t_2dm + d * delta)) {
|
|---|
| 34 | GetInclinedSlopeDirection(GetTileSlope(tile + m * 3 * delta_mid)) == ReverseDiagDir(dir)) &&
| 79 | if (IsTileFlat(t_dm + d * delta) && !IsTileFlat(t_2dm + d * delta)) {
|
|---|
| 35 | FlowsLock(tile + m * 3 * delta_mid)) {
| 80 | return false;
|
|---|
| 36 | return false;
| 81 | }
|
|---|
| | | 82 |
|
|---|
| | | 83 | if (!IsTileFlat(t_2dm + d * delta) &&
|
|---|
| | | 84 | (GetInclinedSlopeDirection(GetTileSlope(t_2dm + d * delta)) == dir_rot ||
|
|---|
| | | 85 | GetInclinedSlopeDirection(GetTileSlope(t_2dm + d * delta)) == ReverseDiagDir(dir_rot)) &&
|
|---|
| | | 86 | FlowsLock(t_2dm + d * delta)) {
|
|---|
| | | 87 | return false;
|
|---|
| | | 88 | }
|
|---|
| 42 | for (int d = -1; d <= 1; d += 2) {
| 42 | TileIndex t_3dm = t_2dm + m * delta_mid;
|
|---|
| 43 | if (IsValidTile(tile + m * delta_mid + d * delta)) {
| 43 | if (IsValidTile(t_3dm)) {
|
|---|
| 44 | if (!IsTileFlat(tile + m * delta_mid + d * delta) &&
| 44 | if ((GetInclinedSlopeDirection(GetTileSlope(t_3dm)) == dir ||
|
|---|
| 45 | (GetInclinedSlopeDirection(GetTileSlope(tile + m * delta_mid + d * delta)) == dir_rot ||
| 45 | GetInclinedSlopeDirection(GetTileSlope(t_3dm)) == ReverseDiagDir(dir)) &&
|
|---|
| 46 | GetInclinedSlopeDirection(GetTileSlope(tile + m * delta_mid + d * delta)) == ReverseDiagDir(dir_rot)) &&
| 46 | FlowsLock(t_3dm)) {
|
|---|
| 47 | FlowsLock(tile + m * delta_mid + d * delta)) {
| | |
|---|
| 48 | return false;
| | |
|---|
| 49 | }
| | |
|---|
| 50 |
| | |
|---|
| 51 | if (IsValidTile(tile + m * delta_mid + d * 2 * delta)) {
| | |
|---|
| 52 | if (!IsTileFlat(tile + m * delta_mid + d * 2 * delta) &&
| | |
|---|
| 53 | (GetInclinedSlopeDirection(GetTileSlope(tile + m * delta_mid + d * 2 * delta)) == dir_rot ||
| | |
|---|
| 54 | GetInclinedSlopeDirection(GetTileSlope(tile + m * delta_mid + d * 2 * delta)) == ReverseDiagDir(dir_rot)) &&
| | |
|---|
| 55 | FlowsLock(tile + m * delta_mid + d * 2 * delta)) {
| | |
|---|
| 60 | if (IsValidTile(tile + m * 2 * delta_mid + d * delta)) {
| 60 | for (int d = -1; d <= 1; d += 2) {
|
|---|
| 61 | if (IsTileFlat(tile + m * delta_mid + d * delta) && !IsTileFlat(tile + m * 2 * delta_mid + d * delta)) {
| 61 | if (IsValidTile(t_3dm + d * delta)) {
|
|---|
| 62 | return false;
| 62 | if ((GetInclinedSlopeDirection(GetTileSlope(t_3dm + d * delta)) == dir ||
|
|---|
| 63 | }
| 63 | GetInclinedSlopeDirection(GetTileSlope(t_3dm + d * delta)) == ReverseDiagDir(dir)) &&
|
|---|
| 64 |
| 64 | FlowsLock(t_3dm + d * delta)) {
|
|---|
| 65 | if (!IsTileFlat(tile + m * 2 * delta_mid + d * delta) &&
| | |
|---|
| 66 | (GetInclinedSlopeDirection(GetTileSlope(tile + m * 2 * delta_mid + d * delta)) == dir_rot ||
| | |
|---|
| 67 | GetInclinedSlopeDirection(GetTileSlope(tile + m * 2 * delta_mid + d * delta)) == ReverseDiagDir(dir_rot)) &&
| | |
|---|
| 68 | FlowsLock(tile + m * 2 * delta_mid + d * delta)) {
| | |
|---|
| 69 | return false;
| | |
|---|
| 70 | }
| | |
|---|
| 71 |
| | |
|---|
| 72 | if (IsValidTile(tile + m * 3 * delta_mid + d * delta)) {
| | |
|---|
| 73 | if ((GetInclinedSlopeDirection(GetTileSlope(tile + m * 3 * delta_mid + d * delta)) == dir ||
| | |
|---|
| 74 | GetInclinedSlopeDirection(GetTileSlope(tile + m * 3 * delta_mid + d * delta)) == ReverseDiagDir(dir)) &&
| | |
|---|
| 75 | FlowsLock(tile + m * 3 * delta_mid + d * delta)) {
| | |
|---|