Advertisement
Guest User

Untitled

a guest
Dec 25th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     int max_height = H2I(TGPGetMaxHeight());
  2.  
  3.     /* Transfer height map into OTTD map */
  4.     for (int y = 0; y < _height_map.size_y; y++) {
  5.         for (int x = 0; x < _height_map.size_x; x++) {
  6.             TgenSetTileHeight(TileXY(x, y), Clamp(H2I(_height_map.height(x, y)), 0, max_height));
  7.         }
  8.     }
  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.         for (int y = 0; y < _height_map.size_y; y++) {
  13.             for (int x = 0; x < _height_map.size_x; x++) {
  14.                 if (GetTileZ(TileXY(x, y)) == cur_height) tile_count++;
  15.             }
  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.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement