fix extra lights-related work in world.set_chunk_data

This commit is contained in:
MihailRis 2025-01-21 23:15:31 +03:00
parent b12982655d
commit 9c8e4e813c
2 changed files with 7 additions and 3 deletions

View File

@ -4,6 +4,7 @@
#include "typedefs.hpp"
#include <memory>
#include <cstring>
inline constexpr int LIGHTMAP_DATA_LEN = CHUNK_VOL/2;
@ -17,6 +18,10 @@ public:
void set(const light_t* map);
void clear() {
std::memset(map, 0, sizeof(map));
}
inline unsigned short get(int x, int y, int z) const {
return (map[y*CHUNK_D*CHUNK_W+z*CHUNK_W+x]);
}

View File

@ -148,12 +148,12 @@ static void integrate_chunk_client(Chunk& chunk) {
int x = chunk.x;
int z = chunk.z;
auto chunksController = controller->getChunksController();
Lighting& lighting = *chunksController->lighting;
chunk.flags.loadedLights = false;
chunk.flags.lighted = false;
chunk.lightmap.clear();
Lighting::prebuildSkyLight(chunk, *indices);
lighting.onChunkLoaded(x, z, true);
for (int lz = -1; lz <= 1; lz++) {
for (int lx = -1; lx <= 1; lx++) {
@ -162,7 +162,6 @@ static void integrate_chunk_client(Chunk& chunk) {
}
if (auto other = level->chunks->getChunk(x + lx, z + lz)) {
other->flags.modified = true;
lighting.onChunkLoaded(x - 1, z, true);
}
}
}