From d8ee91b44e31cf1500926d37b7391e8c94bbf14a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 21 Dec 2024 03:30:18 +0000 Subject: Fix calculating radius and length of curved links --- game/network/link.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'game/network/link.h') diff --git a/game/network/link.h b/game/network/link.h index 725e023..4cca52c 100644 --- a/game/network/link.h +++ b/game/network/link.h @@ -16,7 +16,7 @@ template class Ray; // it has location class Node : public StdTypeDefs { public: - explicit Node(GlobalPosition3D p) noexcept : pos(p) {}; + explicit Node(GlobalPosition3D p) noexcept : pos(p) { }; virtual ~Node() noexcept = default; NO_COPY(Node); NO_MOVE(Node); @@ -38,7 +38,7 @@ public: Nexts nexts {}; }; - Link(End, End, float); + Link(End, End, RelativeDistance length); virtual ~Link() = default; NO_COPY(Link); NO_MOVE(Link); @@ -76,7 +76,7 @@ LinkStraight::~LinkStraight() = default; class LinkCurve : public virtual Link { public: inline ~LinkCurve() override = 0; - LinkCurve(GlobalPosition3D, RelativeDistance, Arc); + LinkCurve(GlobalPosition3D centreBase, RelativeDistance radius, Arc); NO_COPY(LinkCurve); NO_MOVE(LinkCurve); -- cgit v1.2.3 From 2e66a686cd6cf589c583060921430a94b2849e83 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 21 Dec 2024 14:10:01 +0000 Subject: Expose network link interface to define a base area of the link --- game/network/link.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'game/network/link.h') diff --git a/game/network/link.h b/game/network/link.h index 4cca52c..59bbb65 100644 --- a/game/network/link.h +++ b/game/network/link.h @@ -45,6 +45,7 @@ public: [[nodiscard]] virtual Location positionAt(RelativeDistance dist, unsigned char start) const = 0; [[nodiscard]] virtual bool intersectRay(const Ray &) const = 0; + [[nodiscard]] virtual std::vector getBase(RelativeDistance width) const = 0; std::array ends; float length; @@ -69,6 +70,7 @@ public: [[nodiscard]] Location positionAt(RelativeDistance dist, unsigned char start) const override; [[nodiscard]] bool intersectRay(const Ray &) const override; + [[nodiscard]] std::vector getBase(RelativeDistance width) const override; }; LinkStraight::~LinkStraight() = default; @@ -82,6 +84,7 @@ public: [[nodiscard]] Location positionAt(RelativeDistance dist, unsigned char start) const override; [[nodiscard]] bool intersectRay(const Ray &) const override; + [[nodiscard]] std::vector getBase(RelativeDistance width) const override; GlobalPosition3D centreBase; RelativeDistance radius; -- cgit v1.2.3