Skip to content

Commit

Permalink
try to fix gcc thinking the vectors are uninitialized
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 committed Oct 7, 2023
1 parent 201951f commit fc90fd0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/playsim/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fc90fd0

Please sign in to comment.