mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-30 09:55:35 +00:00
refactor: replace NULL with nullptr across C++ codebase
Excludes vendored C libs (zlib, Miles, DirectXMath, boost, Iggy).
This commit is contained in:
@@ -73,7 +73,7 @@ bool ServerChunkCache::hasChunk(int x, int z) {
|
||||
if ((iz < 0) || (iz >= XZSIZE)) return true;
|
||||
int idx = ix * XZSIZE + iz;
|
||||
LevelChunk* lc = cache[idx];
|
||||
if (lc == NULL) return false;
|
||||
if (lc == nullptr) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -145,17 +145,17 @@ LevelChunk* ServerChunkCache::create(
|
||||
LevelChunk* chunk = cache[idx];
|
||||
LevelChunk* lastChunk = chunk;
|
||||
|
||||
if ((chunk == NULL) || (chunk->x != x) || (chunk->z != z)) {
|
||||
if ((chunk == nullptr) || (chunk->x != x) || (chunk->z != z)) {
|
||||
EnterCriticalSection(&m_csLoadCreate);
|
||||
chunk = load(x, z);
|
||||
if (chunk == NULL) {
|
||||
if (source == NULL) {
|
||||
if (chunk == nullptr) {
|
||||
if (source == nullptr) {
|
||||
chunk = emptyChunk;
|
||||
} else {
|
||||
chunk = source->getChunk(x, z);
|
||||
}
|
||||
}
|
||||
if (chunk != NULL) {
|
||||
if (chunk != nullptr) {
|
||||
chunk->load();
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ void ServerChunkCache::overwriteLevelChunkFromSource(int x, int z) {
|
||||
if ((iz < 0) || (iz >= XZSIZE)) assert(0);
|
||||
int idx = ix * XZSIZE + iz;
|
||||
|
||||
LevelChunk* chunk = NULL;
|
||||
LevelChunk* chunk = nullptr;
|
||||
chunk = source->getChunk(x, z);
|
||||
assert(chunk);
|
||||
if (chunk) {
|
||||
@@ -418,35 +418,35 @@ void ServerChunkCache::dontDrop(int x, int z) {
|
||||
#endif
|
||||
|
||||
LevelChunk* ServerChunkCache::load(int x, int z) {
|
||||
if (storage == NULL) return NULL;
|
||||
if (storage == nullptr) return nullptr;
|
||||
|
||||
LevelChunk* levelChunk = NULL;
|
||||
LevelChunk* levelChunk = nullptr;
|
||||
|
||||
#if defined(_LARGE_WORLDS)
|
||||
int ix = x + XZOFFSET;
|
||||
int iz = z + XZOFFSET;
|
||||
int idx = ix * XZSIZE + iz;
|
||||
levelChunk = m_unloadedCache[idx];
|
||||
m_unloadedCache[idx] = NULL;
|
||||
if (levelChunk == NULL)
|
||||
m_unloadedCache[idx] = nullptr;
|
||||
if (levelChunk == nullptr)
|
||||
#endif
|
||||
{
|
||||
levelChunk = storage->load(level, x, z);
|
||||
}
|
||||
if (levelChunk != NULL) {
|
||||
if (levelChunk != nullptr) {
|
||||
levelChunk->lastSaveTime = level->getGameTime();
|
||||
}
|
||||
return levelChunk;
|
||||
}
|
||||
|
||||
void ServerChunkCache::saveEntities(LevelChunk* levelChunk) {
|
||||
if (storage == NULL) return;
|
||||
if (storage == nullptr) return;
|
||||
|
||||
storage->saveEntities(level, levelChunk);
|
||||
}
|
||||
|
||||
void ServerChunkCache::save(LevelChunk* levelChunk) {
|
||||
if (storage == NULL) return;
|
||||
if (storage == nullptr) return;
|
||||
|
||||
levelChunk->lastSaveTime = level->getGameTime();
|
||||
storage->save(level, levelChunk);
|
||||
@@ -584,7 +584,7 @@ void ServerChunkCache::postProcess(ChunkSource* parent, int x, int z) {
|
||||
LevelChunk* chunk = getChunk(x, z);
|
||||
if ((chunk->terrainPopulated & LevelChunk::sTerrainPopulatedFromHere) ==
|
||||
0) {
|
||||
if (source != NULL) {
|
||||
if (source != nullptr) {
|
||||
PIXBeginNamedEvent(0, "Main post processing");
|
||||
source->postProcess(parent, x, z);
|
||||
PIXEndNamedEvent();
|
||||
@@ -675,7 +675,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
|
||||
|
||||
// 4J - added this to support progressListner
|
||||
int count = 0;
|
||||
if (progressListener != NULL) {
|
||||
if (progressListener != nullptr) {
|
||||
AUTO_VAR(itEnd, m_loadedChunkList.end());
|
||||
for (AUTO_VAR(it, m_loadedChunkList.begin()); it != itEnd; it++) {
|
||||
LevelChunk* chunk = *it;
|
||||
@@ -706,7 +706,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
|
||||
}
|
||||
|
||||
// 4J - added this to support progressListener
|
||||
if (progressListener != NULL) {
|
||||
if (progressListener != nullptr) {
|
||||
if (++cc % 10 == 0) {
|
||||
progressListener->progressStagePercentage(cc * 100 /
|
||||
count);
|
||||
@@ -756,7 +756,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
|
||||
}
|
||||
|
||||
// 4J - added this to support progressListener
|
||||
if (progressListener != NULL) {
|
||||
if (progressListener != nullptr) {
|
||||
if (++cc % 10 == 0) {
|
||||
progressListener->progressStagePercentage(cc * 100 /
|
||||
count);
|
||||
@@ -775,7 +775,7 @@ bool ServerChunkCache::save(bool force, ProgressListener* progressListener) {
|
||||
}
|
||||
|
||||
if (force) {
|
||||
if (storage == NULL) {
|
||||
if (storage == nullptr) {
|
||||
LeaveCriticalSection(&m_csLoadCreate);
|
||||
return true;
|
||||
}
|
||||
@@ -822,14 +822,14 @@ bool ServerChunkCache::tick() {
|
||||
int iz = chunk->z + XZOFFSET;
|
||||
int idx = ix * XZSIZE + iz;
|
||||
m_unloadedCache[idx] = chunk;
|
||||
cache[idx] = NULL;
|
||||
cache[idx] = nullptr;
|
||||
}
|
||||
}
|
||||
m_toDrop.pop_front();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (storage != NULL) storage->tick();
|
||||
if (storage != nullptr) storage->tick();
|
||||
}
|
||||
|
||||
return source->tick();
|
||||
@@ -872,7 +872,7 @@ int ServerChunkCache::runSaveThreadProc(LPVOID lpParam) {
|
||||
|
||||
// app.DebugPrintf("Save thread has started\n");
|
||||
|
||||
while (params->chunkToSave != NULL) {
|
||||
while (params->chunkToSave != nullptr) {
|
||||
PIXBeginNamedEvent(0, "Saving entities");
|
||||
// app.DebugPrintf("Save thread has started processing a chunk\n");
|
||||
if (params->saveEntities)
|
||||
|
||||
Reference in New Issue
Block a user