summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-10-08 15:51:19 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2022-10-08 15:51:19 +0100
commit6aba7c7dd1d6bcc1ddb4a5acb61ec0850c420824 (patch)
tree79e1bed8444b636326e169fa93d761e17ed3ed20 /game
parentSplit network intersect ray functions and return specific types (diff)
downloadilt-6aba7c7dd1d6bcc1ddb4a5acb61ec0850c420824.tar.bz2
ilt-6aba7c7dd1d6bcc1ddb4a5acb61ec0850c420824.tar.xz
ilt-6aba7c7dd1d6bcc1ddb4a5acb61ec0850c420824.zip
Add addStright to Network which looks up StraightLink in the network type
Diffstat (limited to 'game')
-rw-r--r--game/network/network.h8
-rw-r--r--game/network/rail.h4
2 files changed, 12 insertions, 0 deletions
diff --git a/game/network/network.h b/game/network/network.h
index 44ad095..c0485a9 100644
--- a/game/network/network.h
+++ b/game/network/network.h
@@ -30,6 +30,8 @@ public:
[[nodiscard]] Link::Nexts routeFromTo(const Link::End &, glm::vec3) const;
[[nodiscard]] Link::Nexts routeFromTo(const Link::End &, const NodePtr &) const;
+ virtual LinkPtr addStraight(glm::vec3, glm::vec3) = 0;
+
protected:
static void joinLinks(const LinkPtr & l, const LinkPtr & ol);
@@ -60,5 +62,11 @@ public:
return l;
}
+ LinkPtr
+ addStraight(glm::vec3 n1, glm::vec3 n2) override
+ {
+ return addLink<typename T::StraightLink>(n1, n2);
+ }
+
void render(const Shader &) const override;
};
diff --git a/game/network/rail.h b/game/network/rail.h
index 758beb6..c1cb579 100644
--- a/game/network/rail.h
+++ b/game/network/rail.h
@@ -16,10 +16,14 @@ class Vertex;
struct Arc;
// A piece of rail track
+class RailLinkStraight;
class RailLink : public virtual Link, public Renderable {
public:
RailLink() = default;
inline ~RailLink() override = 0;
+
+ using StraightLink = RailLinkStraight;
+
void render(const Shader &) const override;
NO_COPY(RailLink);
NO_MOVE(RailLink);