summaryrefslogtreecommitdiff
path: root/ui/builders/join.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-05-11 12:22:19 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2025-05-11 12:22:19 +0100
commitacb76ffa0f45c5369e103f8868356d333ab2d954 (patch)
tree8ef1116b45b2a3e7e59b4b490ca5c90d48d31081 /ui/builders/join.cpp
parentLink helper to get an End pointer based on position (diff)
downloadilt-acb76ffa0f45c5369e103f8868356d333ab2d954.tar.bz2
ilt-acb76ffa0f45c5369e103f8868356d333ab2d954.tar.xz
ilt-acb76ffa0f45c5369e103f8868356d333ab2d954.zip
Build networks with new interface
Diffstat (limited to 'ui/builders/join.cpp')
-rw-r--r--ui/builders/join.cpp55
1 files changed, 0 insertions, 55 deletions
diff --git a/ui/builders/join.cpp b/ui/builders/join.cpp
deleted file mode 100644
index f6cbce5..0000000
--- a/ui/builders/join.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#include "join.h"
-#include <game/geoData.h>
-
-std::string
-BuilderJoin::hint() const
-{
- if (p1) {
- return "Pick second node";
- }
- return "Pick first node";
-}
-
-void
-BuilderJoin::move(Network * network, const GeoData *, const SDL_MouseMotionEvent &, const Ray<GlobalPosition3D> & ray)
-{
- if (p1) {
- if (const auto p = network->intersectRayNodes(ray)) {
- candidateLinks = network->candidateJoins(p1->pos, p->pos);
- }
- else {
- candidateLinks.clear();
- }
- }
-}
-
-void
-BuilderJoin::click(
- 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, geoData, p1, p);
- p1.reset();
- candidateLinks.clear();
- }
- else {
- p1 = p;
- }
- }
- return;
- case SDL_BUTTON_MIDDLE:
- p1.reset();
- return;
- }
-}
-
-Link::CCollection
-BuilderJoin::create(Network * network, const GeoData * geoData, const Node::Ptr & p1, const Node::Ptr & p2) const
-{
- const auto links = network->addJoins(geoData, p1->pos, p2->pos);
- setHeightsFor(network, links);
- return links;
-}