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 --- Minecraft.World/Vec3.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Minecraft.World/Vec3.cpp') diff --git a/Minecraft.World/Vec3.cpp b/Minecraft.World/Vec3.cpp index 1fc26fd5..b513c149 100644 --- a/Minecraft.World/Vec3.cpp +++ b/Minecraft.World/Vec3.cpp @@ -3,7 +3,7 @@ #include "AABB.h" DWORD Vec3::tlsIdx = 0; -Vec3::ThreadStorage *Vec3::tlsDefault = NULL; +Vec3::ThreadStorage *Vec3::tlsDefault = nullptr; Vec3::ThreadStorage::ThreadStorage() { @@ -19,7 +19,7 @@ Vec3::ThreadStorage::~ThreadStorage() void Vec3::CreateNewThreadStorage() { ThreadStorage *tls = new ThreadStorage(); - if(tlsDefault == NULL ) + if(tlsDefault == nullptr ) { tlsIdx = TlsAlloc(); tlsDefault = tls; @@ -34,7 +34,7 @@ void Vec3::UseDefaultThreadStorage() void Vec3::ReleaseThreadStorage() { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); if( tls == tlsDefault ) return; delete tls; @@ -55,7 +55,7 @@ void Vec3::resetPool() Vec3 *Vec3::newTemp(double x, double y, double z) { - ThreadStorage *tls = (ThreadStorage *)TlsGetValue(tlsIdx); + ThreadStorage *tls = static_cast(TlsGetValue(tlsIdx)); Vec3 *thisVec = &tls->pool[tls->poolPointer]; thisVec->set(x, y, z); tls->poolPointer = ( tls->poolPointer + 1 ) % ThreadStorage::POOL_SIZE; @@ -157,10 +157,10 @@ Vec3 *Vec3::clipX(Vec3 *b, double xt) double yd = b->y - y; double zd = b->z - z; - if (xd * xd < 0.0000001f) return NULL; + if (xd * xd < 0.0000001f) return nullptr; double d = (xt - x) / xd; - if (d < 0 || d > 1) return NULL; + if (d < 0 || d > 1) return nullptr; return Vec3::newTemp(x + xd * d, y + yd * d, z + zd * d); } @@ -170,10 +170,10 @@ Vec3 *Vec3::clipY(Vec3 *b, double yt) double yd = b->y - y; double zd = b->z - z; - if (yd * yd < 0.0000001f) return NULL; + if (yd * yd < 0.0000001f) return nullptr; double d = (yt - y) / yd; - if (d < 0 || d > 1) return NULL; + if (d < 0 || d > 1) return nullptr; return Vec3::newTemp(x + xd * d, y + yd * d, z + zd * d); } @@ -183,10 +183,10 @@ Vec3 *Vec3::clipZ(Vec3 *b, double zt) double yd = b->y - y; double zd = b->z - z; - if (zd * zd < 0.0000001f) return NULL; + if (zd * zd < 0.0000001f) return nullptr; double d = (zt - z) / zd; - if (d < 0 || d > 1) return NULL; + if (d < 0 || d > 1) return nullptr; return Vec3::newTemp(x + xd * d, y + yd * d, z + zd * d); } -- cgit v1.2.3