From 64a40f462001e56ab4cee2a29ecc5cef322b5688 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 12 May 2025 04:08:09 +0100 Subject: Remove all the old network link creation code --- game/network/network.impl.h | 102 -------------------------------------------- 1 file changed, 102 deletions(-) (limited to 'game/network/network.impl.h') diff --git a/game/network/network.impl.h b/game/network/network.impl.h index 04c5d7c..dda4974 100644 --- a/game/network/network.impl.h +++ b/game/network/network.impl.h @@ -1,4 +1,3 @@ -#include "collections.h" #include "network.h" #include #include @@ -43,107 +42,6 @@ NetworkOf::findNodeDirection(Node::AnyCPtr n) const throw std::runtime_error("Node exists but couldn't find it"); } -template -Link::CCollection -NetworkOf::candidateStraight(GlobalPosition3D positionA, GlobalPosition3D positionB) -{ - return {candidateLink(positionA, positionB)}; -} - -template -Link::CCollection -NetworkOf::candidateJoins(GlobalPosition3D start, GlobalPosition3D end) -{ - static constexpr auto MIN_DISTANCE = 2000.F; - if (::distance(start, end) < MIN_DISTANCE) { - return {}; - } - const auto defs = genCurveDef( - start, end, findNodeDirection(candidateNodeAt(start).first), findNodeDirection(candidateNodeAt(end).first)); - const auto & [c1s, c1e, c1c] = defs.first; - const auto & [c2s, c2e, c2c] = defs.second; - return {candidateLink(c1s, c1e, c1c), candidateLink(c2s, c2e, c2c)}; -} - -template -Link::CCollection -NetworkOf::candidateExtend(GlobalPosition3D start, GlobalPosition3D end) -{ - const auto [cstart, cend, centre] = genCurveDef(start, end, findNodeDirection(candidateNodeAt(start).first)); - return {candidateLink(cstart, cend, centre)}; -} - -template -Link::CCollection -NetworkOf::addStraight(const GeoData * geoData, GlobalPosition3D positionA, GlobalPosition3D positionB) -{ - Link::CCollection out; - geoData->walk(positionA.xy(), positionB, [geoData, &out, this, &positionA](const GeoData::WalkStep & step) { - if (step.previous.is_valid() && geoData->getSurface(step.current) != geoData->getSurface(step.previous)) { - const auto surfaceEdgePosition = geoData->positionAt(GeoData::PointFace(step.exitPosition, step.current)); - out.emplace_back(addLink(positionA, surfaceEdgePosition)); - positionA = surfaceEdgePosition; - } - }); - out.emplace_back(addLink(positionA, positionB)); - return out; -} - -template -Link::CCollection -NetworkOf::addCurve(const GeoData * geoData, const GenCurveDef & curve) -{ - static constexpr auto MIN_DISTANCE = 2000.F; - auto [cstart, cend, centre] = curve; - Link::CCollection out; - std::set> breaks; - const auto radiusMid = ::distance(cstart.xy(), centre); - for (const auto radiusOffset : {-getBaseWidth() / 2.F, 0.F, getBaseWidth() / 2.F}) { - const auto radius = radiusOffset + radiusMid; - const auto start = centre + (difference(cstart.xy(), centre) * radius) / radiusMid; - const auto end = centre + (difference(cend.xy(), centre) * radius) / radiusMid; - geoData->walk(start, end, centre, [geoData, &breaks](const GeoData::WalkStepCurve & step) { - if (step.previous.is_valid() && geoData->getSurface(step.current) != geoData->getSurface(step.previous)) { - breaks.insert(step); - } - }); - } - std::vector points; - points.reserve(breaks.size() + 2); - points.push_back(cstart); - std::ranges::transform( - breaks, std::back_inserter(points), [geoData, centre, radiusMid](const GeoData::WalkStepCurve & step) { - return (centre + (sincos(step.angle) * radiusMid)) - || geoData->positionAt(GeoData::PointFace(step.exitPosition, step.current)).z; - }); - points.push_back(cend); - mergeClose(points, ::distance<3, GlobalDistance>, ::midpoint<3, GlobalDistance>, MIN_DISTANCE); - std::ranges::transform(points | std::views::pairwise, std::back_inserter(out), [this, centre](const auto pair) { - const auto [a, b] = pair; - return this->addLink(a, b, centre); - }); - return out; -} - -template -Link::CCollection -NetworkOf::addJoins(const GeoData * geoData, GlobalPosition3D start, GlobalPosition3D end) -{ - static constexpr auto MIN_DISTANCE = 2000.F; - if (::distance(start, end) < MIN_DISTANCE) { - return {}; - } - const auto defs = genCurveDef(start, end, findNodeDirection(nodeAt(start)), findNodeDirection(nodeAt(end))); - return addCurve(geoData, defs.first) + addCurve(geoData, defs.second); -} - -template -Link::CCollection -NetworkOf::addExtend(const GeoData * geoData, GlobalPosition3D start, GlobalPosition3D end) -{ - return addCurve(geoData, genCurveDef(start, end, findNodeDirection(nodeAt(start)))); -} - template Link::Ptr NetworkOf::create(const GenStraightDef & def) -- cgit v1.2.3