From 789a16e4e97d4050bb8db9cc3aebb01e807ac8c7 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 10 Mar 2021 01:54:40 +0000 Subject: Push more RailLinks logic down into NetworkOf --- game/network/network.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'game/network/network.cpp') 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 #include #include #include +#include #include 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); + } + } + } + } +} -- cgit v1.2.3