Mgcarpathian: Fix spawn level calculation (#7212)
authorParamat <paramat@users.noreply.github.com>
Thu, 5 Apr 2018 23:10:16 +0000 (00:10 +0100)
committerGitHub <noreply@github.com>
Thu, 5 Apr 2018 23:10:16 +0000 (00:10 +0100)
src/mapgen/mapgen_carpathian.cpp

index 76c215d00bf621dc22f22c851e0a41f5e6ff2f62..24f570b6497d06c3d2c94346d0146948c6f335c1 100644 (file)
@@ -341,15 +341,15 @@ float MapgenCarpathian::terrainLevelAtPoint(s16 x, s16 z)
 
                // Rolling hills
                float hill_mnt = hilliness * std::pow(n_hills, 2.f);
-               float hills = std::pow(hter, 3.f) * hill_mnt;
+               float hills = std::pow(std::fabs(hter), 3.f) * hill_mnt;
 
                // Ridged mountains
                float ridge_mnt = hilliness * (1.f - std::fabs(n_ridge_mnt));
-               float ridged_mountains = std::pow(rter, 3.f) * ridge_mnt;
+               float ridged_mountains = std::pow(std::fabs(rter), 3.f) * ridge_mnt;
 
                // Step (terraced) mountains
                float step_mnt = hilliness * getSteps(n_step_mnt);
-               float step_mountains = std::pow(ster, 3.f) * step_mnt;
+               float step_mountains = std::pow(std::fabs(ster), 3.f) * step_mnt;
 
                // Final terrain level
                float mountains = hills + ridged_mountains + step_mountains;