summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-10-09 12:33:16 +0200
committerMattes D <github@xoft.cz>2014-10-09 12:33:42 +0200
commitf91aa6f1d3c38f68ccf157731f1d1c3c6beda2ee (patch)
tree496f017dff6aaabda0abef2d7153e82f6489acd2 /src
parentMerge pull request #1520 from mc-server/c++11switch (diff)
downloadcuberite-f91aa6f1d3c38f68ccf157731f1d1c3c6beda2ee.tar
cuberite-f91aa6f1d3c38f68ccf157731f1d1c3c6beda2ee.tar.gz
cuberite-f91aa6f1d3c38f68ccf157731f1d1c3c6beda2ee.tar.bz2
cuberite-f91aa6f1d3c38f68ccf157731f1d1c3c6beda2ee.tar.lz
cuberite-f91aa6f1d3c38f68ccf157731f1d1c3c6beda2ee.tar.xz
cuberite-f91aa6f1d3c38f68ccf157731f1d1c3c6beda2ee.tar.zst
cuberite-f91aa6f1d3c38f68ccf157731f1d1c3c6beda2ee.zip
Diffstat (limited to '')
-rw-r--r--src/Generating/DistortedHeightmap.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Generating/DistortedHeightmap.cpp b/src/Generating/DistortedHeightmap.cpp
index c18c402da..bf8995dcb 100644
--- a/src/Generating/DistortedHeightmap.cpp
+++ b/src/Generating/DistortedHeightmap.cpp
@@ -540,10 +540,11 @@ void cDistortedHeightmap::InitializeCompoGen(cIniFile & a_IniFile)
int cDistortedHeightmap::GetHeightmapAt(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Z)
{
- int ChunkX = (int)floor(a_X / (NOISE_DATATYPE)16);
- int ChunkZ = (int)floor(a_Z / (NOISE_DATATYPE)16);
- int RelX = (int)(a_X - (NOISE_DATATYPE)ChunkX * cChunkDef::Width);
- int RelZ = (int)(a_Z - (NOISE_DATATYPE)ChunkZ * cChunkDef::Width);
+ int RelX = (int)std::floor(a_X);
+ int RelY = 0;
+ int RelZ = (int)std::floor(a_Z);
+ int ChunkX, ChunkZ;
+ cChunkDef::AbsoluteToRelative(RelX, RelY, RelZ, ChunkX, ChunkZ);
// If we're withing the same chunk, return the pre-cached heightmap:
if ((ChunkX == m_CurChunkX) && (ChunkZ == m_CurChunkZ))