SHOW:
|
|
- or go back to the newest paste.
| 1 | int max_height = H2I(TGPGetMaxHeight()); | |
| 2 | - | int highest_height = 0; |
| 2 | + | |
| 3 | - | int64 accumulated_height = 0; |
| 3 | + | |
| 4 | for (int y = 0; y < _height_map.size_y; y++) {
| |
| 5 | for (int x = 0; x < _height_map.size_x; x++) {
| |
| 6 | - | int height = H2I(_height_map.height(x, y)); |
| 6 | + | TgenSetTileHeight(TileXY(x, y), Clamp(H2I(_height_map.height(x, y)), 0, max_height)); |
| 7 | - | accumulated_height += height; |
| 7 | + | |
| 8 | - | if (height > highest_height) highest_height = height; |
| 8 | + | |
| 9 | - | TgenSetTileHeight(TileXY(x, y), Clamp(height, 0, max_height)); |
| 9 | + | |
| 10 | int tile_count = 0, cur_height = 0; | |
| 11 | while (tile_count < _height_map.size_x * _height_map.size_y * 2 / 3 && cur_height <= max_height) {
| |
| 12 | - | int64 average_height = accumulated_height / (_height_map.size_x * _height_map.size_y); |
| 12 | + | |
| 13 | for (int x = 0; x < _height_map.size_x; x++) {
| |
| 14 | - | int tile_count = 0; |
| 14 | + | |
| 15 | - | int cur_height = 0; |
| 15 | + | |
| 16 | - | while (tile_count < _height_map.size_x * _height_map.size_y * 2 / 3 && cur_height <= highest_height) {
|
| 16 | + | |
| 17 | cur_height++; | |
| 18 | } | |
| 19 | ||
| 20 | if (_settings_game.game_creation.landscape == LT_ARCTIC) {
| |
| 21 | _settings_game.game_creation.snow_line_height = Clamp(cur_height, MIN_SNOWLINE_HEIGHT, MAX_SNOWLINE_HEIGHT); | |
| 22 | } |