summaryrefslogtreecommitdiff
path: root/ui/builders/join.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ui/builders/join.cpp')
-rw-r--r--ui/builders/join.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/ui/builders/join.cpp b/ui/builders/join.cpp
index 7474c5b..f6cbce5 100644
--- a/ui/builders/join.cpp
+++ b/ui/builders/join.cpp
@@ -15,25 +15,25 @@ BuilderJoin::move(Network * network, const GeoData *, const SDL_MouseMotionEvent
{
if (p1) {
if (const auto p = network->intersectRayNodes(ray)) {
- candidateLinks.objects = network->candidateJoins(p1->pos, p->pos);
+ candidateLinks = network->candidateJoins(p1->pos, p->pos);
}
else {
- candidateLinks.removeAll();
+ candidateLinks.clear();
}
}
}
void
BuilderJoin::click(
- Network * network, const GeoData *, const SDL_MouseButtonEvent & e, const Ray<GlobalPosition3D> & ray)
+ Network * network, const GeoData * geoData, const SDL_MouseButtonEvent & e, const Ray<GlobalPosition3D> & 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();
+ candidateLinks.clear();
}
else {
p1 = p;
@@ -46,8 +46,10 @@ BuilderJoin::click(
}
}
-void
-BuilderJoin::create(Network * network, const Node::Ptr & p1, const Node::Ptr & p2) const
+Link::CCollection
+BuilderJoin::create(Network * network, const GeoData * geoData, const Node::Ptr & p1, const Node::Ptr & p2) const
{
- network->addJoins(p1->pos, p2->pos);
+ const auto links = network->addJoins(geoData, p1->pos, p2->pos);
+ setHeightsFor(network, links);
+ return links;
}