summaryrefslogtreecommitdiff
path: root/game/network/network.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-10-08 15:43:53 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2022-10-08 15:43:53 +0100
commit18eacf4ba682400a62a1a975f30ad1284925d248 (patch)
treee623c1a337a0f29edb13a42d9d4b4e08a0aaaa72 /game/network/network.h
parentTranslate mouse motion y axis (diff)
downloadilt-18eacf4ba682400a62a1a975f30ad1284925d248.tar.bz2
ilt-18eacf4ba682400a62a1a975f30ad1284925d248.tar.xz
ilt-18eacf4ba682400a62a1a975f30ad1284925d248.zip
Split network intersect ray functions and return specific types
Diffstat (limited to 'game/network/network.h')
-rw-r--r--game/network/network.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/game/network/network.h b/game/network/network.h
index 64f3f91..44ad095 100644
--- a/game/network/network.h
+++ b/game/network/network.h
@@ -18,21 +18,20 @@ class Ray;
class Network {
public:
using LinkEnd = std::pair<LinkPtr, unsigned char>;
- using IntersectRayResult = std::variant<std::nullptr_t, NodePtr, LinkEnd, LinkPtr>;
explicit Network(const std::string & textureName);
virtual ~Network() = default;
[[nodiscard]] NodePtr findNodeAt(glm::vec3) const;
[[nodiscard]] NodePtr nodeAt(glm::vec3);
[[nodiscard]] std::pair<NodePtr, bool> newNodeAt(glm::vec3);
- [[nodiscard]] IntersectRayResult intersectRay(const Ray &) const;
+ [[nodiscard]] virtual LinkPtr intersectRayLinks(const Ray &) const = 0;
+ [[nodiscard]] virtual NodePtr intersectRayNodes(const Ray &) const;
[[nodiscard]] Link::Nexts routeFromTo(const Link::End &, glm::vec3) const;
[[nodiscard]] Link::Nexts routeFromTo(const Link::End &, const NodePtr &) const;
protected:
static void joinLinks(const LinkPtr & l, const LinkPtr & ol);
- [[nodiscard]] virtual IntersectRayResult intersectRayLinks(const Ray &) const = 0;
using Nodes = std::set<NodePtr, PtrSorter<NodePtr>>;
Nodes nodes;
@@ -47,7 +46,7 @@ protected:
void joinLinks(const LinkPtr &) const;
protected:
- [[nodiscard]] IntersectRayResult intersectRayLinks(const Ray &) const override;
+ [[nodiscard]] LinkPtr intersectRayLinks(const Ray &) const override;
public:
template<typename L, typename... Params>