summaryrefslogtreecommitdiff
path: root/game/network/network.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-03-10 00:53:08 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-03-10 00:53:08 +0000
commitc274ac05690b34ba05b41d6e7864e6a663c73c1a (patch)
treeb73b3654ae8cd99deba893b278378a4831e5c70c /game/network/network.cpp
parentAdd findNodeAt to locate a node instance by position (diff)
downloadilt-c274ac05690b34ba05b41d6e7864e6a663c73c1a.tar.bz2
ilt-c274ac05690b34ba05b41d6e7864e6a663c73c1a.tar.xz
ilt-c274ac05690b34ba05b41d6e7864e6a663c73c1a.zip
Push RailLinks functionality into new base classes Network and NetworkOf<>
Diffstat (limited to 'game/network/network.cpp')
-rw-r--r--game/network/network.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/game/network/network.cpp b/game/network/network.cpp
new file mode 100644
index 0000000..adda8fc
--- /dev/null
+++ b/game/network/network.cpp
@@ -0,0 +1,15 @@
+#include "network.h"
+#include <cache.h>
+#include <game/network/link.h>
+#include <gfx/models/texture.h>
+
+Network::Network(const std::string & tn) : texture {Texture::cachedTexture.get(tn)} { }
+
+NodePtr
+Network::findNodeAt(glm::vec3 pos) const
+{
+ if (const auto n = nodes.find(std::make_shared<Node>(pos)); n != nodes.end()) {
+ return *n;
+ }
+ return {};
+}