summaryrefslogtreecommitdiffstats
path: root/src/Generating/BioGen.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-11-29 21:45:20 +0100
committermadmaxoft <github@xoft.cz>2013-11-29 21:45:20 +0100
commitcbe8d1aa6d58632fcb7763a786d6c9ae8525df0e (patch)
treed991363fa3c8b7be1bd955846ace48073e58b773 /src/Generating/BioGen.cpp
parentDistortedHeightmap: Improved speed, prepared for mesa biomes. (diff)
downloadcuberite-cbe8d1aa6d58632fcb7763a786d6c9ae8525df0e.tar
cuberite-cbe8d1aa6d58632fcb7763a786d6c9ae8525df0e.tar.gz
cuberite-cbe8d1aa6d58632fcb7763a786d6c9ae8525df0e.tar.bz2
cuberite-cbe8d1aa6d58632fcb7763a786d6c9ae8525df0e.tar.lz
cuberite-cbe8d1aa6d58632fcb7763a786d6c9ae8525df0e.tar.xz
cuberite-cbe8d1aa6d58632fcb7763a786d6c9ae8525df0e.tar.zst
cuberite-cbe8d1aa6d58632fcb7763a786d6c9ae8525df0e.zip
Diffstat (limited to 'src/Generating/BioGen.cpp')
-rw-r--r--src/Generating/BioGen.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp
index ec807c56a..a0407a145 100644
--- a/src/Generating/BioGen.cpp
+++ b/src/Generating/BioGen.cpp
@@ -295,11 +295,12 @@ void cBioGenCheckerboard::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::Biome
{
for (int z = 0; z < cChunkDef::Width; z++)
{
- int Base = cChunkDef::Width * a_ChunkZ + z;
+ int Base = (cChunkDef::Width * a_ChunkZ + z) / m_BiomeSize;
for (int x = 0; x < cChunkDef::Width; x++)
{
int Add = cChunkDef::Width * a_ChunkX + x;
- a_BiomeMap[x + cChunkDef::Width * z] = m_Biomes[(Base / m_BiomeSize + Add / m_BiomeSize) % m_BiomesCount];
+ int BiomeIdx = (((Base + Add / m_BiomeSize) % m_BiomesCount) + m_BiomesCount) % m_BiomesCount; // Need to add and modulo twice because of negative numbers
+ a_BiomeMap[x + cChunkDef::Width * z] = m_Biomes[BiomeIdx];
}
}
}