summaryrefslogtreecommitdiffstats
path: root/src/Generating/DistortedHeightmap.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2014-10-11 19:32:21 +0200
committerAlexander Harkness <bearbin@gmail.com>2014-10-11 19:32:21 +0200
commit93833069a80fe4aec33a95148df39ad40671ddaf (patch)
tree2e6a335a60e618b5fe456ca8a586a2c5448c8c87 /src/Generating/DistortedHeightmap.cpp
parentReverted submodule changes. (diff)
parentMerge pull request #1528 from kjanku1/master (diff)
downloadcuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.gz
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.bz2
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.lz
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.xz
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.tar.zst
cuberite-93833069a80fe4aec33a95148df39ad40671ddaf.zip
Diffstat (limited to 'src/Generating/DistortedHeightmap.cpp')
-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))