mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-26 01:37:08 +00:00
refactor: remove heap-allocated AABBs
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user