refactor: replace AABB::newPermanent with new AABB

This commit is contained in:
orng 2026-03-27 21:17:55 -05:00
parent 79217ca8e3
commit 534879e2e7
11 changed files with 10 additions and 17 deletions

View file

@ -130,7 +130,7 @@ void ApplySchematicRuleDefinition::updateLocationBox() {
if (m_schematic == NULL)
m_schematic = m_levelGenOptions->getSchematicFile(m_schematicName);
m_locationBox = AABB::newPermanent(0, 0, 0, 0, 0, 0);
m_locationBox = new AABB(0, 0, 0, 0, 0, 0);
m_locationBox->x0 = m_location.x;
m_locationBox->y0 = m_location.y;

View file

@ -5,7 +5,7 @@
NamedAreaRuleDefinition::NamedAreaRuleDefinition() {
m_name = L"";
m_area = AABB::newPermanent(0, 0, 0, 0, 0, 0);
m_area = new AABB(0, 0, 0, 0, 0, 0);
}
NamedAreaRuleDefinition::~NamedAreaRuleDefinition() { delete m_area; }

View file

@ -11,8 +11,8 @@ AreaConstraint::AreaConstraint(int descriptionId, double x0, double y0,
bool restrictsMovement /*=true*/)
: TutorialConstraint(descriptionId) {
messageArea =
AABB::newPermanent(x0 + 2, y0 + 2, z0 + 2, x1 - 2, y1 - 2, z1 - 2);
movementArea = AABB::newPermanent(x0, y0, z0, x1, y1, z1);
new AABB(x0 + 2, y0 + 2, z0 + 2, x1 - 2, y1 - 2, z1 - 2);
movementArea = new AABB(x0, y0, z0, x1, y1, z1);
this->contains = contains;
m_restrictsMovement = restrictsMovement;

View file

@ -12,7 +12,7 @@ AreaHint::AreaHint(eTutorial_Hint id, Tutorial* tutorial,
double x1, double y1, double z1, bool allowFade /*= false*/,
bool contains /*= true*/)
: TutorialHint(id, tutorial, descriptionId, e_Hint_Area, allowFade) {
area = AABB::newPermanent(x0, y0, z0, x1, y1, z1);
area = new AABB(x0, y0, z0, x1, y1, z1);
this->contains = contains;

View file

@ -16,7 +16,7 @@ ChangeStateConstraint::ChangeStateConstraint(
bool contains /*= true*/, bool changeGameMode /*= false*/,
GameType* targetGameMode /*= 0*/)
: TutorialConstraint(-1) {
movementArea = AABB::newPermanent(x0, y0, z0, x1, y1, z1);
movementArea = new AABB(x0, y0, z0, x1, y1, z1);
this->contains = contains;

View file

@ -95,7 +95,7 @@ void Chunk::setPos(int x, int y, int z) {
// 4J - changed to just set the value rather than make a new one, if we've
// already created storage
if (bb == NULL) {
bb = AABB::newPermanent(-g, -g, -g, XZSIZE + g, SIZE + g, XZSIZE + g);
bb = new AABB(-g, -g, -g, XZSIZE + g, SIZE + g, XZSIZE + g);
} else {
// 4J MGH - bounds are relative to the position now, so the AABB will be
// setup already, either above, or from the tesselator bounds.

View file

@ -3901,7 +3901,7 @@ void LevelRenderer::DestroyedTileManager::destroyingTileAt(Level* level, int x,
// Make these temporary AABBs into permanently allocated AABBs
for (unsigned int i = 0; i < recentTile->boxes.size(); i++) {
recentTile->boxes[i] = AABB::newPermanent(
recentTile->boxes[i] = new AABB(
recentTile->boxes[i]->x0, recentTile->boxes[i]->y0,
recentTile->boxes[i]->z0, recentTile->boxes[i]->x1,
recentTile->boxes[i]->y1, recentTile->boxes[i]->z1);

View file

@ -268,7 +268,7 @@ void Entity::_init(bool useSmallId, Level* level) {
xd = yd = zd = 0.0;
yRot = xRot = 0.0f;
yRotO = xRotO = 0.0f;
bb = AABB::newPermanent(0, 0, 0, 0, 0, 0); // 4J Was final
bb = new AABB(0, 0, 0, 0, 0, 0); // 4J Was final
onGround = false;
horizontalCollision = verticalCollision = false;
collision = false;

View file

@ -73,7 +73,7 @@ void EnderDragon::_init() {
m_actionTicks = 0;
m_sittingDamageReceived = 0;
m_headYRot = 0.0;
m_acidArea = AABB::newPermanent(-4, -10, -3, 6, 3, 3);
m_acidArea = new AABB(-4, -10, -3, 6, 3, 3);
m_flameAttacks = 0;
for (int i = 0; i < positionsLength; i++) {

View file

@ -40,11 +40,6 @@ void AABB::ReleaseThreadStorage() {
}
}
AABB* AABB::newPermanent(double x0, double y0, double z0, double x1, double y1,
double z1) {
return new AABB(x0, y0, z0, x1, y1, z1);
}
void AABB::clearPool() {}
void AABB::resetPool() {}

View file

@ -26,8 +26,6 @@ public:
static void UseDefaultThreadStorage();
static void ReleaseThreadStorage();
static AABB* newPermanent(double x0, double y0, double z0, double x1,
double y1, double z1);
static void clearPool();
static void resetPool();
static AABB* newTemp(double x0, double y0, double z0, double x1, double y1,