From bdf93b08301ebb43b2189249b14e149387652284 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 11 Oct 2022 22:26:25 +0100 Subject: Add candidateNodeAt, returns a network node why may not be part of the network --- game/network/network.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'game/network/network.cpp') diff --git a/game/network/network.cpp b/game/network/network.cpp index 0189158..aff1aa4 100644 --- a/game/network/network.cpp +++ b/game/network/network.cpp @@ -35,6 +35,15 @@ Network::findNodeAt(glm::vec3 pos) const return {}; } +std::pair +Network::candidateNodeAt(glm::vec3 pos) const +{ + if (const auto n = nodes.find(std::make_shared(pos)); n != nodes.end()) { + return {*n, true}; + } + return {std::make_shared(pos), false}; +} + NodePtr Network::intersectRayNodes(const Ray & ray) const { -- cgit v1.2.3