aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-08 19:08:36 -0400
committerGitHub <noreply@github.com>2026-03-08 18:08:36 -0500
commit28614b922fb77149a54da1a87bebfbc98736f296 (patch)
tree7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp
parent88798b501d0cf6287b6f87acb2592676e3cec58d (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/Common/GameRules/UpdatePlayerRuleDefinition.cpp')
-rw-r--r--Minecraft.Client/Common/GameRules/UpdatePlayerRuleDefinition.cpp16
1 files changed, 8 insertions, 8 deletions
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<GameRuleDefinition *> *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<AddItemRuleDefinition *>(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<int>(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<int>(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<int>(attributeValue);
m_spawnPos->z = value;
app.DebugPrintf("UpdatePlayerRuleDefinition: Adding parameter spawnZ=%d\n",value);
@@ -148,7 +148,7 @@ void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> 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> 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)
{