From 81e2f0082ee2c5b3584135467c94111565a776b1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 13 Mar 2021 18:57:07 +0000 Subject: Add generic middle classes LinkStraight and LinkCurve --- game/network/rail.h | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'game/network/rail.h') diff --git a/game/network/rail.h b/game/network/rail.h index 3ecc59f..bfbb928 100644 --- a/game/network/rail.h +++ b/game/network/rail.h @@ -7,46 +7,45 @@ #include "link.h" #include "network.h" #include -#include -#include #include #include +#include class Shader; class Vertex; +struct Arc; // A piece of rail track -class RailLink : public Link, public Renderable { +class RailLink : public virtual Link, public Renderable { public: - using Link::Link; - + RailLink() = default; + inline ~RailLink() override = 0; void render(const Shader &) const override; + NO_COPY(RailLink); + NO_MOVE(RailLink); protected: + [[nodiscard]] glm::vec3 vehiclePositionOffset() const override; [[nodiscard]] static MeshPtr defaultMesh(const std::span vertices); MeshPtr mesh; }; +RailLink::~RailLink() = default; -class RailLinkStraight : public RailLink { +class RailLinkStraight : public RailLink, public LinkStraight { public: RailLinkStraight(const NodePtr &, const NodePtr &); - [[nodiscard]] Location positionAt(float dist, unsigned char start) const override; private: RailLinkStraight(NodePtr, NodePtr, const glm::vec3 & diff); }; -class RailLinkCurve : public RailLink { +class RailLinkCurve : public RailLink, public LinkCurve { public: RailLinkCurve(const NodePtr &, const NodePtr &, glm::vec2); - [[nodiscard]] Location positionAt(float dist, unsigned char start) const override; private: RailLinkCurve(const NodePtr &, const NodePtr &, glm::vec3, const Arc); - glm::vec3 centreBase; - float radius; - Arc arc; }; class RailLinks : public NetworkOf, public WorldObject { -- cgit v1.2.3