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:
@@ -11,7 +11,7 @@
|
||||
|
||||
MoveThroughVillageGoal::MoveThroughVillageGoal(PathfinderMob *mob, double speedModifier, bool onlyAtNight)
|
||||
{
|
||||
path = nullptr;
|
||||
path = NULL;
|
||||
doorInfo = weak_ptr<DoorInfo>();
|
||||
|
||||
this->mob = mob;
|
||||
@@ -22,7 +22,7 @@ MoveThroughVillageGoal::MoveThroughVillageGoal(PathfinderMob *mob, double speedM
|
||||
|
||||
MoveThroughVillageGoal::~MoveThroughVillageGoal()
|
||||
{
|
||||
if(path != nullptr) delete path;
|
||||
if(path != NULL) delete path;
|
||||
}
|
||||
|
||||
bool MoveThroughVillageGoal::canUse()
|
||||
@@ -32,10 +32,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);
|
||||
if (village == nullptr) return false;
|
||||
if (village == NULL) return false;
|
||||
|
||||
shared_ptr<DoorInfo> _doorInfo = getNextDoorInfo(village);
|
||||
if (_doorInfo == nullptr) return false;
|
||||
if (_doorInfo == NULL) return false;
|
||||
doorInfo = _doorInfo;
|
||||
|
||||
bool oldCanOpenDoors = mob->getNavigation()->canOpenDoors();
|
||||
@@ -44,15 +44,15 @@ bool MoveThroughVillageGoal::canUse()
|
||||
|
||||
path = mob->getNavigation()->createPath(_doorInfo->x, _doorInfo->y, _doorInfo->z);
|
||||
mob->getNavigation()->setCanOpenDoors(oldCanOpenDoors);
|
||||
if (path != nullptr) return true;
|
||||
if (path != NULL) return true;
|
||||
|
||||
Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 10, 7, Vec3::newTemp(_doorInfo->x, _doorInfo->y, _doorInfo->z));
|
||||
if (pos == nullptr) return false;
|
||||
if (pos == NULL) return false;
|
||||
mob->getNavigation()->setCanOpenDoors(false);
|
||||
delete path;
|
||||
path = mob->getNavigation()->createPath(pos->x, pos->y, pos->z);
|
||||
mob->getNavigation()->setCanOpenDoors(oldCanOpenDoors);
|
||||
return path != nullptr;
|
||||
return path != NULL;
|
||||
}
|
||||
|
||||
bool MoveThroughVillageGoal::canContinueToUse()
|
||||
@@ -60,7 +60,7 @@ bool MoveThroughVillageGoal::canContinueToUse()
|
||||
if (mob->getNavigation()->isDone()) return false;
|
||||
float dist = mob->bbWidth + 4.f;
|
||||
shared_ptr<DoorInfo> _doorInfo = doorInfo.lock();
|
||||
if( _doorInfo == nullptr ) return false;
|
||||
if( _doorInfo == NULL ) return false;
|
||||
|
||||
return mob->distanceToSqr(_doorInfo->x, _doorInfo->y, _doorInfo->z) > dist * dist;
|
||||
}
|
||||
@@ -68,13 +68,13 @@ bool MoveThroughVillageGoal::canContinueToUse()
|
||||
void MoveThroughVillageGoal::start()
|
||||
{
|
||||
mob->getNavigation()->moveTo(path, speedModifier);
|
||||
path = nullptr;
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
void MoveThroughVillageGoal::stop()
|
||||
{
|
||||
shared_ptr<DoorInfo> _doorInfo = doorInfo.lock();
|
||||
if( _doorInfo == nullptr ) return;
|
||||
if( _doorInfo == NULL ) return;
|
||||
|
||||
if (mob->getNavigation()->isDone() || mob->distanceToSqr(_doorInfo->x, _doorInfo->y, _doorInfo->z) < 4 * 4)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user