diff options
| author | void_17 <heroerror3@gmail.com> | 2026-03-02 15:58:20 +0700 |
|---|---|---|
| committer | void_17 <heroerror3@gmail.com> | 2026-03-02 15:58:20 +0700 |
| commit | 7074f35e4ba831e358117842b99ee35b87f85ae5 (patch) | |
| tree | 7d440d23473196af3056bf2ff4c59d9e740a06f5 /Minecraft.World/TargetGoal.cpp | |
| parent | d63f79325f85e014361eb8cf1e41eaebedb1ae71 (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/TargetGoal.cpp')
| -rw-r--r-- | Minecraft.World/TargetGoal.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Minecraft.World/TargetGoal.cpp b/Minecraft.World/TargetGoal.cpp index c3ac4f59..28102c60 100644 --- a/Minecraft.World/TargetGoal.cpp +++ b/Minecraft.World/TargetGoal.cpp @@ -32,7 +32,7 @@ TargetGoal::TargetGoal(Mob *mob, float within, bool mustSee, bool mustReach) bool TargetGoal::canContinueToUse() { - shared_ptr<Mob> target = mob->getTarget(); + std::shared_ptr<Mob> target = mob->getTarget(); if (target == NULL) return false; if (!target->isAlive()) return false; if (mob->distanceToSqr(target) > within * within) return false; @@ -62,17 +62,17 @@ void TargetGoal::stop() mob->setTarget(nullptr); } -bool TargetGoal::canAttack(shared_ptr<Mob> target, bool allowInvulnerable) +bool TargetGoal::canAttack(std::shared_ptr<Mob> target, bool allowInvulnerable) { if (target == NULL) return false; if (target == mob->shared_from_this()) return false; if (!target->isAlive()) return false; if (!mob->canAttackType(target->GetType())) return false; - shared_ptr<TamableAnimal> tamableAnimal = dynamic_pointer_cast<TamableAnimal>(mob->shared_from_this()); + std::shared_ptr<TamableAnimal> tamableAnimal = dynamic_pointer_cast<TamableAnimal>(mob->shared_from_this()); if (tamableAnimal != NULL && tamableAnimal->isTame()) { - shared_ptr<TamableAnimal> tamableTarget = dynamic_pointer_cast<TamableAnimal>(target); + std::shared_ptr<TamableAnimal> tamableTarget = dynamic_pointer_cast<TamableAnimal>(target); if (tamableTarget != NULL && tamableTarget->isTame()) return false; if (target == tamableAnimal->getOwner()) return false; } @@ -95,7 +95,7 @@ bool TargetGoal::canAttack(shared_ptr<Mob> target, bool allowInvulnerable) return true; } -bool TargetGoal::canReach(shared_ptr<Mob> target) +bool TargetGoal::canReach(std::shared_ptr<Mob> target) { reachCacheTime = 10 + mob->getRandom()->nextInt(5); Path *path = mob->getNavigation()->createPath(target); |
