From cbe8d1aa6d58632fcb7763a786d6c9ae8525df0e Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 29 Nov 2013 21:45:20 +0100 Subject: Fixed CheckerboardBiomeGen in negative coords. --- src/Generating/BioGen.cpp | 5 +++-- 1 file 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]; } } } -- cgit v1.2.3