Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.
This reverts commit a9be52c41a.
This commit is contained in:
@@ -33,12 +33,12 @@ AvoidPlayerGoal::AvoidPlayerGoal(PathfinderMob *mob, const type_info& avoidType,
|
||||
entitySelector = new AvoidPlayerGoalEntitySelector(this);
|
||||
|
||||
toAvoid = weak_ptr<Entity>();
|
||||
path = nullptr;
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
AvoidPlayerGoal::~AvoidPlayerGoal()
|
||||
{
|
||||
if(path != nullptr) delete path;
|
||||
if(path != NULL) delete path;
|
||||
delete entitySelector;
|
||||
}
|
||||
|
||||
@@ -47,9 +47,9 @@ bool AvoidPlayerGoal::canUse()
|
||||
if (avoidType == typeid(Player))
|
||||
{
|
||||
shared_ptr<TamableAnimal> tamableAnimal = dynamic_pointer_cast<TamableAnimal>(mob->shared_from_this());
|
||||
if (tamableAnimal != nullptr && tamableAnimal->isTame()) return false;
|
||||
if (tamableAnimal != NULL && tamableAnimal->isTame()) return false;
|
||||
toAvoid = weak_ptr<Entity>(mob->level->getNearestPlayer(mob->shared_from_this(), maxDist));
|
||||
if (toAvoid.lock() == nullptr) return false;
|
||||
if (toAvoid.lock() == NULL) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -64,24 +64,24 @@ bool AvoidPlayerGoal::canUse()
|
||||
}
|
||||
|
||||
Vec3 *pos = RandomPos::getPosAvoid(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 16, 7, Vec3::newTemp(toAvoid.lock()->x, toAvoid.lock()->y, toAvoid.lock()->z));
|
||||
if (pos == nullptr) return false;
|
||||
if (pos == NULL) return false;
|
||||
if (toAvoid.lock()->distanceToSqr(pos->x, pos->y, pos->z) < toAvoid.lock()->distanceToSqr(mob->shared_from_this())) return false;
|
||||
delete path;
|
||||
path = pathNav->createPath(pos->x, pos->y, pos->z);
|
||||
if (path == nullptr) return false;
|
||||
if (path == NULL) return false;
|
||||
if (!path->endsInXZ(pos)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AvoidPlayerGoal::canContinueToUse()
|
||||
{
|
||||
return toAvoid.lock() != nullptr && !pathNav->isDone();
|
||||
return toAvoid.lock() != NULL && !pathNav->isDone();
|
||||
}
|
||||
|
||||
void AvoidPlayerGoal::start()
|
||||
{
|
||||
pathNav->moveTo(path, walkSpeedModifier);
|
||||
path = nullptr;
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
void AvoidPlayerGoal::stop()
|
||||
|
||||
Reference in New Issue
Block a user