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
This commit is contained in:
@@ -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<ThreadStorage *>(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<ThreadStorage *>(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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user