Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Transfer height map into OTTD map */
- int highest_height = 0;
- int64 accumulated_height = 0;
- for (int y = 0; y < _height_map.size_y; y++) {
- for (int x = 0; x < _height_map.size_x; x++) {
- int height = H2I(_height_map.height(x, y));
- accumulated_height += height;
- if (height > highest_height) highest_height = height;
- TgenSetTileHeight(TileXY(x, y), Clamp(height, 0, max_height));
- }
- }
- int64 average_height = accumulated_height / (_height_map.size_x * _height_map.size_y);
- int tile_count = 0;
- int cur_height = 0;
- while (tile_count < _height_map.size_x * _height_map.size_y * 2 / 3 && cur_height <= highest_height) {
- for (int y = 0; y < _height_map.size_y; y++) {
- for (int x = 0; x < _height_map.size_x; x++) {
- if (GetTileZ(TileXY(x, y)) == cur_height) tile_count++;
- }
- }
- cur_height++;
- }
- if (_settings_game.game_creation.landscape == LT_ARCTIC) {
- _settings_game.game_creation.snow_line_height = Clamp(cur_height, MIN_SNOWLINE_HEIGHT, MAX_SNOWLINE_HEIGHT);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement