mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Generator test mode setting
This commit is contained in:
parent
ccbfaa3a86
commit
91c06537eb
13 changed files with 67 additions and 105 deletions
|
|
@ -56,7 +56,8 @@ float bytes2Float(ubyte* src, uint offset){
|
|||
return *(float*)(&value);
|
||||
}
|
||||
|
||||
WorldFiles::WorldFiles(std::string directory, size_t mainBufferCapacity) : directory(directory){
|
||||
WorldFiles::WorldFiles(std::string directory, size_t mainBufferCapacity, bool generatorTestMode)
|
||||
: directory(directory), generatorTestMode(generatorTestMode) {
|
||||
compressionBuffer = new ubyte[CHUNK_DATA_LEN * 2];
|
||||
}
|
||||
|
||||
|
|
@ -161,6 +162,9 @@ ubyte* WorldFiles::getChunk(int x, int y){
|
|||
}
|
||||
|
||||
ubyte* WorldFiles::readChunkData(int x, int y, uint32_t& length){
|
||||
if (generatorTestMode)
|
||||
return nullptr;
|
||||
|
||||
int regionX = floordiv(x, REGION_SIZE);
|
||||
int regionY = floordiv(y, REGION_SIZE);
|
||||
|
||||
|
|
@ -199,6 +203,8 @@ void WorldFiles::write(){
|
|||
if (!std::filesystem::is_directory(directory)) {
|
||||
std::filesystem::create_directory(directory);
|
||||
}
|
||||
if (generatorTestMode)
|
||||
return;
|
||||
for (auto it = regions.begin(); it != regions.end(); it++){
|
||||
if (it->second.chunksData == nullptr || !it->second.unsaved)
|
||||
continue;
|
||||
|
|
@ -264,7 +270,6 @@ bool WorldFiles::readPlayer(Player* player) {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void WorldFiles::writeRegion(int x, int y, WorldRegion& entry){
|
||||
ubyte** region = entry.chunksData;
|
||||
uint32_t* sizes = entry.compressedSizes;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue