From 7074f35e4ba831e358117842b99ee35b87f85ae5 Mon Sep 17 00:00:00 2001 From: void_17 Date: Mon, 2 Mar 2026 15:58:20 +0700 Subject: shared_ptr -> std::shared_ptr This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today. --- Minecraft.World/MoveThroughVillageGoal.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Minecraft.World/MoveThroughVillageGoal.cpp') diff --git a/Minecraft.World/MoveThroughVillageGoal.cpp b/Minecraft.World/MoveThroughVillageGoal.cpp index 2405374f..40acca5d 100644 --- a/Minecraft.World/MoveThroughVillageGoal.cpp +++ b/Minecraft.World/MoveThroughVillageGoal.cpp @@ -31,10 +31,10 @@ bool MoveThroughVillageGoal::canUse() if (onlyAtNight && mob->level->isDay()) return false; - shared_ptr village = mob->level->villages->getClosestVillage(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 0); + std::shared_ptr village = mob->level->villages->getClosestVillage(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 0); if (village == NULL) return false; - shared_ptr _doorInfo = getNextDoorInfo(village); + std::shared_ptr _doorInfo = getNextDoorInfo(village); if (_doorInfo == NULL) return false; doorInfo = _doorInfo; @@ -59,7 +59,7 @@ bool MoveThroughVillageGoal::canContinueToUse() { if (mob->getNavigation()->isDone()) return false; float dist = mob->bbWidth + 4.f; - shared_ptr _doorInfo = doorInfo.lock(); + std::shared_ptr _doorInfo = doorInfo.lock(); if( _doorInfo == NULL ) return false; return mob->distanceToSqr(_doorInfo->x, _doorInfo->y, _doorInfo->z) > dist * dist; @@ -73,7 +73,7 @@ void MoveThroughVillageGoal::start() void MoveThroughVillageGoal::stop() { - shared_ptr _doorInfo = doorInfo.lock(); + std::shared_ptr _doorInfo = doorInfo.lock(); if( _doorInfo == NULL ) return; if (mob->getNavigation()->isDone() || mob->distanceToSqr(_doorInfo->x, _doorInfo->y, _doorInfo->z) < 4 * 4) @@ -82,15 +82,15 @@ void MoveThroughVillageGoal::stop() } } -shared_ptr MoveThroughVillageGoal::getNextDoorInfo(shared_ptr village) +std::shared_ptr MoveThroughVillageGoal::getNextDoorInfo(std::shared_ptr village) { - shared_ptr closest = nullptr; + std::shared_ptr closest = nullptr; int closestDistSqr = Integer::MAX_VALUE; - vector > *doorInfos = village->getDoorInfos(); + vector > *doorInfos = village->getDoorInfos(); //for (DoorInfo di : doorInfos) for(AUTO_VAR(it, doorInfos->begin()); it != doorInfos->end(); ++it) { - shared_ptr di = *it; + std::shared_ptr di = *it; int distSqr = di->distanceToSqr(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z)); if (distSqr < closestDistSqr) { @@ -102,12 +102,12 @@ shared_ptr MoveThroughVillageGoal::getNextDoorInfo(shared_ptr return closest; } -bool MoveThroughVillageGoal::hasVisited(shared_ptrdi) +bool MoveThroughVillageGoal::hasVisited(std::shared_ptrdi) { //for (DoorInfo di2 : visited) for(AUTO_VAR(it, visited.begin()); it != visited.end(); ) { - shared_ptr di2 = (*it).lock(); + std::shared_ptr di2 = (*it).lock(); if( di2 == NULL ) { it = visited.erase(it); -- cgit v1.2.3