refactor: remove heap-allocated AABBs

This commit is contained in:
orng
2026-03-28 02:58:56 -05:00
parent e48a05bb8f
commit 7101d03c6a
88 changed files with 353 additions and 387 deletions

View File

@@ -16,7 +16,7 @@ ChangeStateConstraint::ChangeStateConstraint(
bool contains /*= true*/, bool changeGameMode /*= false*/,
GameType* targetGameMode /*= 0*/)
: TutorialConstraint(-1) {
movementArea = new AABB(x0, y0, z0, x1, y1, z1);
movementArea = AABB(x0, y0, z0, x1, y1, z1);
this->contains = contains;
@@ -40,7 +40,6 @@ ChangeStateConstraint::ChangeStateConstraint(
}
ChangeStateConstraint::~ChangeStateConstraint() {
delete movementArea;
if (m_sourceStatesCount > 0) delete[] m_sourceStates;
}
@@ -89,7 +88,7 @@ void ChangeStateConstraint::tick(int iPad) {
// TODO: check if this can be elided
Vec3 ipad_player = minecraft->localplayers[iPad]->getPos(1);
if (!m_bHasChanged && inASourceState &&
movementArea->contains(ipad_player) == contains) {
movementArea.contains(ipad_player) == contains) {
m_bHasChanged = true;
m_changedFromState = m_tutorial->getCurrentState();
m_tutorial->changeTutorialState(m_targetState);
@@ -127,7 +126,7 @@ void ChangeStateConstraint::tick(int iPad) {
}
}
} else if (m_bHasChanged &&
movementArea->contains(ipad_player) != contains) {
movementArea.contains(ipad_player) != contains) {
m_bHasChanged = false;
m_tutorial->changeTutorialState(m_changedFromState);