From: Daniel Karbach Date: Thu, 19 Mar 2015 11:08:04 +0000 (+0100) Subject: use same load distance for initial and movement X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=32a2a1231de8438f8408007c41247361b1c52417;p=blank.git use same load distance for initial and movement --- diff --git a/src/chunk.cpp b/src/chunk.cpp index 5169422..66b049f 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -618,8 +618,12 @@ void ChunkLoader::Rebase(const Chunk::Pos &new_base) { } } // add missing new chunks + GenerateSurrounding(base); +} + +void ChunkLoader::GenerateSurrounding(const Chunk::Pos &pos) { const Chunk::Pos offset(load_dist, load_dist, load_dist); - Generate(base - offset, base + offset); + Generate(pos - offset, pos + offset); } void ChunkLoader::Update() { diff --git a/src/chunk.hpp b/src/chunk.hpp index c7bcd2f..d8408ec 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -161,6 +161,7 @@ public: ChunkLoader(const BlockTypeRegistry &, const Generator &); void Generate(const Chunk::Pos &from, const Chunk::Pos &to); + void GenerateSurrounding(const Chunk::Pos &); std::list &Loaded() { return loaded; } diff --git a/src/world.cpp b/src/world.cpp index 40dd6bd..30e9229 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -109,7 +109,7 @@ World::World(unsigned int seed) player = &AddEntity(); player->Position({ 4.0f, 4.0f, 4.0f }); - chunks.Generate({ -4, -4, -4 }, { 5, 5, 5}); + chunks.GenerateSurrounding(player->ChunkCoords()); }