From 80529930ea3bc874c8da22c66343745ff6fdd45b Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 24 Feb 2024 00:10:27 +0000 Subject: Simplify vector addition/subtraction with differnt types Automatically applies correct rounding with float to int operations, adjusts test expectations accordingly. --- game/network/rail.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'game/network/rail.cpp') diff --git a/game/network/rail.cpp b/game/network/rail.cpp index 176a704..34cbceb 100644 --- a/game/network/rail.cpp +++ b/game/network/rail.cpp @@ -45,8 +45,8 @@ RailLinks::addLinksBetween(GlobalPosition3D start, GlobalPosition3D end) const float dir2 = pi + findNodeDirection(node2ins.first); if (const auto radii = find_arcs_radius(flatStart, dir, flatEnd, dir2); radii.first < radii.second) { const auto radius {radii.first}; - const auto c1 = flatStart + GlobalPosition2D(sincosf(dir + half_pi) * radius); - const auto c2 = flatEnd + GlobalPosition2D(sincosf(dir2 + half_pi) * radius); + const auto c1 = flatStart + (sincosf(dir + half_pi) * radius); + const auto c2 = flatEnd + (sincosf(dir2 + half_pi) * radius); const auto mid = (c1 + c2) / 2; const auto midh = mid || midheight(mid); addLink(start, midh, c1); @@ -54,8 +54,8 @@ RailLinks::addLinksBetween(GlobalPosition3D start, GlobalPosition3D end) } else { const auto radius {radii.second}; - const auto c1 = flatStart + GlobalPosition2D(sincosf(dir - half_pi) * radius); - const auto c2 = flatEnd + GlobalPosition2D(sincosf(dir2 - half_pi) * radius); + const auto c1 = flatStart + (sincosf(dir - half_pi) * radius); + const auto c2 = flatEnd + (sincosf(dir2 - half_pi) * radius); const auto mid = (c1 + c2) / 2; const auto midh = mid || midheight(mid); addLink(midh, start, c1); -- cgit v1.2.3