refactor: remove calls to Vec3::newTemp when not returned

This commit is contained in:
orng
2026-03-26 04:19:04 -05:00
parent 9405f38f80
commit bee10e55a8
37 changed files with 6791 additions and 6831 deletions

View File

@@ -135,14 +135,14 @@ void Throwable::tick() {
flightTime++;
}
Vec3* from = Vec3::newTemp(x, y, z);
Vec3* to = Vec3::newTemp(x + xd, y + yd, z + zd);
HitResult* res = level->clip(from, to);
Vec3 from(x, y, z);
Vec3 to(x + xd, y + yd, z + zd);
HitResult* res = level->clip(&from, &to);
from = Vec3::newTemp(x, y, z);
to = Vec3::newTemp(x + xd, y + yd, z + zd);
from = Vec3(x, y, z);
to = Vec3(x + xd, y + yd, z + zd);
if (res != NULL) {
to = Vec3::newTemp(res->pos.x, res->pos.y, res->pos.z);
to = Vec3(res->pos.x, res->pos.y, res->pos.z);
}
if (!level->isClientSide) {
@@ -157,9 +157,9 @@ void Throwable::tick() {
float rr = 0.3f;
AABB* bb = e->bb->grow(rr, rr, rr);
HitResult* p = bb->clip(from, to);
HitResult* p = bb->clip(&from, &to);
if (p != NULL) {
double dd = from->distanceTo(p->pos);
double dd = from.distanceTo(p->pos);
delete p;
if (dd < nearest || nearest == 0) {
hitEntity = e;