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.Client/EntityTracker.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Minecraft.Client/EntityTracker.cpp') diff --git a/Minecraft.Client/EntityTracker.cpp b/Minecraft.Client/EntityTracker.cpp index db175542..087227e7 100644 --- a/Minecraft.Client/EntityTracker.cpp +++ b/Minecraft.Client/EntityTracker.cpp @@ -59,7 +59,7 @@ void EntityTracker::addEntity(shared_ptr e) else if (e->instanceof(eTYPE_SQUID)) addEntity(e, 16 * 4, 1, true); else if (e->instanceof(eTYPE_WITHERBOSS)) addEntity(e, 16 * 5, 1, false); else if (e->instanceof(eTYPE_BAT)) addEntity(e, 16 * 5, 1, false); - else if (dynamic_pointer_cast(e)!=NULL) addEntity(e, 16 * 5, 1, true); + else if (dynamic_pointer_cast(e)!=nullptr) addEntity(e, 16 * 5, 1, true); else if (e->instanceof(eTYPE_ENDERDRAGON)) addEntity(e, 16 * 10, 1, true); else if (e->instanceof(eTYPE_PRIMEDTNT)) addEntity(e, 16 * 10, 10, true); else if (e->instanceof(eTYPE_FALLINGTILE)) addEntity(e, 16 * 10, 20, true); @@ -85,7 +85,7 @@ void EntityTracker::addEntity(shared_ptr e, int range, int updateInterva { __debugbreak(); } - shared_ptr te = shared_ptr( new TrackedEntity(e, range, updateInterval, trackDeltas) ); + shared_ptr te = std::make_shared(e, range, updateInterval, trackDeltas); entities.insert(te); entityMap[e->entityId] = te; te->updatePlayers(this, &level->players); @@ -145,9 +145,9 @@ void EntityTracker::tick() shared_ptr ep = server->getPlayers()->players[i]; if( ep->dimension != level->dimension->id ) continue; - if( ep->connection == NULL ) continue; + if( ep->connection == nullptr ) continue; INetworkPlayer *thisPlayer = ep->connection->getNetworkPlayer(); - if( thisPlayer == NULL ) continue; + if( thisPlayer == nullptr ) continue; bool addPlayer = false; for (unsigned int j = 0; j < movedPlayers.size(); j++) @@ -156,9 +156,9 @@ void EntityTracker::tick() if( sp == ep ) break; - if(sp->connection == NULL) continue; + if(sp->connection == nullptr) continue; INetworkPlayer *otherPlayer = sp->connection->getNetworkPlayer(); - if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) ) + if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) ) { addPlayer = true; break; @@ -170,7 +170,7 @@ void EntityTracker::tick() for (unsigned int i = 0; i < movedPlayers.size(); i++) { shared_ptr player = movedPlayers[i]; - if(player->connection == NULL) continue; + if(player->connection == nullptr) continue; for( auto& te : entities ) { if ( te && te->e != player) -- cgit v1.2.3