From 653a2c4289a2fd2ea52ece5739caddc160ad16cb Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 6 Mar 2026 20:39:58 -0600 Subject: [PATCH] fix: stupid --- Minecraft.Client/Level/MultiPlayerLevel.cpp | 2 +- .../Platform/Durango/Network/ChatIntegrationLayer.cpp | 2 +- Minecraft.World/AI/Control/Sensing.cpp | 4 ++-- Minecraft.World/AI/Control/Sensing.h | 4 ++-- Minecraft.World/AI/Goals/ArrowAttackGoal.cpp | 6 +++--- Minecraft.World/AI/Goals/ArrowAttackGoal.h | 2 +- Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp | 8 ++++---- Minecraft.World/AI/Goals/AvoidPlayerGoal.h | 2 +- Minecraft.World/AI/Goals/BegGoal.cpp | 6 +++--- Minecraft.World/AI/Goals/BegGoal.h | 2 +- Minecraft.World/AI/Goals/BreedGoal.cpp | 6 +++--- Minecraft.World/AI/Goals/BreedGoal.h | 2 +- Minecraft.World/AI/Goals/DefendVillageTargetGoal.cpp | 2 +- Minecraft.World/AI/Goals/DefendVillageTargetGoal.h | 2 +- Minecraft.World/AI/Goals/FollowOwnerGoal.cpp | 6 +++--- Minecraft.World/AI/Goals/FollowOwnerGoal.h | 2 +- Minecraft.World/AI/Goals/FollowParentGoal.cpp | 4 ++-- Minecraft.World/AI/Goals/FollowParentGoal.h | 2 +- Minecraft.World/AI/Goals/LeapAtTargetGoal.cpp | 4 ++-- Minecraft.World/AI/Goals/LeapAtTargetGoal.h | 2 +- Minecraft.World/AI/Goals/LookAtPlayerGoal.cpp | 4 ++-- Minecraft.World/AI/Goals/LookAtPlayerGoal.h | 2 +- Minecraft.World/AI/Goals/LookAtTradingPlayerGoal.cpp | 2 +- Minecraft.World/AI/Goals/MakeLoveGoal.cpp | 10 +++++----- Minecraft.World/AI/Goals/MakeLoveGoal.h | 4 ++-- Minecraft.World/AI/Goals/MeleeAttackGoal.cpp | 4 ++-- Minecraft.World/AI/Goals/MeleeAttackGoal.h | 2 +- Minecraft.World/AI/Goals/MoveIndoorsGoal.cpp | 6 +++--- Minecraft.World/AI/Goals/MoveIndoorsGoal.h | 2 +- Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp | 2 +- Minecraft.World/AI/Goals/MoveThroughVillageGoal.h | 4 ++-- Minecraft.World/AI/Goals/MoveTowardsTargetGoal.cpp | 4 ++-- Minecraft.World/AI/Goals/MoveTowardsTargetGoal.h | 2 +- .../AI/Goals/NearestAttackableTargetGoal.cpp | 4 ++-- Minecraft.World/AI/Goals/NearestAttackableTargetGoal.h | 2 +- Minecraft.World/AI/Goals/OcelotAttackGoal.cpp | 6 +++--- Minecraft.World/AI/Goals/OcelotAttackGoal.h | 2 +- Minecraft.World/AI/Goals/OfferFlowerGoal.cpp | 4 ++-- Minecraft.World/AI/Goals/OfferFlowerGoal.h | 2 +- Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.cpp | 2 +- Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.h | 2 +- Minecraft.World/AI/Goals/OwnerHurtTargetGoal.cpp | 2 +- Minecraft.World/AI/Goals/OwnerHurtTargetGoal.h | 2 +- Minecraft.World/AI/Goals/PlayGoal.cpp | 6 +++--- Minecraft.World/AI/Goals/PlayGoal.h | 2 +- Minecraft.World/AI/Goals/RestrictOpenDoorGoal.cpp | 2 +- Minecraft.World/AI/Goals/RestrictOpenDoorGoal.h | 2 +- Minecraft.World/AI/Goals/SwellGoal.cpp | 6 +++--- Minecraft.World/AI/Goals/SwellGoal.h | 2 +- Minecraft.World/AI/Goals/TakeFlowerGoal.cpp | 6 +++--- Minecraft.World/AI/Goals/TakeFlowerGoal.h | 2 +- Minecraft.World/AI/Goals/TemptGoal.cpp | 6 +++--- Minecraft.World/AI/Goals/TemptGoal.h | 2 +- .../Blocks/TileEntities/ChestTileEntity.cpp | 8 ++++---- Minecraft.World/Blocks/TileEntities/ChestTileEntity.h | 8 ++++---- Minecraft.World/Entities/Entity.cpp | 6 +++--- Minecraft.World/Entities/Entity.h | 2 +- Minecraft.World/Entities/Mobs/Animal.h | 2 +- Minecraft.World/Entities/Mobs/Boat.cpp | 2 +- Minecraft.World/Entities/Mobs/Minecart.cpp | 2 +- Minecraft.World/Entities/Mobs/Villager.cpp | 6 +++--- Minecraft.World/Entities/Mobs/Villager.h | 4 ++-- Minecraft.World/Entities/Mobs/VillagerGolem.cpp | 2 +- Minecraft.World/Entities/Mobs/VillagerGolem.h | 2 +- Minecraft.World/Level/Events/VillageSiege.cpp | 2 +- Minecraft.World/Level/Events/VillageSiege.h | 2 +- Minecraft.World/Level/Level.cpp | 4 ++-- Minecraft.World/Player/Player.cpp | 2 +- 68 files changed, 118 insertions(+), 118 deletions(-) diff --git a/Minecraft.Client/Level/MultiPlayerLevel.cpp b/Minecraft.Client/Level/MultiPlayerLevel.cpp index 5ff909bfb..9e8a96803 100644 --- a/Minecraft.Client/Level/MultiPlayerLevel.cpp +++ b/Minecraft.Client/Level/MultiPlayerLevel.cpp @@ -818,7 +818,7 @@ void MultiPlayerLevel::removeAllPendingEntityRemovals() { if (e->riding->removed || e->riding->rider.lock() != e) { - e->riding->rider = std::(); + e->riding->rider = std::weak_ptr(); e->riding = nullptr; } else diff --git a/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.cpp b/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.cpp index 12e08b7cc..95d353875 100644 --- a/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.cpp +++ b/Minecraft.Client/Platform/Durango/Network/ChatIntegrationLayer.cpp @@ -63,7 +63,7 @@ void ChatIntegrationLayer::InitializeChatManager( InitializeCriticalSection(&m_csAddedUsers); - std:: weakPtrToThis = shared_from_this(); + std::weak_ptr weakPtrToThis = shared_from_this(); #ifdef PROFILE m_chatManager->ChatSettings->PerformanceCountersEnabled = true; diff --git a/Minecraft.World/AI/Control/Sensing.cpp b/Minecraft.World/AI/Control/Sensing.cpp index 32762c994..8e63d8419 100644 --- a/Minecraft.World/AI/Control/Sensing.cpp +++ b/Minecraft.World/AI/Control/Sensing.cpp @@ -29,7 +29,7 @@ bool Sensing::canSee(std::shared_ptr target) //util.Timer.push("canSee"); bool canSee = mob->canSee(target); //util.Timer.pop(); - if (canSee) seen.push_back(std::(target)); - else unseen.push_back(std::(target)); + if (canSee) seen.push_back(std::weak_ptr(target)); + else unseen.push_back(std::weak_ptr(target)); return canSee; } \ No newline at end of file diff --git a/Minecraft.World/AI/Control/Sensing.h b/Minecraft.World/AI/Control/Sensing.h index d05f13919..7359325f8 100644 --- a/Minecraft.World/AI/Control/Sensing.h +++ b/Minecraft.World/AI/Control/Sensing.h @@ -4,8 +4,8 @@ class Sensing { private: Mob *mob; - std::vector > seen; - std::vector > unseen; + std::vector > seen; + std::vector > unseen; public: Sensing(Mob *mob); diff --git a/Minecraft.World/AI/Goals/ArrowAttackGoal.cpp b/Minecraft.World/AI/Goals/ArrowAttackGoal.cpp index aa49b7d8a..358366279 100644 --- a/Minecraft.World/AI/Goals/ArrowAttackGoal.cpp +++ b/Minecraft.World/AI/Goals/ArrowAttackGoal.cpp @@ -12,7 +12,7 @@ ArrowAttackGoal::ArrowAttackGoal(Mob *mob, float speed, int projectileType, int attackInterval) { // 4J Init - target = std::(); + target = std::weak_ptr(); attackTime = 0; seeTime = 0; @@ -28,7 +28,7 @@ bool ArrowAttackGoal::canUse() { std::shared_ptr bestTarget = mob->getTarget(); if (bestTarget == NULL) return false; - target = std::(bestTarget); + target = std::weak_ptr(bestTarget); return true; } @@ -39,7 +39,7 @@ bool ArrowAttackGoal::canContinueToUse() void ArrowAttackGoal::stop() { - target = std::(); + target = std::weak_ptr(); } void ArrowAttackGoal::tick() diff --git a/Minecraft.World/AI/Goals/ArrowAttackGoal.h b/Minecraft.World/AI/Goals/ArrowAttackGoal.h index 37db8b3e8..9f015abda 100644 --- a/Minecraft.World/AI/Goals/ArrowAttackGoal.h +++ b/Minecraft.World/AI/Goals/ArrowAttackGoal.h @@ -10,7 +10,7 @@ public: Level *level; Mob *mob; // Owner of this goal - std:: target; + std::weak_ptr target; int attackTime; float speed; int seeTime; diff --git a/Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp b/Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp index 491333d81..5aafb0897 100644 --- a/Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp +++ b/Minecraft.World/AI/Goals/AvoidPlayerGoal.cpp @@ -20,7 +20,7 @@ AvoidPlayerGoal::AvoidPlayerGoal(PathfinderMob *mob, const std::type_info& avoid this->pathNav = mob->getNavigation(); setRequiredControlFlags(Control::MoveControlFlag); - toAvoid = std::(); + toAvoid = std::weak_ptr(); path = NULL; } @@ -35,7 +35,7 @@ bool AvoidPlayerGoal::canUse() { std::shared_ptr tamableAnimal = dynamic_pointer_cast(mob->shared_from_this()); if (tamableAnimal != NULL && tamableAnimal->isTame()) return false; - toAvoid = std::(mob->level->getNearestPlayer(mob->shared_from_this(), maxDist)); + toAvoid = std::weak_ptr(mob->level->getNearestPlayer(mob->shared_from_this(), maxDist)); if (toAvoid.lock() == NULL) return false; } else @@ -46,7 +46,7 @@ bool AvoidPlayerGoal::canUse() delete entities; return false; } - toAvoid = std::(entities->at(0)); + toAvoid = std::weak_ptr(entities->at(0)); delete entities; } @@ -75,7 +75,7 @@ void AvoidPlayerGoal::start() void AvoidPlayerGoal::stop() { - toAvoid = std::(); + toAvoid = std::weak_ptr(); } void AvoidPlayerGoal::tick() diff --git a/Minecraft.World/AI/Goals/AvoidPlayerGoal.h b/Minecraft.World/AI/Goals/AvoidPlayerGoal.h index 572aa1360..f4705d2c0 100644 --- a/Minecraft.World/AI/Goals/AvoidPlayerGoal.h +++ b/Minecraft.World/AI/Goals/AvoidPlayerGoal.h @@ -11,7 +11,7 @@ class AvoidPlayerGoal : public Goal private: PathfinderMob *mob; // Owner of this goal float walkSpeed, sprintSpeed; - std:: toAvoid; + std::weak_ptr toAvoid; float maxDist; Path *path; PathNavigation *pathNav; diff --git a/Minecraft.World/AI/Goals/BegGoal.cpp b/Minecraft.World/AI/Goals/BegGoal.cpp index 6a7d92b11..c1b69a627 100644 --- a/Minecraft.World/AI/Goals/BegGoal.cpp +++ b/Minecraft.World/AI/Goals/BegGoal.cpp @@ -8,7 +8,7 @@ BegGoal::BegGoal(Wolf *wolf, float lookDistance) { - player = std::(); + player = std::weak_ptr(); lookTime = 0; this->wolf = wolf; @@ -19,7 +19,7 @@ BegGoal::BegGoal(Wolf *wolf, float lookDistance) bool BegGoal::canUse() { - player = std::(level->getNearestPlayer(wolf->shared_from_this(), lookDistance)); + player = std::weak_ptr(level->getNearestPlayer(wolf->shared_from_this(), lookDistance)); if (player.lock() == NULL) return false; wolf->setDespawnProtected(); return playerHoldingInteresting(player.lock()); @@ -42,7 +42,7 @@ void BegGoal::start() void BegGoal::stop() { wolf->setIsInterested(false); - player = std::(); + player = std::weak_ptr(); } void BegGoal::tick() diff --git a/Minecraft.World/AI/Goals/BegGoal.h b/Minecraft.World/AI/Goals/BegGoal.h index 747bdbc6b..c768ed11c 100644 --- a/Minecraft.World/AI/Goals/BegGoal.h +++ b/Minecraft.World/AI/Goals/BegGoal.h @@ -8,7 +8,7 @@ class BegGoal : public Goal { private: Wolf *wolf; // Owner of this goal - std:: player; + std::weak_ptr player; Level *level; float lookDistance; int lookTime; diff --git a/Minecraft.World/AI/Goals/BreedGoal.cpp b/Minecraft.World/AI/Goals/BreedGoal.cpp index 96182ca8d..a3ea9c3a9 100644 --- a/Minecraft.World/AI/Goals/BreedGoal.cpp +++ b/Minecraft.World/AI/Goals/BreedGoal.cpp @@ -11,7 +11,7 @@ BreedGoal::BreedGoal(Animal *animal, float speed) { - partner = std::(); + partner = std::weak_ptr(); loveTime = 0; this->animal = animal; @@ -23,7 +23,7 @@ BreedGoal::BreedGoal(Animal *animal, float speed) bool BreedGoal::canUse() { if (!animal->isInLove()) return false; - partner = std::(getFreePartner()); + partner = std::weak_ptr(getFreePartner()); return partner.lock() != NULL; } @@ -34,7 +34,7 @@ bool BreedGoal::canContinueToUse() void BreedGoal::stop() { - partner = std::(); + partner = std::weak_ptr(); loveTime = 0; } diff --git a/Minecraft.World/AI/Goals/BreedGoal.h b/Minecraft.World/AI/Goals/BreedGoal.h index 33fb11e0f..98e09739e 100644 --- a/Minecraft.World/AI/Goals/BreedGoal.h +++ b/Minecraft.World/AI/Goals/BreedGoal.h @@ -10,7 +10,7 @@ class BreedGoal : public Goal private: Animal *animal; // Owner of this goal Level *level; - std:: partner; + std::weak_ptr partner; int loveTime; float speed; diff --git a/Minecraft.World/AI/Goals/DefendVillageTargetGoal.cpp b/Minecraft.World/AI/Goals/DefendVillageTargetGoal.cpp index a29da6375..710d3b840 100644 --- a/Minecraft.World/AI/Goals/DefendVillageTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/DefendVillageTargetGoal.cpp @@ -13,7 +13,7 @@ bool DefendVillageTargetGoal::canUse() { std::shared_ptr village = golem->getVillage(); if (village == NULL) return false; - potentialTarget = std::(village->getClosestAggressor(dynamic_pointer_cast(golem->shared_from_this()))); + potentialTarget = std::weak_ptr(village->getClosestAggressor(dynamic_pointer_cast(golem->shared_from_this()))); return canAttack(potentialTarget.lock(), false); } diff --git a/Minecraft.World/AI/Goals/DefendVillageTargetGoal.h b/Minecraft.World/AI/Goals/DefendVillageTargetGoal.h index 7d40fbc2f..609c03218 100644 --- a/Minecraft.World/AI/Goals/DefendVillageTargetGoal.h +++ b/Minecraft.World/AI/Goals/DefendVillageTargetGoal.h @@ -8,7 +8,7 @@ class DefendVillageTargetGoal : public TargetGoal { private: VillagerGolem *golem; // Owner of this goal - std:: potentialTarget; + std::weak_ptr potentialTarget; public: DefendVillageTargetGoal(VillagerGolem *golem); diff --git a/Minecraft.World/AI/Goals/FollowOwnerGoal.cpp b/Minecraft.World/AI/Goals/FollowOwnerGoal.cpp index c857ffd72..1416cdc67 100644 --- a/Minecraft.World/AI/Goals/FollowOwnerGoal.cpp +++ b/Minecraft.World/AI/Goals/FollowOwnerGoal.cpp @@ -9,7 +9,7 @@ FollowOwnerGoal::FollowOwnerGoal(TamableAnimal *tamable, float speed, float startDistance, float stopDistance) { - owner = std::(); + owner = std::weak_ptr(); timeToRecalcPath = 0; oldAvoidWater = false; @@ -28,7 +28,7 @@ bool FollowOwnerGoal::canUse() if (owner == NULL) return false; if (tamable->isSitting()) return false; if (tamable->distanceToSqr(owner) < startDistance * startDistance) return false; - this->owner = std::(owner); + this->owner = std::weak_ptr(owner); return true; } @@ -46,7 +46,7 @@ void FollowOwnerGoal::start() void FollowOwnerGoal::stop() { - owner = std::(); + owner = std::weak_ptr(); navigation->stop(); tamable->getNavigation()->setAvoidWater(oldAvoidWater); } diff --git a/Minecraft.World/AI/Goals/FollowOwnerGoal.h b/Minecraft.World/AI/Goals/FollowOwnerGoal.h index 972d9c865..ff9aaf5d1 100644 --- a/Minecraft.World/AI/Goals/FollowOwnerGoal.h +++ b/Minecraft.World/AI/Goals/FollowOwnerGoal.h @@ -12,7 +12,7 @@ public: private: TamableAnimal *tamable; // Owner of this goal - std:: owner; + std::weak_ptr owner; Level *level; float speed; PathNavigation *navigation; diff --git a/Minecraft.World/AI/Goals/FollowParentGoal.cpp b/Minecraft.World/AI/Goals/FollowParentGoal.cpp index 009b1f8ed..a0d9f207d 100644 --- a/Minecraft.World/AI/Goals/FollowParentGoal.cpp +++ b/Minecraft.World/AI/Goals/FollowParentGoal.cpp @@ -35,7 +35,7 @@ bool FollowParentGoal::canUse() if (closest == NULL) return false; if (closestDistSqr < 3 * 3) return false; - parent = std::(closest); + parent = std::weak_ptr(closest); return true; } @@ -54,7 +54,7 @@ void FollowParentGoal::start() void FollowParentGoal::stop() { - parent = std::(); + parent = std::weak_ptr(); } void FollowParentGoal::tick() diff --git a/Minecraft.World/AI/Goals/FollowParentGoal.h b/Minecraft.World/AI/Goals/FollowParentGoal.h index 72780831c..a48a48cb8 100644 --- a/Minecraft.World/AI/Goals/FollowParentGoal.h +++ b/Minecraft.World/AI/Goals/FollowParentGoal.h @@ -8,7 +8,7 @@ class FollowParentGoal : public Goal { private: Animal *animal; // Owner of this goal - std:: parent; + std::weak_ptr parent; float speed; int timeToRecalcPath; diff --git a/Minecraft.World/AI/Goals/LeapAtTargetGoal.cpp b/Minecraft.World/AI/Goals/LeapAtTargetGoal.cpp index e554c3e5d..2d9765507 100644 --- a/Minecraft.World/AI/Goals/LeapAtTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/LeapAtTargetGoal.cpp @@ -5,7 +5,7 @@ LeapAtTargetGoal::LeapAtTargetGoal(Mob *mob, float yd) { - target = std::(); + target = std::weak_ptr(); this->mob = mob; this->yd = yd; @@ -14,7 +14,7 @@ LeapAtTargetGoal::LeapAtTargetGoal(Mob *mob, float yd) bool LeapAtTargetGoal::canUse() { - target = std::(mob->getTarget()); + target = std::weak_ptr(mob->getTarget()); if (target.lock() == NULL) return false; double d = mob->distanceToSqr(target.lock()); if (d < 2 * 2 || d > 4 * 4) return false; diff --git a/Minecraft.World/AI/Goals/LeapAtTargetGoal.h b/Minecraft.World/AI/Goals/LeapAtTargetGoal.h index a3561f708..c34130062 100644 --- a/Minecraft.World/AI/Goals/LeapAtTargetGoal.h +++ b/Minecraft.World/AI/Goals/LeapAtTargetGoal.h @@ -6,7 +6,7 @@ class LeapAtTargetGoal : public Goal { private: Mob *mob; // Owner of this goal - std:: target; + std::weak_ptr target; float yd; public: diff --git a/Minecraft.World/AI/Goals/LookAtPlayerGoal.cpp b/Minecraft.World/AI/Goals/LookAtPlayerGoal.cpp index 688aef7be..b3a817be7 100644 --- a/Minecraft.World/AI/Goals/LookAtPlayerGoal.cpp +++ b/Minecraft.World/AI/Goals/LookAtPlayerGoal.cpp @@ -29,7 +29,7 @@ bool LookAtPlayerGoal::canUse() { if (mob->getRandom()->nextFloat() >= probability) return false; if (lookAtType == typeid(Player)) lookAt = mob->level->getNearestPlayer(mob->shared_from_this(), lookDistance); - else lookAt = std::(mob->level->getClosestEntityOfClass(lookAtType, mob->bb->grow(lookDistance, 3, lookDistance), mob->shared_from_this())); + else lookAt = std::weak_ptr(mob->level->getClosestEntityOfClass(lookAtType, mob->bb->grow(lookDistance, 3, lookDistance), mob->shared_from_this())); return lookAt.lock() != NULL; } @@ -47,7 +47,7 @@ void LookAtPlayerGoal::start() void LookAtPlayerGoal::stop() { - lookAt = std::(); + lookAt = std::weak_ptr(); } void LookAtPlayerGoal::tick() diff --git a/Minecraft.World/AI/Goals/LookAtPlayerGoal.h b/Minecraft.World/AI/Goals/LookAtPlayerGoal.h index b6aa78d7c..1aa80265d 100644 --- a/Minecraft.World/AI/Goals/LookAtPlayerGoal.h +++ b/Minecraft.World/AI/Goals/LookAtPlayerGoal.h @@ -11,7 +11,7 @@ private: Mob *mob; // Owner of this goal protected: - std:: lookAt; + std::weak_ptr lookAt; private: float lookDistance; diff --git a/Minecraft.World/AI/Goals/LookAtTradingPlayerGoal.cpp b/Minecraft.World/AI/Goals/LookAtTradingPlayerGoal.cpp index 47514888c..f7393f2ce 100644 --- a/Minecraft.World/AI/Goals/LookAtTradingPlayerGoal.cpp +++ b/Minecraft.World/AI/Goals/LookAtTradingPlayerGoal.cpp @@ -12,7 +12,7 @@ bool LookAtTradingPlayerGoal::canUse() { if (villager->isTrading()) { - lookAt = std::(dynamic_pointer_cast(villager->getTradingPlayer())); + lookAt = std::weak_ptr(dynamic_pointer_cast(villager->getTradingPlayer())); return true; } return false; diff --git a/Minecraft.World/AI/Goals/MakeLoveGoal.cpp b/Minecraft.World/AI/Goals/MakeLoveGoal.cpp index 60dbaa569..8cb482591 100644 --- a/Minecraft.World/AI/Goals/MakeLoveGoal.cpp +++ b/Minecraft.World/AI/Goals/MakeLoveGoal.cpp @@ -10,8 +10,8 @@ MakeLoveGoal::MakeLoveGoal(Villager *villager) { - village = std::(); - partner = std::(); + village = std::weak_ptr(); + partner = std::weak_ptr(); loveMakingTime = 0; this->villager = villager; @@ -32,7 +32,7 @@ bool MakeLoveGoal::canUse() std::shared_ptr mate = level->getClosestEntityOfClass(typeid(Villager), villager->bb->grow(8, 3, 8), villager->shared_from_this()); if (mate == NULL) return false; - partner = std::(dynamic_pointer_cast(mate)); + partner = std::weak_ptr(dynamic_pointer_cast(mate)); if (partner.lock()->getAge() != 0) return false; return true; @@ -46,8 +46,8 @@ void MakeLoveGoal::start() void MakeLoveGoal::stop() { - village = std::(); - partner = std::(); + village = std::weak_ptr(); + partner = std::weak_ptr(); villager->setInLove(false); } diff --git a/Minecraft.World/AI/Goals/MakeLoveGoal.h b/Minecraft.World/AI/Goals/MakeLoveGoal.h index 00350b0f4..ea747efaf 100644 --- a/Minecraft.World/AI/Goals/MakeLoveGoal.h +++ b/Minecraft.World/AI/Goals/MakeLoveGoal.h @@ -9,10 +9,10 @@ class MakeLoveGoal : public Goal { private: Villager *villager; // Owner of this goal - std:: partner; + std::weak_ptr partner; Level *level; int loveMakingTime; - std:: village; + std::weak_ptr village; public: MakeLoveGoal(Villager *villager); diff --git a/Minecraft.World/AI/Goals/MeleeAttackGoal.cpp b/Minecraft.World/AI/Goals/MeleeAttackGoal.cpp index a7ab31259..72738fb41 100644 --- a/Minecraft.World/AI/Goals/MeleeAttackGoal.cpp +++ b/Minecraft.World/AI/Goals/MeleeAttackGoal.cpp @@ -45,7 +45,7 @@ bool MeleeAttackGoal::canUse() if (bestTarget == NULL) return false; if(!bestTarget->isAlive()) return false; if (attackType != eTYPE_NOTSET && (attackType & bestTarget->GetType()) != attackType) return false; - target = std::(bestTarget); + target = std::weak_ptr(bestTarget); delete path; path = mob->getNavigation()->createPath(target.lock()); return path != NULL; @@ -70,7 +70,7 @@ void MeleeAttackGoal::start() void MeleeAttackGoal::stop() { - target = std::(); + target = std::weak_ptr(); mob->getNavigation()->stop(); } diff --git a/Minecraft.World/AI/Goals/MeleeAttackGoal.h b/Minecraft.World/AI/Goals/MeleeAttackGoal.h index 6c9352e2c..1b24b28df 100644 --- a/Minecraft.World/AI/Goals/MeleeAttackGoal.h +++ b/Minecraft.World/AI/Goals/MeleeAttackGoal.h @@ -11,7 +11,7 @@ class MeleeAttackGoal : public Goal private: Level *level; Mob *mob; // Owner of this goal - std:: target; + std::weak_ptr target; int attackTime; float speed; diff --git a/Minecraft.World/AI/Goals/MoveIndoorsGoal.cpp b/Minecraft.World/AI/Goals/MoveIndoorsGoal.cpp index ce108fd8b..7ecd02607 100644 --- a/Minecraft.World/AI/Goals/MoveIndoorsGoal.cpp +++ b/Minecraft.World/AI/Goals/MoveIndoorsGoal.cpp @@ -39,7 +39,7 @@ void MoveIndoorsGoal::start() std::shared_ptr _doorInfo = doorInfo.lock(); if( _doorInfo == NULL ) { - doorInfo = std::(); + doorInfo = std::weak_ptr(); return; } if (mob->distanceToSqr(_doorInfo->getIndoorX(), _doorInfo->y, _doorInfo->getIndoorZ()) > 16 * 16) @@ -55,11 +55,11 @@ void MoveIndoorsGoal::stop() std::shared_ptr _doorInfo = doorInfo.lock(); if( _doorInfo == NULL ) { - doorInfo = std::(); + doorInfo = std::weak_ptr(); return; } insideX = _doorInfo->getIndoorX(); insideZ = _doorInfo->getIndoorZ(); - doorInfo = std::(); + doorInfo = std::weak_ptr(); } \ No newline at end of file diff --git a/Minecraft.World/AI/Goals/MoveIndoorsGoal.h b/Minecraft.World/AI/Goals/MoveIndoorsGoal.h index 74bbaa100..823a07c12 100644 --- a/Minecraft.World/AI/Goals/MoveIndoorsGoal.h +++ b/Minecraft.World/AI/Goals/MoveIndoorsGoal.h @@ -9,7 +9,7 @@ class MoveIndoorsGoal : public Goal { private: PathfinderMob *mob; - std:: doorInfo; + std::weak_ptr doorInfo; int insideX, insideZ; public: diff --git a/Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp b/Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp index f0df57528..dd32e2fe8 100644 --- a/Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp +++ b/Minecraft.World/AI/Goals/MoveThroughVillageGoal.cpp @@ -12,7 +12,7 @@ MoveThroughVillageGoal::MoveThroughVillageGoal(PathfinderMob *mob, float speed, bool onlyAtNight) { path = NULL; - doorInfo = std::(); + doorInfo = std::weak_ptr(); this->mob = mob; this->speed = speed; diff --git a/Minecraft.World/AI/Goals/MoveThroughVillageGoal.h b/Minecraft.World/AI/Goals/MoveThroughVillageGoal.h index 8e4d117f2..d932e5fe8 100644 --- a/Minecraft.World/AI/Goals/MoveThroughVillageGoal.h +++ b/Minecraft.World/AI/Goals/MoveThroughVillageGoal.h @@ -12,9 +12,9 @@ private: PathfinderMob *mob; float speed; Path *path; - std:: doorInfo; + std::weak_ptr doorInfo; bool onlyAtNight; - std::vector< std:: > visited; + std::vector< std::weak_ptr > visited; public: MoveThroughVillageGoal(PathfinderMob *mob, float speed, bool onlyAtNight); diff --git a/Minecraft.World/AI/Goals/MoveTowardsTargetGoal.cpp b/Minecraft.World/AI/Goals/MoveTowardsTargetGoal.cpp index 19a5cea12..c9c43ffd1 100644 --- a/Minecraft.World/AI/Goals/MoveTowardsTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/MoveTowardsTargetGoal.cpp @@ -16,7 +16,7 @@ MoveTowardsTargetGoal::MoveTowardsTargetGoal(PathfinderMob *mob, float speed, fl bool MoveTowardsTargetGoal::canUse() { - target = std::(mob->getTarget()); + target = std::weak_ptr(mob->getTarget()); if (target.lock() == NULL) return false; if (target.lock()->distanceToSqr(mob->shared_from_this()) > within * within) return false; Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast(mob->shared_from_this()), 16, 7, Vec3::newTemp(target.lock()->x, target.lock()->y, target.lock()->z)); @@ -34,7 +34,7 @@ bool MoveTowardsTargetGoal::canContinueToUse() void MoveTowardsTargetGoal::stop() { - target = std::(); + target = std::weak_ptr(); } void MoveTowardsTargetGoal::start() diff --git a/Minecraft.World/AI/Goals/MoveTowardsTargetGoal.h b/Minecraft.World/AI/Goals/MoveTowardsTargetGoal.h index d1201adfd..413e8bce1 100644 --- a/Minecraft.World/AI/Goals/MoveTowardsTargetGoal.h +++ b/Minecraft.World/AI/Goals/MoveTowardsTargetGoal.h @@ -6,7 +6,7 @@ class MoveTowardsTargetGoal : public Goal { private: PathfinderMob *mob; - std:: target; + std::weak_ptr target; double wantedX, wantedY, wantedZ; float speed, within; diff --git a/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.cpp b/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.cpp index 0eba51761..306091024 100644 --- a/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.cpp @@ -41,7 +41,7 @@ bool NearestAttackableTargetGoal::canUse() std::shared_ptr potentialTarget = mob->level->getNearestAttackablePlayer(mob->shared_from_this(), within); if (canAttack(potentialTarget, false)) { - target = std::(potentialTarget); + target = std::weak_ptr(potentialTarget); return true; } } @@ -55,7 +55,7 @@ bool NearestAttackableTargetGoal::canUse() std::shared_ptr potTarget = dynamic_pointer_cast(*it); if (canAttack(potTarget, false)) { - target = std::(potTarget); + target = std::weak_ptr(potTarget); return true; } } diff --git a/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.h b/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.h index c5b80f8ff..23389cf35 100644 --- a/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.h +++ b/Minecraft.World/AI/Goals/NearestAttackableTargetGoal.h @@ -17,7 +17,7 @@ public: }; private: - std:: target; + std::weak_ptr target; const std::type_info& targetType; int randomInterval; DistComp *distComp; diff --git a/Minecraft.World/AI/Goals/OcelotAttackGoal.cpp b/Minecraft.World/AI/Goals/OcelotAttackGoal.cpp index 329e415a1..6accd7bbd 100644 --- a/Minecraft.World/AI/Goals/OcelotAttackGoal.cpp +++ b/Minecraft.World/AI/Goals/OcelotAttackGoal.cpp @@ -8,7 +8,7 @@ OzelotAttackGoal::OzelotAttackGoal(Mob *mob) { - target = std::(); + target = std::weak_ptr(); attackTime = 0; speed = 0; trackTarget = false; @@ -22,7 +22,7 @@ bool OzelotAttackGoal::canUse() { std::shared_ptr bestTarget = mob->getTarget(); if (bestTarget == NULL) return false; - target = std::(bestTarget); + target = std::weak_ptr(bestTarget); return true; } @@ -35,7 +35,7 @@ bool OzelotAttackGoal::canContinueToUse() void OzelotAttackGoal::stop() { - target = std::(); + target = std::weak_ptr(); mob->getNavigation()->stop(); } diff --git a/Minecraft.World/AI/Goals/OcelotAttackGoal.h b/Minecraft.World/AI/Goals/OcelotAttackGoal.h index bdc71d385..75628cf19 100644 --- a/Minecraft.World/AI/Goals/OcelotAttackGoal.h +++ b/Minecraft.World/AI/Goals/OcelotAttackGoal.h @@ -7,7 +7,7 @@ class OzelotAttackGoal : public Goal private: Level *level; Mob *mob; - std:: target; + std::weak_ptr target; int attackTime; float speed; bool trackTarget; diff --git a/Minecraft.World/AI/Goals/OfferFlowerGoal.cpp b/Minecraft.World/AI/Goals/OfferFlowerGoal.cpp index 9d4e267e3..c4090bbe7 100644 --- a/Minecraft.World/AI/Goals/OfferFlowerGoal.cpp +++ b/Minecraft.World/AI/Goals/OfferFlowerGoal.cpp @@ -16,7 +16,7 @@ bool OfferFlowerGoal::canUse() { if (!golem->level->isDay()) return false; if (golem->getRandom()->nextInt(8000) != 0) return false; - villager = std::(dynamic_pointer_cast( golem->level->getClosestEntityOfClass(typeid(Villager), golem->bb->grow(6, 2, 6), golem->shared_from_this()) )); + villager = std::weak_ptr(dynamic_pointer_cast( golem->level->getClosestEntityOfClass(typeid(Villager), golem->bb->grow(6, 2, 6), golem->shared_from_this()) )); return villager.lock() != NULL; } @@ -34,7 +34,7 @@ void OfferFlowerGoal::start() void OfferFlowerGoal::stop() { golem->offerFlower(false); - villager = std::(); + villager = std::weak_ptr(); } void OfferFlowerGoal::tick() diff --git a/Minecraft.World/AI/Goals/OfferFlowerGoal.h b/Minecraft.World/AI/Goals/OfferFlowerGoal.h index de7d3bca8..8f3fa21ef 100644 --- a/Minecraft.World/AI/Goals/OfferFlowerGoal.h +++ b/Minecraft.World/AI/Goals/OfferFlowerGoal.h @@ -11,7 +11,7 @@ public: private: VillagerGolem *golem; - std:: villager; + std::weak_ptr villager; int _tick; public: diff --git a/Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.cpp b/Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.cpp index 3bb008aa9..8e17a31b5 100644 --- a/Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.cpp @@ -14,7 +14,7 @@ bool OwnerHurtByTargetGoal::canUse() if (!tameAnimal->isTame()) return false; std::shared_ptr owner = tameAnimal->getOwner(); if (owner == NULL) return false; - ownerLastHurtBy = std::(owner->getLastHurtByMob()); + ownerLastHurtBy = std::weak_ptr(owner->getLastHurtByMob()); return canAttack(ownerLastHurtBy.lock(), false); } diff --git a/Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.h b/Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.h index 2b09089e6..fa6d390b3 100644 --- a/Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.h +++ b/Minecraft.World/AI/Goals/OwnerHurtByTargetGoal.h @@ -8,7 +8,7 @@ class OwnerHurtByTargetGoal : public TargetGoal { private: TamableAnimal *tameAnimal; // Owner of this goal - std:: ownerLastHurtBy; + std::weak_ptr ownerLastHurtBy; public: OwnerHurtByTargetGoal(TamableAnimal *tameAnimal); diff --git a/Minecraft.World/AI/Goals/OwnerHurtTargetGoal.cpp b/Minecraft.World/AI/Goals/OwnerHurtTargetGoal.cpp index 9f4fde7eb..a7f931f27 100644 --- a/Minecraft.World/AI/Goals/OwnerHurtTargetGoal.cpp +++ b/Minecraft.World/AI/Goals/OwnerHurtTargetGoal.cpp @@ -14,7 +14,7 @@ bool OwnerHurtTargetGoal::canUse() if (!tameAnimal->isTame()) return false; std::shared_ptr owner = tameAnimal->getOwner(); if (owner == NULL) return false; - ownerLastHurt = std::(owner->getLastHurtMob()); + ownerLastHurt = std::weak_ptr(owner->getLastHurtMob()); return canAttack(ownerLastHurt.lock(), false); } diff --git a/Minecraft.World/AI/Goals/OwnerHurtTargetGoal.h b/Minecraft.World/AI/Goals/OwnerHurtTargetGoal.h index 856f2622c..947071c9b 100644 --- a/Minecraft.World/AI/Goals/OwnerHurtTargetGoal.h +++ b/Minecraft.World/AI/Goals/OwnerHurtTargetGoal.h @@ -8,7 +8,7 @@ class OwnerHurtTargetGoal : public TargetGoal { private: TamableAnimal *tameAnimal; // Owner of this goal - std:: ownerLastHurt; + std::weak_ptr ownerLastHurt; public: OwnerHurtTargetGoal(TamableAnimal *tameAnimal); diff --git a/Minecraft.World/AI/Goals/PlayGoal.cpp b/Minecraft.World/AI/Goals/PlayGoal.cpp index e37131927..2d6ebb992 100644 --- a/Minecraft.World/AI/Goals/PlayGoal.cpp +++ b/Minecraft.World/AI/Goals/PlayGoal.cpp @@ -11,7 +11,7 @@ PlayGoal::PlayGoal(Villager *mob, float speed) { - followFriend = std::(); + followFriend = std::weak_ptr(); wantedX = wantedY = wantedZ = 0.0; playTime = 0; @@ -38,7 +38,7 @@ bool PlayGoal::canUse() double distSqr = friendV->distanceToSqr(mob->shared_from_this()); if (distSqr > closestDistSqr) continue; closestDistSqr = distSqr; - followFriend = std::(friendV); + followFriend = std::weak_ptr(friendV); } delete children; @@ -64,7 +64,7 @@ void PlayGoal::start() void PlayGoal::stop() { mob->setChasing(false); - followFriend = std::(); + followFriend = std::weak_ptr(); } void PlayGoal::tick() diff --git a/Minecraft.World/AI/Goals/PlayGoal.h b/Minecraft.World/AI/Goals/PlayGoal.h index 7010bbbd8..f70df968e 100644 --- a/Minecraft.World/AI/Goals/PlayGoal.h +++ b/Minecraft.World/AI/Goals/PlayGoal.h @@ -6,7 +6,7 @@ class PlayGoal : public Goal { private: Villager *mob; - std:: followFriend; + std::weak_ptr followFriend; float speed; double wantedX, wantedY, wantedZ; int playTime; diff --git a/Minecraft.World/AI/Goals/RestrictOpenDoorGoal.cpp b/Minecraft.World/AI/Goals/RestrictOpenDoorGoal.cpp index c807603e1..18d78a33a 100644 --- a/Minecraft.World/AI/Goals/RestrictOpenDoorGoal.cpp +++ b/Minecraft.World/AI/Goals/RestrictOpenDoorGoal.cpp @@ -39,7 +39,7 @@ void RestrictOpenDoorGoal::stop() { mob->getNavigation()->setCanOpenDoors(true); mob->getNavigation()->setCanPassDoors(true); - doorInfo = std::(); + doorInfo = std::weak_ptr(); } void RestrictOpenDoorGoal::tick() diff --git a/Minecraft.World/AI/Goals/RestrictOpenDoorGoal.h b/Minecraft.World/AI/Goals/RestrictOpenDoorGoal.h index f30418cdd..38ce88655 100644 --- a/Minecraft.World/AI/Goals/RestrictOpenDoorGoal.h +++ b/Minecraft.World/AI/Goals/RestrictOpenDoorGoal.h @@ -9,7 +9,7 @@ class RestrictOpenDoorGoal : public Goal { private: PathfinderMob *mob; - std:: doorInfo; + std::weak_ptr doorInfo; public: RestrictOpenDoorGoal(PathfinderMob *mob); diff --git a/Minecraft.World/AI/Goals/SwellGoal.cpp b/Minecraft.World/AI/Goals/SwellGoal.cpp index 85fae26af..61c7c65bc 100644 --- a/Minecraft.World/AI/Goals/SwellGoal.cpp +++ b/Minecraft.World/AI/Goals/SwellGoal.cpp @@ -7,7 +7,7 @@ SwellGoal::SwellGoal(Creeper *creeper) { - target = std::(); + target = std::weak_ptr(); this->creeper = creeper; setRequiredControlFlags(Control::MoveControlFlag); @@ -22,12 +22,12 @@ bool SwellGoal::canUse() void SwellGoal::start() { creeper->getNavigation()->stop(); - target = std::(creeper->getTarget()); + target = std::weak_ptr(creeper->getTarget()); } void SwellGoal::stop() { - target = std::(); + target = std::weak_ptr(); } void SwellGoal::tick() diff --git a/Minecraft.World/AI/Goals/SwellGoal.h b/Minecraft.World/AI/Goals/SwellGoal.h index c85f17365..0d4e586b9 100644 --- a/Minecraft.World/AI/Goals/SwellGoal.h +++ b/Minecraft.World/AI/Goals/SwellGoal.h @@ -8,7 +8,7 @@ class SwellGoal : public Goal { private: Creeper *creeper; - std:: target; + std::weak_ptr target; public: SwellGoal(Creeper *creeper); diff --git a/Minecraft.World/AI/Goals/TakeFlowerGoal.cpp b/Minecraft.World/AI/Goals/TakeFlowerGoal.cpp index b9354c10e..3959a3308 100644 --- a/Minecraft.World/AI/Goals/TakeFlowerGoal.cpp +++ b/Minecraft.World/AI/Goals/TakeFlowerGoal.cpp @@ -12,7 +12,7 @@ TakeFlowerGoal::TakeFlowerGoal(Villager *villager) { takeFlower = false; pickupTick = 0; - golem = std::(); + golem = std::weak_ptr(); this->villager = villager; setRequiredControlFlags(Control::MoveControlFlag | Control::LookControlFlag); @@ -36,7 +36,7 @@ bool TakeFlowerGoal::canUse() std::shared_ptr vg = dynamic_pointer_cast(*it); if (vg->getOfferFlowerTick() > 0) { - golem = std::(vg); + golem = std::weak_ptr(vg); break; } } @@ -58,7 +58,7 @@ void TakeFlowerGoal::start() void TakeFlowerGoal::stop() { - golem = std::(); + golem = std::weak_ptr(); villager->getNavigation()->stop(); } diff --git a/Minecraft.World/AI/Goals/TakeFlowerGoal.h b/Minecraft.World/AI/Goals/TakeFlowerGoal.h index 44fcab6f7..5984a241e 100644 --- a/Minecraft.World/AI/Goals/TakeFlowerGoal.h +++ b/Minecraft.World/AI/Goals/TakeFlowerGoal.h @@ -6,7 +6,7 @@ class TakeFlowerGoal : public Goal { private: Villager *villager; - std:: golem; + std::weak_ptr golem; int pickupTick; bool takeFlower; diff --git a/Minecraft.World/AI/Goals/TemptGoal.cpp b/Minecraft.World/AI/Goals/TemptGoal.cpp index 0c60dcd84..040b214a6 100644 --- a/Minecraft.World/AI/Goals/TemptGoal.cpp +++ b/Minecraft.World/AI/Goals/TemptGoal.cpp @@ -9,7 +9,7 @@ TemptGoal::TemptGoal(PathfinderMob *mob, float speed, int itemId, bool canScare) { px = py = pz = pRotX = pRotY = 0.0; - player = std::(); + player = std::weak_ptr(); calmDown = 0; _isRunning = false; oldAvoidWater = false; @@ -28,7 +28,7 @@ bool TemptGoal::canUse() --calmDown; return false; } - player = std::(mob->level->getNearestPlayer(mob->shared_from_this(), 10)); + player = std::weak_ptr(mob->level->getNearestPlayer(mob->shared_from_this(), 10)); if (player.lock() == NULL) return false; mob->setDespawnProtected(); // If we've got a nearby player, then consider this mob as something we'd miss if it despawned std::shared_ptr item = player.lock()->getSelectedItem(); @@ -71,7 +71,7 @@ void TemptGoal::start() void TemptGoal::stop() { - player = std::(); + player = std::weak_ptr(); mob->getNavigation()->stop(); calmDown = 100; _isRunning = false; diff --git a/Minecraft.World/AI/Goals/TemptGoal.h b/Minecraft.World/AI/Goals/TemptGoal.h index 78a0d4691..fb288d388 100644 --- a/Minecraft.World/AI/Goals/TemptGoal.h +++ b/Minecraft.World/AI/Goals/TemptGoal.h @@ -8,7 +8,7 @@ private: PathfinderMob *mob; float speed; double px, py, pz, pRotX, pRotY; - std:: player; + std::weak_ptr player; int calmDown ; bool _isRunning; int itemId; diff --git a/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp b/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp index 27fcee5a8..1608971f5 100644 --- a/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp +++ b/Minecraft.World/Blocks/TileEntities/ChestTileEntity.cpp @@ -158,10 +158,10 @@ void ChestTileEntity::checkNeighbors() if (hasCheckedNeighbors) return; hasCheckedNeighbors = true; - n = std::(); - e = std::(); - w = std::(); - s = std::(); + n = std::weak_ptr(); + e = std::weak_ptr(); + w = std::weak_ptr(); + s = std::weak_ptr(); if (level->getTile(x - 1, y, z) == Tile::chest_Id) { diff --git a/Minecraft.World/Blocks/TileEntities/ChestTileEntity.h b/Minecraft.World/Blocks/TileEntities/ChestTileEntity.h index 5f82a6114..1778898d6 100644 --- a/Minecraft.World/Blocks/TileEntities/ChestTileEntity.h +++ b/Minecraft.World/Blocks/TileEntities/ChestTileEntity.h @@ -28,10 +28,10 @@ private: public: bool isBonusChest; // 4J added bool hasCheckedNeighbors; - std:: n; - std:: e; - std:: w; - std:: s; + std::weak_ptr n; + std::weak_ptr e; + std::weak_ptr w; + std::weak_ptr s; float openness, oOpenness; int openCount; diff --git a/Minecraft.World/Entities/Entity.cpp b/Minecraft.World/Entities/Entity.cpp index 37ec875e8..de30141a5 100644 --- a/Minecraft.World/Entities/Entity.cpp +++ b/Minecraft.World/Entities/Entity.cpp @@ -257,7 +257,7 @@ void Entity::_init(bool useSmallId) viewScale = 1.0; blocksBuilding = false; - rider = std::(); + rider = std::weak_ptr(); riding = nullptr; //level = NULL; // Level is assigned to in the original c_tor code @@ -1571,14 +1571,14 @@ void Entity::ride(std::shared_ptr e) { // 4J Stu - Position should already be updated before the SetRidingPacket comes in if(!level->isClientSide) moveTo(riding->x, riding->bb->y0 + riding->bbHeight, riding->z, yRot, xRot); - riding->rider = std::(); + riding->rider = std::weak_ptr(); } riding = nullptr; return; } if (riding != NULL) { - riding->rider = std::(); + riding->rider = std::weak_ptr(); } riding = e; e->rider = shared_from_this(); diff --git a/Minecraft.World/Entities/Entity.h b/Minecraft.World/Entities/Entity.h index 85aeda3bd..bb64e3b79 100644 --- a/Minecraft.World/Entities/Entity.h +++ b/Minecraft.World/Entities/Entity.h @@ -52,7 +52,7 @@ public: double viewScale; bool blocksBuilding; - std:: rider; // Changed to weak to avoid circular dependency between rider/riding entity + std::weak_ptr rider; // Changed to weak to avoid circular dependency between rider/riding entity std::shared_ptr riding; Level *level; diff --git a/Minecraft.World/Entities/Mobs/Animal.h b/Minecraft.World/Entities/Mobs/Animal.h index 2d8e7b3eb..468108392 100644 --- a/Minecraft.World/Entities/Mobs/Animal.h +++ b/Minecraft.World/Entities/Mobs/Animal.h @@ -13,7 +13,7 @@ private: // int inLove; // 4J removed - now synched data int loveTime; - std:: loveCause; + std::weak_ptr loveCause; public: Animal(Level *level); diff --git a/Minecraft.World/Entities/Mobs/Boat.cpp b/Minecraft.World/Entities/Mobs/Boat.cpp index f66a03eae..e1da9d062 100644 --- a/Minecraft.World/Entities/Mobs/Boat.cpp +++ b/Minecraft.World/Entities/Mobs/Boat.cpp @@ -434,7 +434,7 @@ void Boat::tick() if (rider.lock() != NULL) { - if (rider.lock()->removed) rider = std::(); + if (rider.lock()->removed) rider = std::weak_ptr(); } } diff --git a/Minecraft.World/Entities/Mobs/Minecart.cpp b/Minecraft.World/Entities/Mobs/Minecart.cpp index 8210859e0..c48e98d72 100644 --- a/Minecraft.World/Entities/Mobs/Minecart.cpp +++ b/Minecraft.World/Entities/Mobs/Minecart.cpp @@ -696,7 +696,7 @@ void Minecart::tick() { rider.lock()->riding = nullptr; } - rider = std::(); + rider = std::weak_ptr(); } } diff --git a/Minecraft.World/Entities/Mobs/Villager.cpp b/Minecraft.World/Entities/Mobs/Villager.cpp index a98e70f7f..253acd914 100644 --- a/Minecraft.World/Entities/Mobs/Villager.cpp +++ b/Minecraft.World/Entities/Mobs/Villager.cpp @@ -36,9 +36,9 @@ void Villager::_init(int profession) villageUpdateInterval = 0; inLove = false; chasing = false; - village = std::(); + village = std::weak_ptr(); - tradingPlayer = std::(); + tradingPlayer = std::weak_ptr(); offers = NULL; updateMerchantTimer = 0; addRecipeOnUpdate = false; @@ -341,7 +341,7 @@ void Villager::die(DamageSource *source) void Villager::setTradingPlayer(std::shared_ptr player) { - tradingPlayer = std::(player); + tradingPlayer = std::weak_ptr(player); } std::shared_ptr Villager::getTradingPlayer() diff --git a/Minecraft.World/Entities/Mobs/Villager.h b/Minecraft.World/Entities/Mobs/Villager.h index d2250c27f..6ae03f90a 100644 --- a/Minecraft.World/Entities/Mobs/Villager.h +++ b/Minecraft.World/Entities/Mobs/Villager.h @@ -32,9 +32,9 @@ private: bool inLove; bool chasing; - std:: village; + std::weak_ptr village; - std:: tradingPlayer; + std::weak_ptr tradingPlayer; MerchantRecipeList *offers; int updateMerchantTimer; bool addRecipeOnUpdate; diff --git a/Minecraft.World/Entities/Mobs/VillagerGolem.cpp b/Minecraft.World/Entities/Mobs/VillagerGolem.cpp index fb5f72ec6..c64ccc91d 100644 --- a/Minecraft.World/Entities/Mobs/VillagerGolem.cpp +++ b/Minecraft.World/Entities/Mobs/VillagerGolem.cpp @@ -28,7 +28,7 @@ VillagerGolem::VillagerGolem(Level *level) : Golem(level) health = getMaxHealth(); villageUpdateInterval = 0; - village = std::(); + village = std::weak_ptr(); attackAnimationTick = 0; offerFlowerTick = 0; diff --git a/Minecraft.World/Entities/Mobs/VillagerGolem.h b/Minecraft.World/Entities/Mobs/VillagerGolem.h index f677c3fb8..4a71db541 100644 --- a/Minecraft.World/Entities/Mobs/VillagerGolem.h +++ b/Minecraft.World/Entities/Mobs/VillagerGolem.h @@ -16,7 +16,7 @@ protected: private: int villageUpdateInterval; - std:: village; + std::weak_ptr village; int attackAnimationTick; int offerFlowerTick; diff --git a/Minecraft.World/Level/Events/VillageSiege.cpp b/Minecraft.World/Level/Events/VillageSiege.cpp index 266f3ee9b..42f2d59da 100644 --- a/Minecraft.World/Level/Events/VillageSiege.cpp +++ b/Minecraft.World/Level/Events/VillageSiege.cpp @@ -11,7 +11,7 @@ VillageSiege::VillageSiege(Level *level) siegeState = SIEGE_NOT_INITED; siegeCount = 0; nextSpawnTime = 0; - village = std::(); + village = std::weak_ptr(); spawnX = spawnY = spawnZ = 0; this->level = level; diff --git a/Minecraft.World/Level/Events/VillageSiege.h b/Minecraft.World/Level/Events/VillageSiege.h index cee170107..c2b67c5a3 100644 --- a/Minecraft.World/Level/Events/VillageSiege.h +++ b/Minecraft.World/Level/Events/VillageSiege.h @@ -8,7 +8,7 @@ private: int siegeState; int siegeCount; int nextSpawnTime; - std:: village; + std::weak_ptr village; int spawnX, spawnY, spawnZ; static const int SIEGE_NOT_INITED = -1; diff --git a/Minecraft.World/Level/Level.cpp b/Minecraft.World/Level/Level.cpp index c67a0fb53..9c06671aa 100644 --- a/Minecraft.World/Level/Level.cpp +++ b/Minecraft.World/Level/Level.cpp @@ -2273,7 +2273,7 @@ void Level::tickEntities() { if (e->riding->removed || e->riding->rider.lock() != e) { - e->riding->rider = std::(); + e->riding->rider = std::weak_ptr(); e->riding = nullptr; } else @@ -2521,7 +2521,7 @@ void Level::tick(std::shared_ptr e, bool actual) if (e->rider.lock()->removed || e->rider.lock()->riding != e) { e->rider.lock()->riding = nullptr; - e->rider = std::(); + e->rider = std::weak_ptr(); } else { diff --git a/Minecraft.World/Player/Player.cpp b/Minecraft.World/Player/Player.cpp index ff5a00e0e..5e9b13f0a 100644 --- a/Minecraft.World/Player/Player.cpp +++ b/Minecraft.World/Player/Player.cpp @@ -603,7 +603,7 @@ void Player::ride(std::shared_ptr e) if (riding != NULL) { - riding->rider = std::(); + riding->rider = std::weak_ptr(); } riding = nullptr;