summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2014-09-22 14:33:41 +0200
committerAlexander Harkness <me@bearbin.net>2014-09-22 14:33:41 +0200
commitb9b45e82876caf51cf486b72c811aa49ef67b1ed (patch)
treee39037971290a1b9fa6343c0c8f846541096d435 /src
parentQtBiomeVisualiser: Added the base for INI editting. (diff)
parentMade it compile with clang (diff)
downloadcuberite-b9b45e82876caf51cf486b72c811aa49ef67b1ed.tar
cuberite-b9b45e82876caf51cf486b72c811aa49ef67b1ed.tar.gz
cuberite-b9b45e82876caf51cf486b72c811aa49ef67b1ed.tar.bz2
cuberite-b9b45e82876caf51cf486b72c811aa49ef67b1ed.tar.lz
cuberite-b9b45e82876caf51cf486b72c811aa49ef67b1ed.tar.xz
cuberite-b9b45e82876caf51cf486b72c811aa49ef67b1ed.tar.zst
cuberite-b9b45e82876caf51cf486b72c811aa49ef67b1ed.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.cpp4
-rw-r--r--src/Entities/Minecart.cpp4
-rw-r--r--src/Generating/Caves.cpp2
-rw-r--r--src/Generating/Noise3DGenerator.cpp4
-rw-r--r--src/LineBlockTracer.cpp6
-rw-r--r--src/Tracer.cpp2
6 files changed, 11 insertions, 11 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 42b207c48..996f2fff3 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -260,7 +260,7 @@ void cEntity::TakeDamage(eDamageType a_DamageType, cEntity * a_Attacker, int a_R
void cEntity::SetYawFromSpeed(void)
{
const double EPS = 0.0000001;
- if ((abs(m_Speed.x) < EPS) && (abs(m_Speed.z) < EPS))
+ if ((std::abs(m_Speed.x) < EPS) && (std::abs(m_Speed.z) < EPS))
{
// atan2() may overflow or is undefined, pick any number
SetYaw(0);
@@ -277,7 +277,7 @@ void cEntity::SetPitchFromSpeed(void)
{
const double EPS = 0.0000001;
double xz = sqrt(m_Speed.x * m_Speed.x + m_Speed.z * m_Speed.z); // Speed XZ-plane component
- if ((abs(xz) < EPS) && (abs(m_Speed.y) < EPS))
+ if ((std::abs(xz) < EPS) && (std::abs(m_Speed.y) < EPS))
{
// atan2() may overflow or is undefined, pick any number
SetPitch(0);
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index 1501eea84..bc9e21d8e 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -876,7 +876,7 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
Vector3d Distance = MinecartCollisionCallback.GetCollidedEntityPosition() - Vector3d(GetPosX(), 0, GetPosZ());
// Prevent division by small numbers
- if (abs(Distance.z) < 0.001)
+ if (std::abs(Distance.z) < 0.001)
{
Distance.z = 0.001;
}
@@ -925,7 +925,7 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
Vector3d Distance = MinecartCollisionCallback.GetCollidedEntityPosition() - Vector3d(GetPosX(), 0, GetPosZ());
// Prevent division by small numbers
- if (abs(Distance.z) < 0.001)
+ if (std::abs(Distance.z) < 0.001)
{
Distance.z = 0.001;
}
diff --git a/src/Generating/Caves.cpp b/src/Generating/Caves.cpp
index 71154dff9..fc925a150 100644
--- a/src/Generating/Caves.cpp
+++ b/src/Generating/Caves.cpp
@@ -755,7 +755,7 @@ void cStructGenDualRidgeCaves::GenFinish(cChunkDesc & a_ChunkDesc)
float n2 = m_Noise2.CubicNoise3D(xx, yy, zz);
float n3 = m_Noise1.CubicNoise3D(xx * 4, yy * 4, zz * 4) / 4;
float n4 = m_Noise2.CubicNoise3D(xx * 4, yy * 4, zz * 4) / 4;
- if ((abs(n1 + n3) * abs(n2 + n4)) > m_Threshold)
+ if ((std::abs(n1 + n3) * std::abs(n2 + n4)) > m_Threshold)
{
a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_AIR);
}
diff --git a/src/Generating/Noise3DGenerator.cpp b/src/Generating/Noise3DGenerator.cpp
index eb816f564..c3ca30384 100644
--- a/src/Generating/Noise3DGenerator.cpp
+++ b/src/Generating/Noise3DGenerator.cpp
@@ -236,7 +236,7 @@ void cNoise3DGenerator::GenerateNoiseArray(int a_ChunkX, int a_ChunkZ, NOISE_DAT
m_Cubic.Generate2D(Height, DIM_X, DIM_Z, StartX / 25, EndX / 25, StartZ / 25, EndZ / 25);
for (size_t i = 0; i < ARRAYCOUNT(Height); i++)
{
- Height[i] = abs(Height[i]) * m_HeightAmplification + 1;
+ Height[i] = std::abs(Height[i]) * m_HeightAmplification + 1;
}
// Modify the noise by height data:
@@ -395,7 +395,7 @@ void cNoise3DComposable::GenerateNoiseArrayIfNeeded(int a_ChunkX, int a_ChunkZ)
for (int x = 0; x < 17; x += UPSCALE_X)
{
NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(a_ChunkX * cChunkDef::Width + x)) / m_FrequencyX;
- NOISE_DATATYPE val = abs(m_Noise1.CubicNoise2D(NoiseX / 5, NoiseZ / 5)) * m_HeightAmplification + 1;
+ NOISE_DATATYPE val = std::abs(m_Noise1.CubicNoise2D(NoiseX / 5, NoiseZ / 5)) * m_HeightAmplification + 1;
Height[x + 17 * z] = val * val * val;
}
}
diff --git a/src/LineBlockTracer.cpp b/src/LineBlockTracer.cpp
index 71b8334fa..1b42081c2 100644
--- a/src/LineBlockTracer.cpp
+++ b/src/LineBlockTracer.cpp
@@ -146,7 +146,7 @@ bool cLineBlockTracer::MoveToNextBlock(void)
dirY,
dirZ,
} Direction = dirNONE;
- if (abs(m_DiffX) > EPS)
+ if (std::abs(m_DiffX) > EPS)
{
double DestX = (m_DirX > 0) ? (m_CurrentX + 1) : m_CurrentX;
Coeff = (DestX - m_StartX) / m_DiffX;
@@ -155,7 +155,7 @@ bool cLineBlockTracer::MoveToNextBlock(void)
Direction = dirX;
}
}
- if (abs(m_DiffY) > EPS)
+ if (std::abs(m_DiffY) > EPS)
{
double DestY = (m_DirY > 0) ? (m_CurrentY + 1) : m_CurrentY;
double CoeffY = (DestY - m_StartY) / m_DiffY;
@@ -165,7 +165,7 @@ bool cLineBlockTracer::MoveToNextBlock(void)
Direction = dirY;
}
}
- if (abs(m_DiffZ) > EPS)
+ if (std::abs(m_DiffZ) > EPS)
{
double DestZ = (m_DirZ > 0) ? (m_CurrentZ + 1) : m_CurrentZ;
double CoeffZ = (DestZ - m_StartZ) / m_DiffZ;
diff --git a/src/Tracer.cpp b/src/Tracer.cpp
index 756147a7b..8ccd18071 100644
--- a/src/Tracer.cpp
+++ b/src/Tracer.cpp
@@ -250,7 +250,7 @@ int LinesCross(float x0, float y0, float x1, float y1, float x2, float y2, float
// float linx, liny;
float d=(x1-x0)*(y3-y2)-(y1-y0)*(x3-x2);
- if (abs(d)<0.001) {return 0;}
+ if (std::abs(d)<0.001) {return 0;}
float AB=((y0-y2)*(x3-x2)-(x0-x2)*(y3-y2))/d;
if (AB>=0.0 && AB<=1.0)
{