diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-08 19:08:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 18:08:36 -0500 |
| commit | 28614b922fb77149a54da1a87bebfbc98736f296 (patch) | |
| tree | 7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.Client/MultiPlayerChunkCache.cpp | |
| parent | 88798b501d0cf6287b6f87acb2592676e3cec58d (diff) | |
Modernize project codebase (#906)
* 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
* Add safety checks and fix a issue with vector going OOR
Diffstat (limited to 'Minecraft.Client/MultiPlayerChunkCache.cpp')
| -rw-r--r-- | Minecraft.Client/MultiPlayerChunkCache.cpp | 22 |
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); |
