update to 1.6.0
--HG-- branch : openttd
This commit is contained in:
28
src/tgp.cpp
28
src/tgp.cpp
@@ -1,4 +1,4 @@
|
||||
/* $Id: tgp.cpp 27351 2015-07-30 18:53:31Z frosch $ */
|
||||
/* $Id: tgp.cpp 27334 2015-07-16 17:05:40Z frosch $ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
@@ -155,7 +155,6 @@
|
||||
/** Fixed point type for heights */
|
||||
typedef int16 height_t;
|
||||
static const int height_decimal_bits = 4;
|
||||
static const height_t _invalid_height = -32768;
|
||||
|
||||
/** Fixed point array for amplitudes (and percent values) */
|
||||
typedef int amplitude_t;
|
||||
@@ -208,12 +207,13 @@ static HeightMap _height_map = {NULL, 0, 0, 0, 0};
|
||||
static const int MAX_TGP_FREQUENCIES = 10;
|
||||
|
||||
/** Desired water percentage (100% == 1024) - indexed by _settings_game.difficulty.quantity_sea_lakes */
|
||||
static const amplitude_t _water_percent[4] = {20, 80, 250, 400};
|
||||
static const amplitude_t _water_percent[4] = {70, 170, 270, 420};
|
||||
|
||||
/**
|
||||
* Gets the maximum allowed height while generating a map based on
|
||||
* mapsize, terraintype, and the maximum height level.
|
||||
* @return The maximum height for the map generation.
|
||||
* @note Values should never be lower than 3 since the minimum snowline height is 2.
|
||||
*/
|
||||
static height_t TGPGetMaxHeight()
|
||||
{
|
||||
@@ -229,11 +229,11 @@ static height_t TGPGetMaxHeight()
|
||||
*/
|
||||
static const int max_height[5][MAX_MAP_SIZE_BITS - MIN_MAP_SIZE_BITS + 1] = {
|
||||
/* 64 128 256 512 1024 2048 4096 */
|
||||
{ 3, 3, 5, 5, 5, 5, 5 }, ///< Very flat
|
||||
{ 4, 4, 6, 10, 10, 10, 10 }, ///< Flat
|
||||
{ 6, 9, 15, 25, 31, 31, 31 }, ///< Hilly
|
||||
{ 7, 12, 23, 42, 78, 85, 85 }, ///< Mountainous
|
||||
{ 12, 21, 36, 73, 146, 170, 170 } ///< Alpinist
|
||||
{ 3, 3, 3, 3, 4, 5, 7 }, ///< Very flat
|
||||
{ 5, 7, 8, 9, 14, 19, 31 }, ///< Flat
|
||||
{ 8, 9, 10, 15, 23, 37, 61 }, ///< Hilly
|
||||
{ 10, 11, 17, 19, 49, 63, 73 }, ///< Mountainous
|
||||
{ 12, 19, 25, 31, 67, 75, 87 }, ///< Alpinist
|
||||
};
|
||||
|
||||
int max_height_from_table = max_height[_settings_game.difficulty.terrain_type][min(MapLogX(), MapLogY()) - MIN_MAP_SIZE_BITS];
|
||||
@@ -315,8 +315,8 @@ static inline bool AllocHeightMap()
|
||||
_height_map.dim_x = _height_map.size_x + 1;
|
||||
_height_map.h = CallocT<height_t>(_height_map.total_size);
|
||||
|
||||
/* Iterate through height map initialize values */
|
||||
FOR_ALL_TILES_IN_HEIGHT(h) *h = _invalid_height;
|
||||
/* Iterate through height map and initialise values. */
|
||||
FOR_ALL_TILES_IN_HEIGHT(h) *h = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -738,7 +738,7 @@ static void HeightMapCoastLines(uint8 water_borders)
|
||||
if (HasBit(water_borders, BORDER_NE)) {
|
||||
/* Top right */
|
||||
max_x = abs((perlin_coast_noise_2D(_height_map.size_y - y, y, 0.9, 53) + 0.25) * 5 + (perlin_coast_noise_2D(y, y, 0.35, 179) + 1) * 12);
|
||||
max_x = max((smallest_size * smallest_size / 16) + max_x, (smallest_size * smallest_size / 16) + margin - max_x);
|
||||
max_x = max((smallest_size * smallest_size / 64) + max_x, (smallest_size * smallest_size / 64) + margin - max_x);
|
||||
if (smallest_size < 8 && max_x > 5) max_x /= 1.5;
|
||||
for (x = 0; x < max_x; x++) {
|
||||
_height_map.height(x, y) = 0;
|
||||
@@ -748,7 +748,7 @@ static void HeightMapCoastLines(uint8 water_borders)
|
||||
if (HasBit(water_borders, BORDER_SW)) {
|
||||
/* Bottom left */
|
||||
max_x = abs((perlin_coast_noise_2D(_height_map.size_y - y, y, 0.85, 101) + 0.3) * 6 + (perlin_coast_noise_2D(y, y, 0.45, 67) + 0.75) * 8);
|
||||
max_x = max((smallest_size * smallest_size / 16) + max_x, (smallest_size * smallest_size / 16) + margin - max_x);
|
||||
max_x = max((smallest_size * smallest_size / 64) + max_x, (smallest_size * smallest_size / 64) + margin - max_x);
|
||||
if (smallest_size < 8 && max_x > 5) max_x /= 1.5;
|
||||
for (x = _height_map.size_x; x > (_height_map.size_x - 1 - max_x); x--) {
|
||||
_height_map.height(x, y) = 0;
|
||||
@@ -761,7 +761,7 @@ static void HeightMapCoastLines(uint8 water_borders)
|
||||
if (HasBit(water_borders, BORDER_NW)) {
|
||||
/* Top left */
|
||||
max_y = abs((perlin_coast_noise_2D(x, _height_map.size_y / 2, 0.9, 167) + 0.4) * 5 + (perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.4, 211) + 0.7) * 9);
|
||||
max_y = max((smallest_size * smallest_size / 16) + max_y, (smallest_size * smallest_size / 16) + margin - max_y);
|
||||
max_y = max((smallest_size * smallest_size / 64) + max_y, (smallest_size * smallest_size / 64) + margin - max_y);
|
||||
if (smallest_size < 8 && max_y > 5) max_y /= 1.5;
|
||||
for (y = 0; y < max_y; y++) {
|
||||
_height_map.height(x, y) = 0;
|
||||
@@ -771,7 +771,7 @@ static void HeightMapCoastLines(uint8 water_borders)
|
||||
if (HasBit(water_borders, BORDER_SE)) {
|
||||
/* Bottom right */
|
||||
max_y = abs((perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.85, 71) + 0.25) * 6 + (perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.35, 193) + 0.75) * 12);
|
||||
max_y = max((smallest_size * smallest_size / 16) + max_y, (smallest_size * smallest_size / 16) + margin - max_y);
|
||||
max_y = max((smallest_size * smallest_size / 64) + max_y, (smallest_size * smallest_size / 64) + margin - max_y);
|
||||
if (smallest_size < 8 && max_y > 5) max_y /= 1.5;
|
||||
for (y = _height_map.size_y; y > (_height_map.size_y - 1 - max_y); y--) {
|
||||
_height_map.height(x, y) = 0;
|
||||
|
||||
Reference in New Issue
Block a user