summaryrefslogtreecommitdiff
path: root/game/network/network.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-03-10 01:20:08 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-03-10 01:20:08 +0000
commitd240fc840ebe35499e09c48960d4d89ce25c2824 (patch)
tree5a0423cd488e38bb8dc3e9ab4a81f8959ad95c73 /game/network/network.cpp
parentVertices and indices vectors not required once mesh is created (diff)
downloadilt-d240fc840ebe35499e09c48960d4d89ce25c2824.tar.bz2
ilt-d240fc840ebe35499e09c48960d4d89ce25c2824.tar.xz
ilt-d240fc840ebe35499e09c48960d4d89ce25c2824.zip
Add some more helpers to Network
Diffstat (limited to 'game/network/network.cpp')
-rw-r--r--game/network/network.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/game/network/network.cpp b/game/network/network.cpp
index adda8fc..52d88ec 100644
--- a/game/network/network.cpp
+++ b/game/network/network.cpp
@@ -2,10 +2,24 @@
#include <cache.h>
#include <game/network/link.h>
#include <gfx/models/texture.h>
+#include <utility>
Network::Network(const std::string & tn) : texture {Texture::cachedTexture.get(tn)} { }
NodePtr
+Network::nodeAt(glm::vec3 pos)
+{
+ return *nodes.insert(std::make_shared<Node>(pos)).first;
+}
+
+std::pair<NodePtr, bool>
+Network::newNodeAt(glm::vec3 pos)
+{
+ const auto i = nodes.insert(std::make_shared<Node>(pos));
+ return {*i.first, i.second};
+}
+
+NodePtr
Network::findNodeAt(glm::vec3 pos) const
{
if (const auto n = nodes.find(std::make_shared<Node>(pos)); n != nodes.end()) {