diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-10-11 22:26:25 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-10-11 22:26:25 +0100 |
commit | bdf93b08301ebb43b2189249b14e149387652284 (patch) | |
tree | e7cb6b8a5b952283e323f8a7450fab3bd9cd4ecc /game/network/network.cpp | |
parent | Fix return type of network link factories (diff) | |
download | ilt-bdf93b08301ebb43b2189249b14e149387652284.tar.bz2 ilt-bdf93b08301ebb43b2189249b14e149387652284.tar.xz ilt-bdf93b08301ebb43b2189249b14e149387652284.zip |
Add candidateNodeAt, returns a network node why may not be part of the network
Diffstat (limited to 'game/network/network.cpp')
-rw-r--r-- | game/network/network.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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<NodePtr, bool> +Network::candidateNodeAt(glm::vec3 pos) const +{ + if (const auto n = nodes.find(std::make_shared<Node>(pos)); n != nodes.end()) { + return {*n, true}; + } + return {std::make_shared<Node>(pos), false}; +} + NodePtr Network::intersectRayNodes(const Ray & ray) const { |