From f2689c4887e6bd66af34de81cd793322f1dd57c4 Mon Sep 17 00:00:00 2001 From: tycho Date: Tue, 19 May 2015 11:50:59 +0100 Subject: Fixed a lot of warnings --- src/Noise/Noise.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Noise/Noise.h') diff --git a/src/Noise/Noise.h b/src/Noise/Noise.h index 323194bfd..5df32d3dc 100644 --- a/src/Noise/Noise.h +++ b/src/Noise/Noise.h @@ -288,11 +288,11 @@ NOISE_DATATYPE cNoise::LinearInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B, /** Exports the noise array into a file. a_Coeff specifies the value that each array value is multiplied by before being converted into a byte. */ -extern void Debug2DNoise(const NOISE_DATATYPE * a_Array, int a_SizeX, int a_SizeY, const AString & a_FileNameBase, NOISE_DATATYPE a_Coeff = 32); +extern void Debug2DNoise(const NOISE_DATATYPE * a_Array, size_t a_SizeX, size_t a_SizeY, const AString & a_FileNameBase, NOISE_DATATYPE a_Coeff = 32); /** Exports the noise array into a set of files, ordered by XY and XZ. a_Coeff specifies the value that each array value is multiplied by before being converted into a byte. */ -extern void Debug3DNoise(const NOISE_DATATYPE * a_Array, int a_SizeX, int a_SizeY, int a_SizeZ, const AString & a_FileNameBase, NOISE_DATATYPE a_Coeff = 32); +extern void Debug3DNoise(const NOISE_DATATYPE * a_Array, size_t a_SizeX, size_t a_SizeY, size_t a_SizeZ, const AString & a_FileNameBase, NOISE_DATATYPE a_Coeff = 32); -- cgit v1.2.3 From dae9e5792a4f030ae9e748548a16a89790fbd311 Mon Sep 17 00:00:00 2001 From: tycho Date: Sun, 24 May 2015 12:56:56 +0100 Subject: Made -Weverything an error. --- src/Noise/Noise.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/Noise/Noise.h') diff --git a/src/Noise/Noise.h b/src/Noise/Noise.h index 5df32d3dc..be3b282ac 100644 --- a/src/Noise/Noise.h +++ b/src/Noise/Noise.h @@ -185,7 +185,7 @@ typedef cOctavedNoise> cRidgedMultiNoise; NOISE_DATATYPE cNoise::IntNoise1D(int a_X) const { int x = ((a_X * m_Seed) << 13) ^ a_X; - return (1 - (NOISE_DATATYPE)((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824); + return (1 - static_cast((x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824); // returns a float number in the range of [-1, 1] } @@ -197,7 +197,7 @@ NOISE_DATATYPE cNoise::IntNoise2D(int a_X, int a_Y) const { int n = a_X + a_Y * 57 + m_Seed * 57 * 57; n = (n << 13) ^ n; - return (1 - (NOISE_DATATYPE)((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824); + return (1 - static_cast((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824); // returns a float number in the range of [-1, 1] } @@ -209,7 +209,8 @@ NOISE_DATATYPE cNoise::IntNoise3D(int a_X, int a_Y, int a_Z) const { int n = a_X + a_Y * 57 + a_Z * 57 * 57 + m_Seed * 57 * 57 * 57; n = (n << 13) ^ n; - return ((NOISE_DATATYPE)1 - (NOISE_DATATYPE)((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f); + return (static_cast(1) - + static_cast((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f); // returns a float number in the range of [-1, 1] } @@ -265,8 +266,8 @@ NOISE_DATATYPE cNoise::CubicInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B, NOISE_DATATYPE cNoise::CosineInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B, NOISE_DATATYPE a_Pct) { - const NOISE_DATATYPE ft = a_Pct * (NOISE_DATATYPE)3.1415927; - const NOISE_DATATYPE f = (NOISE_DATATYPE)((NOISE_DATATYPE)(1 - cos(ft)) * (NOISE_DATATYPE)0.5); + const NOISE_DATATYPE ft = a_Pct * static_cast(3.1415927); + const NOISE_DATATYPE f = static_cast(static_cast(1 - cos(ft)) * static_cast(0.5)); return a_A * (1 - f) + a_B * f; } -- cgit v1.2.3 From b2fa71a32ac8bd86bda778a5d54fe2e7e471a1c0 Mon Sep 17 00:00:00 2001 From: tycho Date: Thu, 28 May 2015 12:29:26 +0100 Subject: Fix comments --- src/Noise/Noise.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Noise/Noise.h') diff --git a/src/Noise/Noise.h b/src/Noise/Noise.h index be3b282ac..b08b96e24 100644 --- a/src/Noise/Noise.h +++ b/src/Noise/Noise.h @@ -210,7 +210,8 @@ NOISE_DATATYPE cNoise::IntNoise3D(int a_X, int a_Y, int a_Z) const int n = a_X + a_Y * 57 + a_Z * 57 * 57 + m_Seed * 57 * 57 * 57; n = (n << 13) ^ n; return (static_cast(1) - - static_cast((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f); + static_cast((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0f + ); // returns a float number in the range of [-1, 1] } -- cgit v1.2.3