From 92f6774eecbcb8668888e7b53911ac828a52de66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= Date: Sat, 7 Oct 2023 20:31:50 -0300 Subject: [PATCH] try to fix gcc thinking the vectors are uninitialized --- src/playsim/actor.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index 5a58dfb44f8..1bef8815ab4 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -960,14 +960,14 @@ class AActor final : public DThinker double Distance2DSquared(AActor *other, bool absolute = false) { - DVector2 otherpos = absolute ? other->Pos().XY() : other->PosRelative(this).XY(); - return (Pos().XY() - otherpos).LengthSquared(); + DVector3 otherpos = absolute ? other->Pos() : other->PosRelative(this); + return (Pos().XY() - otherpos.XY()).LengthSquared(); } double Distance2D(AActor *other, bool absolute = false) const { - DVector2 otherpos = absolute ? other->Pos().XY() : other->PosRelative(this).XY(); - return (Pos().XY() - otherpos).Length(); + DVector3 otherpos = absolute ? other->Pos() : other->PosRelative(this); + return (Pos().XY() - otherpos.XY()).Length(); } double Distance2D(double x, double y) const @@ -997,14 +997,14 @@ class AActor final : public DThinker DAngle AngleTo(AActor *other, bool absolute = false) { - DVector2 otherpos = absolute ? other->Pos().XY() : other->PosRelative(this).XY(); - return VecToAngle(otherpos - Pos().XY()); + DVector3 otherpos = absolute ? other->Pos() : other->PosRelative(this); + return VecToAngle(otherpos.XY() - Pos().XY()); } DAngle AngleTo(AActor *other, double oxofs, double oyofs, bool absolute = false) const { - DVector2 otherpos = absolute ? other->Pos().XY() : other->PosRelative(this).XY(); - return VecToAngle(otherpos - Pos() + DVector2(oxofs, oyofs)); + DVector3 otherpos = absolute ? other->Pos() : other->PosRelative(this); + return VecToAngle(otherpos.XY() - Pos().XY() + DVector2(oxofs, oyofs)); } DVector2 Vec2To(AActor *other) const