145145#include " genworld.h"
146146#include " core/random_func.hpp"
147147#include " landscape_type.h"
148+ #include " tgp.h"
148149
149150#include " safeguards.h"
150151
@@ -701,8 +702,6 @@ static void HeightMapAdjustWaterLevel(int64_t water_percent, Height h_max_new)
701702 }
702703}
703704
704- static double perlin_coast_noise_2D (const double x, const double y, const double p, const int prime);
705-
706705/* *
707706 * This routine sculpts in from the edge a random amount, again a Perlin
708707 * sequence, to avoid the rigid flat-edge slopes that were present before. The
@@ -735,7 +734,7 @@ static void HeightMapCoastLines(BorderFlags water_borders)
735734 for (y = 0 ; y <= _height_map.size_y ; y++) {
736735 if (water_borders.Test (BorderFlag::NorthEast)) {
737736 /* Top right */
738- 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 );
737+ max_x = abs ((PerlinNoise2D (_height_map.size_y - y, y, 0.9 , 53 ) + 0.25 ) * 5 + (PerlinNoise2D (y, y, 0.35 , 179 ) + 1 ) * 12 );
739738 max_x = std::max ((smallest_size * smallest_size / 64 ) + max_x, (smallest_size * smallest_size / 64 ) + margin - max_x);
740739 if (smallest_size < 8 && max_x > 5 ) max_x /= 1.5 ;
741740 for (x = 0 ; x < max_x; x++) {
@@ -745,7 +744,7 @@ static void HeightMapCoastLines(BorderFlags water_borders)
745744
746745 if (water_borders.Test (BorderFlag::SouthWest)) {
747746 /* Bottom left */
748- 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 );
747+ max_x = abs ((PerlinNoise2D (_height_map.size_y - y, y, 0.85 , 101 ) + 0.3 ) * 6 + (PerlinNoise2D (y, y, 0.45 , 67 ) + 0.75 ) * 8 );
749748 max_x = std::max ((smallest_size * smallest_size / 64 ) + max_x, (smallest_size * smallest_size / 64 ) + margin - max_x);
750749 if (smallest_size < 8 && max_x > 5 ) max_x /= 1.5 ;
751750 for (x = _height_map.size_x ; x > (_height_map.size_x - 1 - max_x); x--) {
@@ -758,7 +757,7 @@ static void HeightMapCoastLines(BorderFlags water_borders)
758757 for (x = 0 ; x <= _height_map.size_x ; x++) {
759758 if (water_borders.Test (BorderFlag::NorthWest)) {
760759 /* Top left */
761- 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 );
760+ max_y = abs ((PerlinNoise2D (x, _height_map.size_y / 2 , 0.9 , 167 ) + 0.4 ) * 5 + (PerlinNoise2D (x, _height_map.size_y / 3 , 0.4 , 211 ) + 0.7 ) * 9 );
762761 max_y = std::max ((smallest_size * smallest_size / 64 ) + max_y, (smallest_size * smallest_size / 64 ) + margin - max_y);
763762 if (smallest_size < 8 && max_y > 5 ) max_y /= 1.5 ;
764763 for (y = 0 ; y < max_y; y++) {
@@ -768,7 +767,7 @@ static void HeightMapCoastLines(BorderFlags water_borders)
768767
769768 if (water_borders.Test (BorderFlag::SouthEast)) {
770769 /* Bottom right */
771- 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 );
770+ max_y = abs ((PerlinNoise2D (x, _height_map.size_y / 3 , 0.85 , 71 ) + 0.25 ) * 6 + (PerlinNoise2D (x, _height_map.size_y / 3 , 0.35 , 193 ) + 0.75 ) * 12 );
772771 max_y = std::max ((smallest_size * smallest_size / 64 ) + max_y, (smallest_size * smallest_size / 64 ) + margin - max_y);
773772 if (smallest_size < 8 && max_y > 5 ) max_y /= 1.5 ;
774773 for (y = _height_map.size_y ; y > (_height_map.size_y - 1 - max_y); y--) {
@@ -942,7 +941,7 @@ static double interpolated_noise(const double x, const double y, const int prime
942941 * sequences. as you can guess by its title, i use this to create the indented
943942 * coastline, which is just another perlin sequence.
944943 */
945- static double perlin_coast_noise_2D (const double x, const double y, const double p, const int prime)
944+ double PerlinNoise2D (const double x, const double y, const double p, const int prime)
946945{
947946 double total = 0.0 ;
948947
0 commit comments