diff --git a/src/MinedMap.cpp b/src/MinedMap.cpp index 885ecc2..6fe1383 100644 --- a/src/MinedMap.cpp +++ b/src/MinedMap.cpp @@ -113,10 +113,16 @@ static Resource::Color collectColors(size_t x, size_t z, const World::Block &blo uint8_t biome = e.first; size_t count = e.second; + if (biome == 0xff) + continue; + c = c + count * block.getColor(biome); total += count; } + if (!total) + return block.getColor(0); + return (1.0f / total) * c; } @@ -255,7 +261,7 @@ static void makeBiome(const std::string ®iondir, const std::string &outputdir try { std::unique_ptr biomemap(new uint8_t[DIM*DIM]); - std::memset(biomemap.get(), 0, DIM*DIM); + std::memset(biomemap.get(), 0xff, DIM*DIM); World::Region::visitChunks(input.c_str(), [&] (size_t X, size_t Z, const World::ChunkData *chunk) { addChunkBiome(biomemap.get(), X, Z, chunk); diff --git a/src/World/Chunk.cpp b/src/World/Chunk.cpp index 161dc70..423d7e8 100644 --- a/src/World/Chunk.cpp +++ b/src/World/Chunk.cpp @@ -78,7 +78,7 @@ uint8_t Chunk::getBiome(size_t x, size_t y, size_t z) const { else if (biomeBytes) return biomeBytes->getValue(z*SIZE + x); else - return 0; + return 0xff; } Block Chunk::getBlock(size_t x, Chunk::Height height, size_t z) const {