summaryrefslogtreecommitdiff
path: root/game/network/rail.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-02-24 00:10:27 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-02-24 00:10:27 +0000
commit80529930ea3bc874c8da22c66343745ff6fdd45b (patch)
tree6441b090f24cf33638c5257e6b9eea4f14929503 /game/network/rail.cpp
parentMerge branch 'glcontainer-fix' (diff)
downloadilt-80529930ea3bc874c8da22c66343745ff6fdd45b.tar.bz2
ilt-80529930ea3bc874c8da22c66343745ff6fdd45b.tar.xz
ilt-80529930ea3bc874c8da22c66343745ff6fdd45b.zip
Simplify vector addition/subtraction with differnt types
Automatically applies correct rounding with float to int operations, adjusts test expectations accordingly.
Diffstat (limited to 'game/network/rail.cpp')
-rw-r--r--game/network/rail.cpp8
1 files changed, 4 insertions, 4 deletions
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<RailLinkCurve>(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<RailLinkCurve>(midh, start, c1);