summaryrefslogtreecommitdiff
path: root/game/network/link.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-03-13 18:57:07 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-03-13 18:59:43 +0000
commit81e2f0082ee2c5b3584135467c94111565a776b1 (patch)
tree00c23d71090ac55c5d8218f5e86212992f2e1453 /game/network/link.h
parentMore complete tests for route finding (diff)
downloadilt-81e2f0082ee2c5b3584135467c94111565a776b1.tar.bz2
ilt-81e2f0082ee2c5b3584135467c94111565a776b1.tar.xz
ilt-81e2f0082ee2c5b3584135467c94111565a776b1.zip
Add generic middle classes LinkStraight and LinkCurve
Diffstat (limited to 'game/network/link.h')
-rw-r--r--game/network/link.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/game/network/link.h b/game/network/link.h
index a174275..16ae5f7 100644
--- a/game/network/link.h
+++ b/game/network/link.h
@@ -4,6 +4,7 @@
#include <array>
#include <glm/glm.hpp>
#include <location.hpp>
+#include <maths.h>
#include <memory>
#include <special_members.hpp>
#include <utility>
@@ -50,9 +51,42 @@ public:
std::array<End, 2> ends;
float length;
+
+protected:
+ [[nodiscard]] virtual glm::vec3
+ vehiclePositionOffset() const
+ {
+ return {};
+ }
};
bool operator<(const glm::vec3 & a, const glm::vec3 & b);
bool operator<(const Node & a, const Node & b);
+class LinkStraight : public virtual Link {
+public:
+ LinkStraight() = default;
+ inline ~LinkStraight() override = 0;
+ NO_COPY(LinkStraight);
+ NO_MOVE(LinkStraight);
+
+ [[nodiscard]] Location positionAt(float dist, unsigned char start) const override;
+};
+LinkStraight::~LinkStraight() = default;
+
+class LinkCurve : public virtual Link {
+public:
+ inline ~LinkCurve() override = 0;
+ LinkCurve(glm::vec3, float, Arc);
+ NO_COPY(LinkCurve);
+ NO_MOVE(LinkCurve);
+
+ [[nodiscard]] Location positionAt(float dist, unsigned char start) const override;
+
+ glm::vec3 centreBase;
+ float radius;
+ Arc arc;
+};
+LinkCurve::~LinkCurve() = default;
+
#endif