Project modernization (#630)

* Fixed boats falling and a TP glitch #266

* Replaced every C-style cast with C++ ones

* Replaced every C-style cast with C++ ones

* Fixed boats falling and a TP glitch #266

* Updated NULL to nullptr and fixing some type issues

* Modernized and fixed a few bugs

- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.

* Fixing more conflicts

* Replace int loops with size_t and start work on overrides
This commit is contained in:
ModMaker101
2026-03-07 21:56:03 -05:00
committed by GitHub
parent 1be5faaea7
commit a9be52c41a
1373 changed files with 19903 additions and 19449 deletions

View File

@@ -11,7 +11,7 @@
MoveThroughVillageGoal::MoveThroughVillageGoal(PathfinderMob *mob, double speedModifier, bool onlyAtNight)
{
path = NULL;
path = nullptr;
doorInfo = weak_ptr<DoorInfo>();
this->mob = mob;
@@ -22,7 +22,7 @@ MoveThroughVillageGoal::MoveThroughVillageGoal(PathfinderMob *mob, double speedM
MoveThroughVillageGoal::~MoveThroughVillageGoal()
{
if(path != NULL) delete path;
if(path != nullptr) 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 == NULL) return false;
if (village == nullptr) return false;
shared_ptr<DoorInfo> _doorInfo = getNextDoorInfo(village);
if (_doorInfo == NULL) return false;
if (_doorInfo == nullptr) 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 != NULL) return true;
if (path != nullptr) 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 == NULL) return false;
if (pos == nullptr) return false;
mob->getNavigation()->setCanOpenDoors(false);
delete path;
path = mob->getNavigation()->createPath(pos->x, pos->y, pos->z);
mob->getNavigation()->setCanOpenDoors(oldCanOpenDoors);
return path != NULL;
return path != nullptr;
}
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 == NULL ) return false;
if( _doorInfo == nullptr ) 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 = NULL;
path = nullptr;
}
void MoveThroughVillageGoal::stop()
{
shared_ptr<DoorInfo> _doorInfo = doorInfo.lock();
if( _doorInfo == NULL ) return;
if( _doorInfo == nullptr ) return;
if (mob->getNavigation()->isDone() || mob->distanceToSqr(_doorInfo->x, _doorInfo->y, _doorInfo->z) < 4 * 4)
{