-
-
Save Wolfolo/c6d7476f8290be52bc7ac1073ae11ee6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/tgp.cpp b/src/tgp.cpp | |
index 436870b..dc6de1c 100644 | |
--- a/src/tgp.cpp | |
+++ b/src/tgp.cpp | |
@@ -457,6 +457,19 @@ static void HeightMapSineTransform(height_t h_min, height_t h_max) | |
fheight = (double)(*h - h_min) / (double)(h_max - h_min); | |
/* Apply sine transform depending on landscape type */ | |
switch (_settings_game.game_creation.landscape) { | |
+ case LT_TROPIC: | |
+ { | |
+ /* Desert terrain needs special height distribution. | |
+ * Half of tiles should be at lowest (0..25%) heights */ | |
+ double sine_lower_limit = 0.5; | |
+ double linear_compression = 2; | |
+ if (fheight <= sine_lower_limit) { | |
+ /* Under the limit we do linear compression down */ | |
+ fheight = fheight / linear_compression; | |
+ break; | |
+ } | |
+ } | |
+ FALLTHROUGH; | |
case LT_TOYLAND: | |
case LT_TEMPERATE: | |
/* Move and scale 0..1 into -1..+1 */ | |
@@ -488,27 +501,6 @@ static void HeightMapSineTransform(height_t h_min, height_t h_max) | |
} | |
break; | |
- case LT_TROPIC: | |
- { | |
- /* Desert terrain needs special height distribution. | |
- * Half of tiles should be at lowest (0..25%) heights */ | |
- double sine_lower_limit = 0.5; | |
- double linear_compression = 2; | |
- if (fheight <= sine_lower_limit) { | |
- /* Under the limit we do linear compression down */ | |
- fheight = fheight / linear_compression; | |
- } else { | |
- double m = sine_lower_limit / linear_compression; | |
- /* Get sine_lower_limit..1 into -1..1 */ | |
- fheight = 2.0 * ((fheight - sine_lower_limit) / (1.0 - sine_lower_limit)) - 1.0; | |
- /* Sine wave transform */ | |
- fheight = sin(fheight * M_PI_2); | |
- /* Get -1..1 back to (sine_lower_limit / linear_compression)..1.0 */ | |
- fheight = 0.5 * ((1.0 - m) * fheight + (1.0 + m)); | |
- } | |
- } | |
- break; | |
- | |
default: | |
NOT_REACHED(); | |
break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment