From fc90fd0f09fc07dc920f9a3c5106ff3b8d3cfe9c 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 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index 5a58dfb44f8..6e560962d04 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -966,8 +966,8 @@ class AActor final : public DThinker 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