aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/MultiPlayerChunkCache.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-07 21:56:03 -0500
committerGitHub <noreply@github.com>2026-03-08 09:56:03 +0700
commita9be52c41a02d207233199e98898fe7483d7e817 (patch)
tree71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.Client/MultiPlayerChunkCache.cpp
parent1be5faaea781402e7de06b263eeca4c688b7712c (diff)
Project modernization (#630)
* Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides
Diffstat (limited to 'Minecraft.Client/MultiPlayerChunkCache.cpp')
-rw-r--r--Minecraft.Client/MultiPlayerChunkCache.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/Minecraft.Client/MultiPlayerChunkCache.cpp b/Minecraft.Client/MultiPlayerChunkCache.cpp
index a4c200be..62361ce3 100644
--- a/Minecraft.Client/MultiPlayerChunkCache.cpp
+++ b/Minecraft.Client/MultiPlayerChunkCache.cpp
@@ -65,7 +65,7 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level *level)
{
if( y >= 3 )
{
- ((WaterLevelChunk *)waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15);
+ static_cast<WaterLevelChunk *>(waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15);
}
}
}
@@ -77,18 +77,18 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level *level)
{
if( y >= ( level->getSeaLevel() - 1 ) )
{
- ((WaterLevelChunk *)waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15);
+ static_cast<WaterLevelChunk *>(waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15);
}
else
{
- ((WaterLevelChunk *)waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,2);
+ static_cast<WaterLevelChunk *>(waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,2);
}
}
}
}
else
{
- waterChunk = NULL;
+ waterChunk = nullptr;
}
this->level = level;
@@ -132,7 +132,7 @@ bool MultiPlayerChunkCache::reallyHasChunk(int x, int z)
int idx = ix * XZSIZE + iz;
LevelChunk *chunk = cache[idx];
- if( chunk == NULL )
+ if( chunk == nullptr )
{
return false;
}
@@ -166,7 +166,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z)
LevelChunk *chunk = cache[idx];
LevelChunk *lastChunk = chunk;
- if( chunk == NULL )
+ if( chunk == nullptr )
{
EnterCriticalSection(&m_csLoadCreate);
@@ -174,7 +174,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z)
if( g_NetworkManager.IsHost() ) // force here to disable sharing of data
{
// 4J-JEV: We are about to use shared data, abort if the server is stopped and the data is deleted.
- if (MinecraftServer::getInstance()->serverHalted()) return NULL;
+ if (MinecraftServer::getInstance()->serverHalted()) return nullptr;
// If we're the host, then don't create the chunk, share data from the server's copy
#ifdef _LARGE_WORLDS
@@ -248,7 +248,7 @@ LevelChunk *MultiPlayerChunkCache::getChunk(int x, int z)
int idx = ix * XZSIZE + iz;
LevelChunk *chunk = cache[idx];
- if( chunk == NULL )
+ if( chunk == nullptr )
{
return emptyChunk;
}
@@ -279,12 +279,12 @@ void MultiPlayerChunkCache::postProcess(ChunkSource *parent, int x, int z)
vector<Biome::MobSpawnerData *> *MultiPlayerChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z)
{
- return NULL;
+ return nullptr;
}
TilePos *MultiPlayerChunkCache::findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z)
{
- return NULL;
+ return nullptr;
}
void MultiPlayerChunkCache::recreateLogicStructuresForChunk(int chunkX, int chunkZ)
@@ -294,7 +294,7 @@ void MultiPlayerChunkCache::recreateLogicStructuresForChunk(int chunkX, int chun
wstring MultiPlayerChunkCache::gatherStats()
{
EnterCriticalSection(&m_csLoadCreate);
- int size = (int)loadedChunkList.size();
+ int size = static_cast<int>(loadedChunkList.size());
LeaveCriticalSection(&m_csLoadCreate);
return L"MultiplayerChunkCache: " + std::to_wstring(size);