diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-16 18:45:26 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-16 18:45:26 +0100 |
commit | 2928cb6853f1e007e98f174c37d75c793a0c09cc (patch) | |
tree | 25865a247f5460f185f7f058e0db54637b487a5d /source/cWorldGenerator.cpp | |
parent | Got rid of dangerous GetEntity(), not using DoWithEntity() (diff) | |
download | cuberite-2928cb6853f1e007e98f174c37d75c793a0c09cc.tar cuberite-2928cb6853f1e007e98f174c37d75c793a0c09cc.tar.gz cuberite-2928cb6853f1e007e98f174c37d75c793a0c09cc.tar.bz2 cuberite-2928cb6853f1e007e98f174c37d75c793a0c09cc.tar.lz cuberite-2928cb6853f1e007e98f174c37d75c793a0c09cc.tar.xz cuberite-2928cb6853f1e007e98f174c37d75c793a0c09cc.tar.zst cuberite-2928cb6853f1e007e98f174c37d75c793a0c09cc.zip |
Diffstat (limited to 'source/cWorldGenerator.cpp')
-rw-r--r-- | source/cWorldGenerator.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/source/cWorldGenerator.cpp b/source/cWorldGenerator.cpp index 5d087014b..fcbbcdad3 100644 --- a/source/cWorldGenerator.cpp +++ b/source/cWorldGenerator.cpp @@ -14,7 +14,8 @@ -cWorldGenerator::cWorldGenerator()
+cWorldGenerator::cWorldGenerator(cWorld * a_World) :
+ m_World(a_World)
{
}
@@ -30,15 +31,19 @@ cWorldGenerator::~cWorldGenerator() -void cWorldGenerator::GenerateChunk( cChunkPtr a_Chunk )
+void cWorldGenerator::GenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
{
- assert(!a_Chunk->IsValid());
+ // TODO: use a raw char array instead of the entire chunk, then set it as chunk's blockdata
- memset(a_Chunk->pGetBlockData(), 0, cChunk::c_BlockDataSize);
- GenerateTerrain( a_Chunk );
- GenerateFoliage( a_Chunk );
- a_Chunk->CalculateHeightmap();
- a_Chunk->CalculateLighting();
+ cChunkPtr Chunk = m_World->GetChunkNoGen(a_ChunkX, a_ChunkY, a_ChunkZ);
+ assert(!Chunk->IsValid());
+
+ memset(Chunk->pGetBlockData(), 0, cChunk::c_BlockDataSize);
+ GenerateTerrain(Chunk);
+ GenerateFoliage(Chunk);
+ Chunk->CalculateHeightmap();
+ Chunk->CalculateLighting();
+ Chunk->SetValid();
}
|