10 | TileIndex tile_upper_centre = tile + 2 * delta_mid;
| 10 | // Partial example, for the first 3 tiles:
|
---|
11 | TileIndex tile_upper_right = tile + delta_mid + delta_side;
| | |
---|
12 | TileIndex tile_upper_left = tile + delta_mid - delta_side;
| | |
---|
13 | TileIndex tile_upper_upper = IsWaterTile(tile_upper_centre) ? INVALID_TILE : tile_upper_centre;
| | |
---|
14 | TileIndex tile_upper_upper_right = IsWaterTile(tile_upper_right) ? tile_upper_centre + delta_side : INVALID_TILE;
| | |
---|
15 | TileIndex tile_upper_upper_left = IsWaterTile(tile_upper_left) ? tile_upper_centre - delta_side : INVALID_TILE;
| | |
---|
17 | TileIndex tile_lower_centre = tile - 2 * delta_mid;
| 17 | int delta_counts[] = {2, 1, 1};
|
---|
18 | TileIndex tile_lower_right = tile - delta_mid + delta_side;
| 18 | int side_counts[] = {0, 1, -1};
|
---|
19 | TileIndex tile_lower_left = tile - delta_mid - delta_side;
| | |
---|
20 | TileIndex tile_lower_lower = IsWaterTile(tile_lower_centre) ? INVALID_TILE : tile_lower_centre;
| | |
---|
21 | TileIndex tile_lower_lower_right = IsWaterTile(tile_lower_right) ? tile_lower_centre + delta_side : INVALID_TILE;
| | |
---|
22 | TileIndex tile_lower_lower_left = IsWaterTile(tile_lower_left) ? tile_lower_centre - delta_side : INVALID_TILE;
| | |
---|
24 | TileIndex tiles[] = {tile_upper_upper, tile_upper_upper_right, tile_upper_upper_left, tile_lower_lower, tile_lower_lower_right, tile_lower_lower_left};
| 15 | for (int m = -1; m <= 1; m += 2) {
|
---|
25 | for (int i = 0; i < lengthof(tiles); i++) {
| 16 | for (int i = 0; i < lengthof(delta_counts); i++) {
|
---|
26 | if (tiles[i] != INVALID_TILE && IsTileFlat(tiles[i])) {
| 17 | TileIndex tc = tile + delta_counts[i] * delta_mid + m * delta_side * side_counts[i];
|
---|
27 | assert(!IsWaterTile(tiles[i]));
| 18 | // Process tile.
|
---|
28 | MakeRiver(tiles[i], Random());
| 19 | if (side_counts[i] != 0) {
|
---|
29 | /* Remove desert directly around the river tile. */
| 20 | if (IsWaterTile(tc)) {
|
---|
30 | CircularTileSearch(&tiles[i], 5, RiverModifyDesertZone, NULL);
| 21 | TileIndex tr = tc + delta_mid;
|
---|
| | 22 | if (!IsWaterTile(tr) && IsTileFlat(tr)) {
|
---|
| | 23 | MakeRiver(tr, Random());
|
---|
| | 24 | /* Remove desert directly around the river tile. */
|
---|
| | 25 | CircularTileSearch(&tr, 5, RiverModifyDesertZone, NULL);
|
---|
| | 26 | }
|
---|
| | 27 | }
|
---|
| | 28 | } else {
|
---|
| | 29 | if (!IsWaterTile(tc)) {
|
---|
| | 30 | MakeRiver(tc, Random());
|
---|
| | 31 | /* Remove desert directly around the river tile. */
|
---|
| | 32 | CircularTileSearch(&tc, 5, RiverModifyDesertZone, NULL);
|
---|
| | 33 | }
|
---|
| | 34 | }
|
---|