Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int max_height = H2I(TGPGetMaxHeight());
- /* Transfer height map into OTTD map */
- int h0_tile_count = 0; // count tiles at sea level
- for (int y = 0; y < _height_map.size_y; y++) {
- for (int x = 0; x < _height_map.size_x; x++) {
- int height = Clamp(H2I(_height_map.height(x, y)), 0, max_height);
- if (height == 0) h0_tile_count++;
- TgenSetTileHeight(TileXY(x, y), height);
- }
- }
- if (_settings_game.game_creation.landscape == LT_ARCTIC) {
- int land_mass_size = _height_map.size_x * _height_map.size_y - h0_tile_count; // available tiles above sea
- int tile_count = 0, cur_height = 1;
- while (tile_count < land_mass_size * 2 / 3 && cur_height <= max_height) {
- for (int y = 0; y < _height_map.size_y; y++) {
- for (int x = 0; x < _height_map.size_x; x++) {
- if (TileHeight(TileXY(x, y)) == cur_height) tile_count++;
- }
- }
- cur_height++;
- }
- _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