summaryrefslogtreecommitdiff
path: root/game/network/network.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-01-13 01:45:43 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2025-01-21 20:58:55 +0000
commit1aba027462a861f2c1155672792dbbe555d7dc0a (patch)
treef406c86cc0c610c05da63fc508d8963f0cb61ba4 /game/network/network.cpp
parentAdd default Q = glm::defaultp to maths functions (diff)
downloadilt-1aba027462a861f2c1155672792dbbe555d7dc0a.tar.bz2
ilt-1aba027462a861f2c1155672792dbbe555d7dc0a.tar.xz
ilt-1aba027462a861f2c1155672792dbbe555d7dc0a.zip
Add distance helperterrain-for-networks
Works with integer positions, first template param allows forcing to N dimensions
Diffstat (limited to 'game/network/network.cpp')
-rw-r--r--game/network/network.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/game/network/network.cpp b/game/network/network.cpp
index 1666c4d..e67942f 100644
--- a/game/network/network.cpp
+++ b/game/network/network.cpp
@@ -121,8 +121,8 @@ Network::genCurveDef(const GlobalPosition3D & start, const GlobalPosition3D & en
endDir += pi;
const auto flatStart {start.xy()}, flatEnd {end.xy()};
auto midheight = [&](auto mid) {
- const auto sm = glm::length(RelativePosition2D(flatStart - mid)),
- em = glm::length(RelativePosition2D(flatEnd - mid));
+ const auto sm = ::distance<2>(flatStart, mid);
+ const auto em = ::distance<2>(flatEnd, mid);
return start.z + GlobalDistance(RelativeDistance(end.z - start.z) * (sm / (sm + em)));
};
if (const auto radii = find_arcs_radius(flatStart, startDir, flatEnd, endDir); radii.first < radii.second) {