From d00fcb72da106a55d1256d853b4742257052cdb3 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 10 Mar 2021 00:24:26 +0000 Subject: Add findNodeAt to locate a node instance by position --- game/network/rail.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'game/network/rail.cpp') diff --git a/game/network/rail.cpp b/game/network/rail.cpp index 25b3376..8ec6893 100644 --- a/game/network/rail.cpp +++ b/game/network/rail.cpp @@ -37,6 +37,15 @@ RailLinks::joinLinks(const LinkPtr & l) const } } +NodePtr +RailLinks::findNodeAt(glm::vec3 pos) const +{ + if (const auto n = nodes.find(std::make_shared(pos)); n != nodes.end()) { + return *n; + } + return {}; +} + std::shared_ptr RailLinks::addLinksBetween(glm::vec3 start, glm::vec3 end) { -- cgit v1.2.3