summaryrefslogtreecommitdiff
path: root/src/noise.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-08-19 11:30:46 +0200
committerGitHub <noreply@github.com>2017-08-19 11:30:46 +0200
commit1992db1395d9c068327a7c08bac7a24ef7112274 (patch)
tree3fb4982e4662a9519e08b57cab228c6b26d4a57f /src/noise.cpp
parent4a1265ceb5919c53efaa8c50bbb0fe7955aa47aa (diff)
downloadminetest-1992db1395d9c068327a7c08bac7a24ef7112274.tar.gz
minetest-1992db1395d9c068327a7c08bac7a24ef7112274.tar.bz2
minetest-1992db1395d9c068327a7c08bac7a24ef7112274.zip
Code modernization: src/n*, src/o* (#6280)
* Code modernization: src/n*, src/o* * empty function * default constructor/destructor * for range-based loops * use emplace_back instead of push_back * remove unused IWritableNodeDefManager::clone() * C++ STL header style * Pointer constness in some functions
Diffstat (limited to 'src/noise.cpp')
-rw-r--r--src/noise.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/noise.cpp b/src/noise.cpp
index e6ca8a495..8b84803b3 100644
--- a/src/noise.cpp
+++ b/src/noise.cpp
@@ -23,10 +23,10 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <math.h>
+#include <cmath>
#include "noise.h"
#include <iostream>
-#include <string.h> // memset
+#include <cstring> // memset
#include "debug.h"
#include "util/numeric.h"
#include "util/string.h"
@@ -262,8 +262,8 @@ float noise2d_gradient(float x, float y, s32 seed, bool eased)
// Interpolate
if (eased)
return biLinearInterpolation(v00, v10, v01, v11, xl, yl);
- else
- return biLinearInterpolationNoEase(v00, v10, v01, v11, xl, yl);
+
+ return biLinearInterpolationNoEase(v00, v10, v01, v11, xl, yl);
}
@@ -292,12 +292,12 @@ float noise3d_gradient(float x, float y, float z, s32 seed, bool eased)
v000, v100, v010, v110,
v001, v101, v011, v111,
xl, yl, zl);
- } else {
- return triLinearInterpolationNoEase(
- v000, v100, v010, v110,
- v001, v101, v011, v111,
- xl, yl, zl);
}
+
+ return triLinearInterpolationNoEase(
+ v000, v100, v010, v110,
+ v001, v101, v011, v111,
+ xl, yl, zl);
}
@@ -778,7 +778,7 @@ float *Noise::perlinMap3D(float x, float y, float z, float *persistence_map)
void Noise::updateResults(float g, float *gmap,
- float *persistence_map, size_t bufsize)
+ const float *persistence_map, size_t bufsize)
{
// This looks very ugly, but it is 50-70% faster than having
// conditional statements inside the loop