From f2954a08d726c3c94212fb848adc3fe3cf298cf1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 25 Oct 2022 17:53:16 +0100 Subject: Move findDir into member function findNodeDirection --- game/network/network.impl.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'game/network/network.impl.h') diff --git a/game/network/network.impl.h b/game/network/network.impl.h index d112bf7..cee8155 100644 --- a/game/network/network.impl.h +++ b/game/network/network.impl.h @@ -37,6 +37,21 @@ NetworkOf::intersectRayLinks(const Ray & ray) const return {}; } +template +float +NetworkOf::findNodeDirection(Node::AnyCPtr n) const +{ + for (const auto & l : links.objects) { + for (const auto & e : l->ends) { + // cppcheck-suppress useStlAlgorithm + if (e.node.get() == n.get()) { + return e.dir; + } + } + } + throw std::runtime_error("Node exists but couldn't find it"); +} + template Link::CCollection NetworkOf::candidateStraight(glm::vec3 n1, glm::vec3 n2) -- cgit v1.2.3