From 381caebb524a5bb8f091d1aa2ca02d384e010961 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 7 Jan 2024 17:13:38 +0000 Subject: Global positions in network data --- game/network/link.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'game/network/link.h') diff --git a/game/network/link.h b/game/network/link.h index 95c141e..725e023 100644 --- a/game/network/link.h +++ b/game/network/link.h @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include @@ -17,12 +16,12 @@ template class Ray; // it has location class Node : public StdTypeDefs { public: - explicit Node(Position3D p) noexcept : pos(p) {}; + explicit Node(GlobalPosition3D p) noexcept : pos(p) {}; virtual ~Node() noexcept = default; NO_COPY(Node); NO_MOVE(Node); - Position3D pos; + GlobalPosition3D pos; }; // Generic network link @@ -44,21 +43,21 @@ public: NO_COPY(Link); NO_MOVE(Link); - [[nodiscard]] virtual Location positionAt(float dist, unsigned char start) const = 0; + [[nodiscard]] virtual Location positionAt(RelativeDistance dist, unsigned char start) const = 0; [[nodiscard]] virtual bool intersectRay(const Ray &) const = 0; std::array ends; float length; protected: - [[nodiscard]] virtual Position3D + [[nodiscard]] virtual RelativePosition3D vehiclePositionOffset() const { return {}; } }; -bool operator<(const Position3D & a, const Position3D & b); +bool operator<(const GlobalPosition3D & a, const GlobalPosition3D & b); bool operator<(const Node & a, const Node & b); class LinkStraight : public virtual Link { @@ -68,7 +67,7 @@ public: NO_COPY(LinkStraight); NO_MOVE(LinkStraight); - [[nodiscard]] Location positionAt(float dist, unsigned char start) const override; + [[nodiscard]] Location positionAt(RelativeDistance dist, unsigned char start) const override; [[nodiscard]] bool intersectRay(const Ray &) const override; }; @@ -77,15 +76,15 @@ LinkStraight::~LinkStraight() = default; class LinkCurve : public virtual Link { public: inline ~LinkCurve() override = 0; - LinkCurve(Position3D, float, Arc); + LinkCurve(GlobalPosition3D, RelativeDistance, Arc); NO_COPY(LinkCurve); NO_MOVE(LinkCurve); - [[nodiscard]] Location positionAt(float dist, unsigned char start) const override; + [[nodiscard]] Location positionAt(RelativeDistance dist, unsigned char start) const override; [[nodiscard]] bool intersectRay(const Ray &) const override; - Position3D centreBase; - float radius; + GlobalPosition3D centreBase; + RelativeDistance radius; Arc arc; }; -- cgit v1.2.3