processRegionVoxels fix
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user