aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/Path.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.World/Path.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.World/Path.cpp')
-rw-r--r--Minecraft.World/Path.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Minecraft.World/Path.cpp b/Minecraft.World/Path.cpp
index 538917f6..afea4a17 100644
--- a/Minecraft.World/Path.cpp
+++ b/Minecraft.World/Path.cpp
@@ -46,7 +46,7 @@ Node *Path::last()
{
return nodes[length - 1];
}
- return NULL;
+ return nullptr;
}
Node *Path::get(int i)
@@ -76,9 +76,9 @@ void Path::setIndex(int index)
Vec3 *Path::getPos(shared_ptr<Entity> e, int index)
{
- double x = nodes[index]->x + (int) (e->bbWidth + 1) * 0.5;
+ double x = nodes[index]->x + static_cast<int>(e->bbWidth + 1) * 0.5;
double y = nodes[index]->y;
- double z = nodes[index]->z + (int) (e->bbWidth + 1) * 0.5;
+ double z = nodes[index]->z + static_cast<int>(e->bbWidth + 1) * 0.5;
return Vec3::newTemp(x, y, z);
}
@@ -94,7 +94,7 @@ Vec3 *Path::currentPos()
bool Path::sameAs(Path *path)
{
- if (path == NULL) return false;
+ if (path == nullptr) return false;
if (path->nodes.length != nodes.length) return false;
for (int i = 0; i < nodes.length; ++i)
if (nodes[i]->x != path->nodes[i]->x || nodes[i]->y != path->nodes[i]->y || nodes[i]->z != path->nodes[i]->z) return false;
@@ -104,13 +104,13 @@ bool Path::sameAs(Path *path)
bool Path::endsIn(Vec3 *pos)
{
Node *lastNode = last();
- if (lastNode == NULL) return false;
- return lastNode->x == (int) pos->x && lastNode->y == (int) pos->y && lastNode->z == (int) pos->z;
+ if (lastNode == nullptr) return false;
+ return lastNode->x == static_cast<int>(pos->x) && lastNode->y == static_cast<int>(pos->y) && lastNode->z == static_cast<int>(pos->z);
}
bool Path::endsInXZ(Vec3 *pos)
{
Node *lastNode = last();
- if (lastNode == NULL) return false;
- return lastNode->x == (int) pos->x && lastNode->z == (int) pos->z;
+ if (lastNode == nullptr) return false;
+ return lastNode->x == static_cast<int>(pos->x) && lastNode->z == static_cast<int>(pos->z);
} \ No newline at end of file