summaryrefslogtreecommitdiff
path: root/game/network/rail.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-02-14 13:14:32 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-02-14 13:14:32 +0000
commitdd80098076cda9c103b44356ca07c2c8bc7698d7 (patch)
treeabea9da9105f33d8449bad00241d8406954d7bfb /game/network/rail.cpp
parentCorrectly scaled rails (diff)
downloadilt-dd80098076cda9c103b44356ca07c2c8bc7698d7.tar.bz2
ilt-dd80098076cda9c103b44356ca07c2c8bc7698d7.tar.xz
ilt-dd80098076cda9c103b44356ca07c2c8bc7698d7.zip
Join links in rail graph
Diffstat (limited to 'game/network/rail.cpp')
-rw-r--r--game/network/rail.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/game/network/rail.cpp b/game/network/rail.cpp
index fd2ea08..a66bf65 100644
--- a/game/network/rail.cpp
+++ b/game/network/rail.cpp
@@ -16,6 +16,23 @@ RailLinks::RailLinks() : texture {Texture::cachedTexture.get("rails.jpg")} { }
void RailLinks::tick(TickDuration) { }
void
+RailLinks::joinLinks(LinkPtr l) const
+{
+ for (const auto & ol : links.objects) {
+ if (l != ol) {
+ for (const auto oe : {0, 1}) {
+ for (const auto te : {0, 1}) {
+ if (l->ends[te].first == ol->ends[oe].first) {
+ l->nexts[te].emplace_back(ol.get(), oe);
+ ol->nexts[oe].emplace_back(l.get(), te);
+ }
+ }
+ }
+ }
+ }
+}
+
+void
RailLinks::render(const Shader & shader) const
{
shader.setModel(glm::identity<glm::mat4>());