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.
This commit is contained in:
void_17
2026-03-02 15:58:20 +07:00
parent d63f79325f
commit 7074f35e4b
1373 changed files with 12054 additions and 12054 deletions

View File

@@ -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);