summaryrefslogtreecommitdiffstats
path: root/src/Generating/DistortedHeightmap.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-10-21 16:55:22 +0200
committerHowaner <franzi.moos@googlemail.com>2014-10-21 16:55:22 +0200
commit44514e53fc5ad19e57688bed610f804b6d28be33 (patch)
tree224fce184f6d59739d77828889025467ecfd1edf /src/Generating/DistortedHeightmap.cpp
parentAdded distance check. (diff)
parentUpdated ProtectionAreas (diff)
downloadcuberite-44514e53fc5ad19e57688bed610f804b6d28be33.tar
cuberite-44514e53fc5ad19e57688bed610f804b6d28be33.tar.gz
cuberite-44514e53fc5ad19e57688bed610f804b6d28be33.tar.bz2
cuberite-44514e53fc5ad19e57688bed610f804b6d28be33.tar.lz
cuberite-44514e53fc5ad19e57688bed610f804b6d28be33.tar.xz
cuberite-44514e53fc5ad19e57688bed610f804b6d28be33.tar.zst
cuberite-44514e53fc5ad19e57688bed610f804b6d28be33.zip
Diffstat (limited to 'src/Generating/DistortedHeightmap.cpp')
-rw-r--r--src/Generating/DistortedHeightmap.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Generating/DistortedHeightmap.cpp b/src/Generating/DistortedHeightmap.cpp
index c18c402da..e6849fadf 100644
--- a/src/Generating/DistortedHeightmap.cpp
+++ b/src/Generating/DistortedHeightmap.cpp
@@ -276,13 +276,13 @@ const cDistortedHeightmap::sGenParam cDistortedHeightmap::m_GenParam[256] =
-cDistortedHeightmap::cDistortedHeightmap(int a_Seed, cBiomeGen & a_BiomeGen) :
+cDistortedHeightmap::cDistortedHeightmap(int a_Seed, cBiomeGenPtr a_BiomeGen) :
m_NoiseDistortX(a_Seed + 1000),
m_NoiseDistortZ(a_Seed + 2000),
m_OceanFloorSelect(a_Seed + 3000),
m_MesaFloor(a_Seed + 4000),
m_BiomeGen(a_BiomeGen),
- m_UnderlyingHeiGen(a_Seed, a_BiomeGen),
+ m_UnderlyingHeiGen(new cHeiGenBiomal(a_Seed, a_BiomeGen)),
m_HeightGen(m_UnderlyingHeiGen, 64),
m_IsInitialized(false)
{
@@ -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))
@@ -576,7 +577,7 @@ void cDistortedHeightmap::UpdateDistortAmps(void)
{
for (int x = -1; x <= 1; x++)
{
- m_BiomeGen.GenBiomes(m_CurChunkX + x, m_CurChunkZ + z, Biomes[x + 1][z + 1]);
+ m_BiomeGen->GenBiomes(m_CurChunkX + x, m_CurChunkZ + z, Biomes[x + 1][z + 1]);
} // for x
} // for z