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/rail.cpp | 55 --------------------------------------------------- 1 file changed, 55 deletions(-) (limited to 'game/network/rail.cpp') diff --git a/game/network/rail.cpp b/game/network/rail.cpp index 37eb7df..342a2ad 100644 --- a/game/network/rail.cpp +++ b/game/network/rail.cpp @@ -18,61 +18,6 @@ RailLinks::tick(TickDuration) { } -std::shared_ptr -RailLinks::addLinksBetween(GlobalPosition3D start, GlobalPosition3D end) -{ - auto node1ins = newNodeAt(start), node2ins = newNodeAt(end); - if (node1ins.second == NodeIs::NotInNetwork && node2ins.second == NodeIs::NotInNetwork) { - // Both nodes are new, direct link, easy - return addLink(start, end); - } - if (node1ins.second == NodeIs::NotInNetwork && node2ins.second == NodeIs::InNetwork) { - // node1 is new, node2 exists, but we build from existing outwards - std::swap(node1ins, node2ins); - std::swap(start, end); - } - // Find start link/end - opposite entry dir to existing link; so pi +... - const Angle dir = pi + findNodeDirection(node1ins.first); - if (dir == vector_yaw(difference(end, start))) { - return addLink(start, end); - } - const auto flatStart {start.xy()}, flatEnd {end.xy()}; - if (node2ins.second == NodeIs::InNetwork) { - auto midheight = [&](auto mid) { - const auto startToMid = ::distance<2>(flatStart, mid); - const auto endToMid = ::distance<2>(flatEnd, mid); - return start.z + GlobalDistance(RelativeDistance(end.z - start.z) * (startToMid / (startToMid + endToMid))); - }; - const float dir2 = pi + findNodeDirection(node2ins.first); - const auto radii = find_arcs_radius(flatStart, dir, flatEnd, dir2); - if (radii.first < radii.second) { - const auto radius = radii.first; - const auto centre1 = flatStart + (sincos(dir + half_pi) * radius); - const auto centre2 = flatEnd + (sincos(dir2 + half_pi) * radius); - const auto mid = (centre1 + centre2) / 2; - const auto midh = mid || midheight(mid); - addLink(start, midh, centre1); - return addLink(end, midh, centre2); - } - const auto radius = radii.second; - const auto centre1 = flatStart + (sincos(dir - half_pi) * radius); - const auto centre2 = flatEnd + (sincos(dir2 - half_pi) * radius); - const auto mid = (centre1 + centre2) / 2; - const auto midh = mid || midheight(mid); - addLink(midh, start, centre1); - return addLink(midh, end, centre2); - } - const auto diff = difference(end, start); - const auto yaw = vector_yaw(diff); - const auto n2ed = (yaw * 2) - dir - pi; - const auto centre = find_arc_centre(flatStart, dir, flatEnd, n2ed); - - if (centre.second) { // right hand arc - std::swap(start, end); - } - return addLink(start, end, centre.first); -} - namespace { constexpr const std::array RAIL_CROSS_SECTION {{ {-1330.F, 0.F, 0}, -- cgit v1.2.3