summaryrefslogtreecommitdiff
path: root/game/network/network.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'game/network/network.cpp')
-rw-r--r--game/network/network.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/game/network/network.cpp b/game/network/network.cpp
index 52d88ec..fd61764 100644
--- a/game/network/network.cpp
+++ b/game/network/network.cpp
@@ -1,7 +1,9 @@
#include "network.h"
+#include <array>
#include <cache.h>
#include <game/network/link.h>
#include <gfx/models/texture.h>
+#include <initializer_list>
#include <utility>
Network::Network(const std::string & tn) : texture {Texture::cachedTexture.get(tn)} { }
@@ -27,3 +29,18 @@ Network::findNodeAt(glm::vec3 pos) const
}
return {};
}
+
+void
+Network::joinLinks(const LinkPtr & l, const LinkPtr & ol)
+{
+ if (l != ol) {
+ for (const auto oe : {0, 1}) {
+ for (const auto te : {0, 1}) {
+ if (l->ends[te].node == ol->ends[oe].node) {
+ l->ends[te].nexts.emplace_back(ol, oe);
+ ol->ends[oe].nexts.emplace_back(l, te);
+ }
+ }
+ }
+ }
+}