From 5cba33aedccdfa79f1c291bc1da8ff2223d5c70a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 18 Dec 2024 19:56:38 +0000 Subject: Give UI builders an interface that can be programmatically called --- ui/builders/join.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui/builders/join.cpp') diff --git a/ui/builders/join.cpp b/ui/builders/join.cpp index 7474c5b..9fbbae9 100644 --- a/ui/builders/join.cpp +++ b/ui/builders/join.cpp @@ -46,8 +46,8 @@ BuilderJoin::click( } } -void +Link::CCollection BuilderJoin::create(Network * network, const Node::Ptr & p1, const Node::Ptr & p2) const { - network->addJoins(p1->pos, p2->pos); + return network->addJoins(p1->pos, p2->pos); } -- cgit v1.2.3 From 749df22c85b83c86ec68ebc74829287e54498e26 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 22 Dec 2024 13:53:27 +0000 Subject: Set terrain heights when creating new network links --- ui/builders/join.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ui/builders/join.cpp') diff --git a/ui/builders/join.cpp b/ui/builders/join.cpp index 9fbbae9..ee14d63 100644 --- a/ui/builders/join.cpp +++ b/ui/builders/join.cpp @@ -49,5 +49,7 @@ BuilderJoin::click( Link::CCollection BuilderJoin::create(Network * network, const Node::Ptr & p1, const Node::Ptr & p2) const { - return network->addJoins(p1->pos, p2->pos); + const auto links = network->addJoins(p1->pos, p2->pos); + setHeightsFor(network, links); + return links; } -- cgit v1.2.3 From 62fd9391bbfde47177fb36434d9664e47f4cf656 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 9 Feb 2025 13:02:09 +0000 Subject: Initial commit setting terrain during network construction This is all in the wrong place, it shouldn't be part of the network interface. --- ui/builders/join.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ui/builders/join.cpp') diff --git a/ui/builders/join.cpp b/ui/builders/join.cpp index ee14d63..6941e23 100644 --- a/ui/builders/join.cpp +++ b/ui/builders/join.cpp @@ -25,13 +25,13 @@ BuilderJoin::move(Network * network, const GeoData *, const SDL_MouseMotionEvent void BuilderJoin::click( - Network * network, const GeoData *, const SDL_MouseButtonEvent & e, const Ray & ray) + Network * network, const GeoData * geoData, const SDL_MouseButtonEvent & e, const Ray & ray) { switch (e.button) { case SDL_BUTTON_LEFT: if (const auto p = network->intersectRayNodes(ray)) { if (p1) { - create(network, p1, p); + create(network, geoData, p1, p); p1.reset(); candidateLinks.removeAll(); } @@ -47,9 +47,9 @@ BuilderJoin::click( } Link::CCollection -BuilderJoin::create(Network * network, const Node::Ptr & p1, const Node::Ptr & p2) const +BuilderJoin::create(Network * network, const GeoData * geoData, const Node::Ptr & p1, const Node::Ptr & p2) const { - const auto links = network->addJoins(p1->pos, p2->pos); + const auto links = network->addJoins(geoData, p1->pos, p2->pos); setHeightsFor(network, links); return links; } -- cgit v1.2.3