aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/McRegionChunkStorage.cpp
diff options
context:
space:
mode:
authorqwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com>2026-03-16 21:44:26 -0500
committerGitHub <noreply@github.com>2026-03-16 21:44:26 -0500
commitce739f6045ec72127491286ea3f3f21e537c1b55 (patch)
treef33bd42a47c1b4a7b2153a7fb77127ee3b407db9 /Minecraft.World/McRegionChunkStorage.cpp
parent255a18fe8e9b57377975f82e2b227afe2a12eda0 (diff)
parent5a59f5d146b43811dde6a5a0245ee9875d7b5cd1 (diff)
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.World/McRegionChunkStorage.cpp')
-rw-r--r--Minecraft.World/McRegionChunkStorage.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/Minecraft.World/McRegionChunkStorage.cpp b/Minecraft.World/McRegionChunkStorage.cpp
index 344ff6c7..ad07a66e 100644
--- a/Minecraft.World/McRegionChunkStorage.cpp
+++ b/Minecraft.World/McRegionChunkStorage.cpp
@@ -45,7 +45,7 @@ McRegionChunkStorage::McRegionChunkStorage(ConsoleSaveFile *saveFile, const wstr
for(int i = 0; i < count; ++i)
{
- __int64 index = dis.readLong();
+ int64_t index = dis.readLong();
CompoundTag *tag = NbtIo::read(&dis);
ByteArrayOutputStream bos;
@@ -76,9 +76,9 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z)
#ifdef SPLIT_SAVES
// If we can't find the chunk in the save file, then we should remove any entities we might have for that chunk
- if(regionChunkInputStream == NULL)
+ if(regionChunkInputStream == nullptr)
{
- __int64 index = ((__int64)(x) << 32) | (((__int64)(z))&0x00000000FFFFFFFF);
+ int64_t index = ((int64_t)(x) << 32) | (((int64_t)(z))&0x00000000FFFFFFFF);
auto it = m_entityData.find(index);
if(it != m_entityData.end())
@@ -89,11 +89,11 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z)
}
#endif
- LevelChunk *levelChunk = NULL;
+ LevelChunk *levelChunk = nullptr;
if(m_saveFile->getOriginalSaveVersion() >= SAVE_FILE_VERSION_COMPRESSED_CHUNK_STORAGE)
{
- if (regionChunkInputStream != NULL)
+ if (regionChunkInputStream != nullptr)
{
MemSect(9);
levelChunk = OldChunkStorage::load(level, regionChunkInputStream);
@@ -106,14 +106,14 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z)
else
{
CompoundTag *chunkData;
- if (regionChunkInputStream != NULL)
+ if (regionChunkInputStream != nullptr)
{
MemSect(8);
chunkData = NbtIo::read((DataInput *)regionChunkInputStream);
MemSect(0);
} else
{
- return NULL;
+ return nullptr;
}
regionChunkInputStream->deleteChildStream();
@@ -125,7 +125,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z)
sprintf(buf,"Chunk file at %d, %d is missing level data, skipping\n",x, z);
app.DebugPrintf(buf);
delete chunkData;
- return NULL;
+ return nullptr;
}
if (!chunkData->getCompound(L"Level")->contains(L"Blocks"))
{
@@ -133,7 +133,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z)
sprintf(buf,"Chunk file at %d, %d is missing block data, skipping\n",x, z);
app.DebugPrintf(buf);
delete chunkData;
- return NULL;
+ return nullptr;
}
MemSect(9);
levelChunk = OldChunkStorage::load(level, chunkData->getCompound(L"Level"));
@@ -146,7 +146,7 @@ LevelChunk *McRegionChunkStorage::load(Level *level, int x, int z)
app.DebugPrintf(buf);
delete levelChunk;
delete chunkData;
- return NULL;
+ return nullptr;
// 4J Stu - We delete the data within OldChunkStorage::load, so we can never reload from it
//chunkData->putInt(L"xPos", x);
@@ -242,7 +242,7 @@ void McRegionChunkStorage::saveEntities(Level *level, LevelChunk *levelChunk)
{
#ifdef SPLIT_SAVES
PIXBeginNamedEvent(0,"Saving entities");
- __int64 index = ((__int64)(levelChunk->x) << 32) | (((__int64)(levelChunk->z))&0x00000000FFFFFFFF);
+ int64_t index = ((int64_t)(levelChunk->x) << 32) | (((int64_t)(levelChunk->z))&0x00000000FFFFFFFF);
delete m_entityData[index].data;
@@ -276,7 +276,7 @@ void McRegionChunkStorage::saveEntities(Level *level, LevelChunk *levelChunk)
void McRegionChunkStorage::loadEntities(Level *level, LevelChunk *levelChunk)
{
#ifdef SPLIT_SAVES
- __int64 index = ((__int64)(levelChunk->x) << 32) | (((__int64)(levelChunk->z))&0x00000000FFFFFFFF);
+ int64_t index = ((int64_t)(levelChunk->x) << 32) | (((int64_t)(levelChunk->z))&0x00000000FFFFFFFF);
auto it = m_entityData.find(index);
if(it != m_entityData.end())
@@ -330,8 +330,8 @@ void McRegionChunkStorage::staticCtor()
sprintf(threadName,"McRegion Save thread %d\n",i);
SetThreadName(0, threadName);
- //saveThreads[j] = CreateThread(NULL,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]);
- s_saveThreads[i] = new C4JThread(runSaveThreadProc,NULL,threadName);
+ //saveThreads[j] = CreateThread(nullptr,0,runSaveThreadProc,&threadData[j],CREATE_SUSPENDED,&threadId[j]);
+ s_saveThreads[i] = new C4JThread(runSaveThreadProc,nullptr,threadName);
//app.DebugPrintf("Created new thread: %s\n",threadName);
@@ -359,7 +359,7 @@ int McRegionChunkStorage::runSaveThreadProc(LPVOID lpParam)
bool running = true;
size_t lastQueueSize = 0;
- DataOutputStream *dos = NULL;
+ DataOutputStream *dos = nullptr;
while(running)
{
if( TryEnterCriticalSection(&cs_memory) )
@@ -382,7 +382,7 @@ int McRegionChunkStorage::runSaveThreadProc(LPVOID lpParam)
PIXEndNamedEvent();
}
delete dos;
- dos = NULL;
+ dos = nullptr;
EnterCriticalSection(&cs_memory);
s_runningThreadCount--;