aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/MoveThroughVillageGoal.cpp
diff options
context:
space:
mode:
authorvoid_17 <heroerror3@gmail.com>2026-03-02 15:58:20 +0700
committervoid_17 <heroerror3@gmail.com>2026-03-02 15:58:20 +0700
commit7074f35e4ba831e358117842b99ee35b87f85ae5 (patch)
tree7d440d23473196af3056bf2ff4c59d9e740a06f5 /Minecraft.World/MoveThroughVillageGoal.cpp
parentd63f79325f85e014361eb8cf1e41eaebedb1ae71 (diff)
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.
Diffstat (limited to 'Minecraft.World/MoveThroughVillageGoal.cpp')
-rw-r--r--Minecraft.World/MoveThroughVillageGoal.cpp20
1 files changed, 10 insertions, 10 deletions
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> village = mob->level->villages->getClosestVillage(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 0);
+ std::shared_ptr<Village> 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> _doorInfo = getNextDoorInfo(village);
+ std::shared_ptr<DoorInfo> _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 = doorInfo.lock();
+ std::shared_ptr<DoorInfo> _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 = doorInfo.lock();
+ std::shared_ptr<DoorInfo> _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<DoorInfo> MoveThroughVillageGoal::getNextDoorInfo(shared_ptr<Village> village)
+std::shared_ptr<DoorInfo> MoveThroughVillageGoal::getNextDoorInfo(std::shared_ptr<Village> village)
{
- shared_ptr<DoorInfo> closest = nullptr;
+ std::shared_ptr<DoorInfo> closest = nullptr;
int closestDistSqr = Integer::MAX_VALUE;
- vector<shared_ptr<DoorInfo> > *doorInfos = village->getDoorInfos();
+ vector<std::shared_ptr<DoorInfo> > *doorInfos = village->getDoorInfos();
//for (DoorInfo di : doorInfos)
for(AUTO_VAR(it, doorInfos->begin()); it != doorInfos->end(); ++it)
{
- shared_ptr<DoorInfo> di = *it;
+ std::shared_ptr<DoorInfo> 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<DoorInfo> MoveThroughVillageGoal::getNextDoorInfo(shared_ptr<Village>
return closest;
}
-bool MoveThroughVillageGoal::hasVisited(shared_ptr<DoorInfo>di)
+bool MoveThroughVillageGoal::hasVisited(std::shared_ptr<DoorInfo>di)
{
//for (DoorInfo di2 : visited)
for(AUTO_VAR(it, visited.begin()); it != visited.end(); )
{
- shared_ptr<DoorInfo> di2 = (*it).lock();
+ std::shared_ptr<DoorInfo> di2 = (*it).lock();
if( di2 == NULL )
{
it = visited.erase(it);