mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-27 05:44:39 +00:00
format everything
This commit is contained in:
@@ -29,8 +29,7 @@ ServerChunkCache::ServerChunkCache(ServerLevel* level, ChunkStorage* storage,
|
||||
autoCreate = false; // 4J added
|
||||
|
||||
std::vector<uint8_t> emptyBlocks(Level::CHUNK_TILE_COUNT);
|
||||
emptyChunk =
|
||||
new EmptyLevelChunk(level, emptyBlocks, 0, 0);
|
||||
emptyChunk = new EmptyLevelChunk(level, emptyBlocks, 0, 0);
|
||||
|
||||
this->level = level;
|
||||
this->storage = storage;
|
||||
@@ -546,7 +545,7 @@ void ServerChunkCache::flagPostProcessComplete(short flag, int x, int z) {
|
||||
if ((lc->terrainPopulated & LevelChunk::sTerrainPopulatedAllAffecting) ==
|
||||
LevelChunk::sTerrainPopulatedAllAffecting) {
|
||||
// Do the compression of data & lighting at this point
|
||||
|
||||
|
||||
// Check, using lower blocks as a reference, if we've already compressed
|
||||
// - no point doing this multiple times, which otherwise we will do as
|
||||
// we aren't checking for the flags transitioning in the if statement
|
||||
@@ -554,8 +553,6 @@ void ServerChunkCache::flagPostProcessComplete(short flag, int x, int z) {
|
||||
if (!lc->isLowerBlockStorageCompressed()) lc->compressBlocks();
|
||||
if (!lc->isLowerBlockLightStorageCompressed()) lc->compressLighting();
|
||||
if (!lc->isLowerDataStorageCompressed()) lc->compressData();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Are all neighbouring chunks And this one now post-processed?
|
||||
@@ -565,14 +562,12 @@ void ServerChunkCache::flagPostProcessComplete(short flag, int x, int z) {
|
||||
|
||||
// This would be a good time to fix up any lighting for this chunk since
|
||||
// all the geometry that could affect it should now be in place
|
||||
if (lc->level->dimension->id != 1) {
|
||||
if (lc->level->dimension->id != 1) {
|
||||
lc->recheckGaps(true);
|
||||
}
|
||||
|
||||
|
||||
// Do a checkLight on any tiles which are lava.
|
||||
lc->lightLava();
|
||||
|
||||
lc->lightLava();
|
||||
|
||||
// Flag as now having this post-post-processing stage completed
|
||||
lc->terrainPopulated |= LevelChunk::sTerrainPostPostProcessed;
|
||||
@@ -584,8 +579,7 @@ void ServerChunkCache::postProcess(ChunkSource* parent, int x, int z) {
|
||||
if ((chunk->terrainPopulated & LevelChunk::sTerrainPopulatedFromHere) ==
|
||||
0) {
|
||||
if (source != nullptr) {
|
||||
source->postProcess(parent, x, z);
|
||||
|
||||
source->postProcess(parent, x, z);
|
||||
|
||||
chunk->markUnsaved();
|
||||
}
|
||||
@@ -648,20 +642,16 @@ void ServerChunkCache::postProcess(ChunkSource* parent, int x, int z) {
|
||||
|
||||
// 4J Added for suspend
|
||||
bool ServerChunkCache::saveAllEntities() {
|
||||
|
||||
{
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(m_csLoadCreate);
|
||||
for (auto it = m_loadedChunkList.begin(); it != m_loadedChunkList.end();
|
||||
++it) {
|
||||
storage->saveEntities(level, *it);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
storage->flush();
|
||||
|
||||
storage->flush();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -866,16 +856,13 @@ int ServerChunkCache::runSaveThreadProc(void* lpParam) {
|
||||
// app.DebugPrintf("Save thread has started\n");
|
||||
|
||||
while (params->chunkToSave != nullptr) {
|
||||
// app.DebugPrintf("Save thread has started processing a chunk\n");
|
||||
// app.DebugPrintf("Save thread has started processing a chunk\n");
|
||||
if (params->saveEntities)
|
||||
params->cache->saveEntities(params->chunkToSave);
|
||||
|
||||
|
||||
|
||||
params->cache->save(params->chunkToSave);
|
||||
params->chunkToSave->setUnsaved(false);
|
||||
|
||||
|
||||
|
||||
// Inform the producer thread that we are done with this chunk
|
||||
params->notificationEvent
|
||||
->set(); // SetEvent(params->notificationEvent);
|
||||
@@ -887,7 +874,6 @@ int ServerChunkCache::runSaveThreadProc(void* lpParam) {
|
||||
params->wakeEvent->waitForSignal(
|
||||
C4JThread::
|
||||
kInfiniteTimeout); // WaitForSingleObject(params->wakeEvent,INFINITE);
|
||||
|
||||
}
|
||||
|
||||
// app.DebugPrintf("Thread is exiting as it has no chunk to process\n");
|
||||
|
||||
Reference in New Issue
Block a user