From 28614b922fb77149a54da1a87bebfbc98736f296 Mon Sep 17 00:00:00 2001 From: ModMaker101 <119018978+ModMaker101@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:08:36 -0400 Subject: 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 --- Minecraft.World/LevelData.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Minecraft.World/LevelData.cpp') diff --git a/Minecraft.World/LevelData.cpp b/Minecraft.World/LevelData.cpp index 05bc2060..fbc10ddb 100644 --- a/Minecraft.World/LevelData.cpp +++ b/Minecraft.World/LevelData.cpp @@ -18,7 +18,7 @@ LevelData::LevelData(CompoundTag *tag) { wstring generatorName = tag->getString(L"generatorName"); m_pGenerator = LevelType::getLevelType(generatorName); - if (m_pGenerator == NULL) + if (m_pGenerator == nullptr) { m_pGenerator = LevelType::lvl_normal; } @@ -188,8 +188,13 @@ LevelData::LevelData(CompoundTag *tag) dimension = loadedPlayerTag->getInt(L"Dimension"); } else +<<<<<<< HEAD + { + this->loadedPlayerTag = nullptr; +======= { this->loadedPlayerTag = NULL; +>>>>>>> origin/main } */ dimension = 0; @@ -215,7 +220,7 @@ LevelData::LevelData(LevelSettings *levelSettings, const wstring& levelName) gameTime = -1; lastPlayed = 0; sizeOnDisk = 0; - // this->loadedPlayerTag = NULL; // 4J - we don't store this anymore + // this->loadedPlayerTag = nullptr; // 4J - we don't store this anymore dimension = 0; version = 0; rainTime = 0; @@ -432,7 +437,7 @@ int64_t LevelData::getSizeOnDisk() CompoundTag *LevelData::getLoadedPlayerTag() { - return NULL; // 4J - we don't store this anymore + return nullptr; // 4J - we don't store this anymore } // 4J Removed TU9 as it's never accurate due to the dimension never being set @@ -712,7 +717,7 @@ void LevelData::getMoatFlags(bool* bClassicEdgeMoat, bool* bSmallEdgeMoat, bool* int LevelData::getXZHellSizeOld() { - int hellXZSizeOld = ceil((float)m_xzSizeOld / m_hellScaleOld); + int hellXZSizeOld = ceil(static_cast(m_xzSizeOld) / m_hellScaleOld); while(hellXZSizeOld > HELL_LEVEL_MAX_WIDTH && m_hellScaleOld < HELL_LEVEL_MAX_SCALE) { -- cgit v1.2.3