mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 14:31:50 +00:00
processRegionVoxels fix
This commit is contained in:
parent
0cbaa1ccc6
commit
d955a0ead3
2 changed files with 3 additions and 1 deletions
|
|
@ -598,9 +598,10 @@ void WorldFiles::processRegionVoxels(int x, int z, regionproc func) {
|
||||||
int gx = cx + x * REGION_SIZE;
|
int gx = cx + x * REGION_SIZE;
|
||||||
int gz = cz + z * REGION_SIZE;
|
int gz = cz + z * REGION_SIZE;
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
std::unique_ptr<ubyte[]> data (readChunkData(gx, gz, length, regfile.get()));
|
auto data = readChunkData(gx, gz, length, regfile.get());
|
||||||
if (data == nullptr)
|
if (data == nullptr)
|
||||||
continue;
|
continue;
|
||||||
|
data = decompress(data.get(), length, CHUNK_DATA_LEN);
|
||||||
if (func(data.get())) {
|
if (func(data.get())) {
|
||||||
put(gx, gz, REGION_LAYER_VOXELS, std::move(data), CHUNK_DATA_LEN, true);
|
put(gx, gz, REGION_LAYER_VOXELS, std::move(data), CHUNK_DATA_LEN, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,7 @@ class WorldFiles {
|
||||||
/// @param dstlen max expected length of source buffer
|
/// @param dstlen max expected length of source buffer
|
||||||
/// @return decompressed bytes array
|
/// @return decompressed bytes array
|
||||||
std::unique_ptr<ubyte[]> decompress(const ubyte* src, size_t srclen, size_t dstlen);
|
std::unique_ptr<ubyte[]> decompress(const ubyte* src, size_t srclen, size_t dstlen);
|
||||||
|
|
||||||
std::unique_ptr<ubyte[]> readChunkData(int x, int y, uint32_t& length, regfile* file);
|
std::unique_ptr<ubyte[]> readChunkData(int x, int y, uint32_t& length, regfile* file);
|
||||||
|
|
||||||
void fetchChunks(WorldRegion* region, int x, int y, regfile* file);
|
void fetchChunks(WorldRegion* region, int x, int y, regfile* file);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue