SHARE
TWEET

Untitled

a guest Dec 25th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     /* Transfer height map into OTTD map */
  2.     int highest_height = 0;
  3.     int64 accumulated_height = 0;
  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));
  7.             accumulated_height += height;
  8.             if (height > highest_height) highest_height = height;
  9.             TgenSetTileHeight(TileXY(x, y), Clamp(height, 0, max_height));
  10.         }
  11.     }
  12.     int64 average_height = accumulated_height / (_height_map.size_x * _height_map.size_y);
  13.  
  14.     int tile_count = 0;
  15.     int cur_height = 0;
  16.     while (tile_count < _height_map.size_x * _height_map.size_y * 2 / 3 && cur_height <= highest_height) {
  17.         for (int y = 0; y < _height_map.size_y; y++) {
  18.             for (int x = 0; x < _height_map.size_x; x++) {
  19.                 if (GetTileZ(TileXY(x, y)) == cur_height) tile_count++;
  20.             }
  21.         }
  22.         cur_height++;
  23.     }
  24.     if (_settings_game.game_creation.landscape == LT_ARCTIC) {
  25.         _settings_game.game_creation.snow_line_height = Clamp(cur_height, MIN_SNOWLINE_HEIGHT, MAX_SNOWLINE_HEIGHT);
  26.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top