From a9be52c41a02d207233199e98898fe7483d7e817 Mon Sep 17 00:00:00 2001 From: ModMaker101 <119018978+ModMaker101@users.noreply.github.com> Date: Sat, 7 Mar 2026 21:56:03 -0500 Subject: 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 --- .../Common/GameRules/UpdatePlayerRuleDefinition.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp') diff --git a/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp b/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp index ec218c7a..99aee99b 100644 --- a/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp +++ b/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp @@ -12,7 +12,7 @@ UpdatePlayerRuleDefinition::UpdatePlayerRuleDefinition() m_bUpdateHealth = m_bUpdateFood = m_bUpdateYRot = false;; m_health = 0; m_food = 0; - m_spawnPos = NULL; + m_spawnPos = nullptr; m_yRot = 0.0f; } @@ -65,11 +65,11 @@ void UpdatePlayerRuleDefinition::getChildren(vector *child GameRuleDefinition *UpdatePlayerRuleDefinition::addChild(ConsoleGameRules::EGameRuleType ruleType) { - GameRuleDefinition *rule = NULL; + GameRuleDefinition *rule = nullptr; if(ruleType == ConsoleGameRules::eGameRuleType_AddItem) { rule = new AddItemRuleDefinition(); - m_items.push_back((AddItemRuleDefinition *)rule); + m_items.push_back(static_cast(rule)); } else { @@ -84,21 +84,21 @@ void UpdatePlayerRuleDefinition::addAttribute(const wstring &attributeName, cons { if(attributeName.compare(L"spawnX") == 0) { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); + if(m_spawnPos == nullptr) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->x = value; app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnX=%d\n",value); } else if(attributeName.compare(L"spawnY") == 0) { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); + if(m_spawnPos == nullptr) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->y = value; app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnY=%d\n",value); } else if(attributeName.compare(L"spawnZ") == 0) { - if(m_spawnPos == NULL) m_spawnPos = new Pos(); + if(m_spawnPos == nullptr) m_spawnPos = new Pos(); int value = _fromString(attributeValue); m_spawnPos->z = value; app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnZ=%d\n",value); @@ -148,7 +148,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr player) double z = player->z; float yRot = player->yRot; float xRot = player->xRot; - if(m_spawnPos != NULL) + if(m_spawnPos != nullptr) { x = m_spawnPos->x; y = m_spawnPos->y; @@ -160,7 +160,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr player) yRot = m_yRot; } - if(m_spawnPos != NULL || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot); + if(m_spawnPos != nullptr || m_bUpdateYRot) player->absMoveTo(x,y,z,yRot,xRot); for(auto& addItem : m_items) { -- cgit v1.2.3