summaryrefslogtreecommitdiff
path: root/game/network/network.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/network.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/network.cpp')
-rw-r--r--game/network/network.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/game/network/network.cpp b/game/network/network.cpp
index b6c52b8..65b2a62 100644
--- a/game/network/network.cpp
+++ b/game/network/network.cpp
@@ -121,16 +121,16 @@ Network::genCurveDef(const GlobalPosition3D & start, const GlobalPosition3D & en
};
if (const auto radii = find_arcs_radius(flatStart, startDir, flatEnd, endDir); radii.first < radii.second) {
const auto radius {radii.first};
- const auto c1 = flatStart + GlobalPosition2D(sincosf(startDir + half_pi) * radius);
- const auto c2 = flatEnd + GlobalPosition2D(sincosf(endDir + half_pi) * radius);
+ const auto c1 = flatStart + (sincosf(startDir + half_pi) * radius);
+ const auto c2 = flatEnd + (sincosf(endDir + half_pi) * radius);
const auto mid = (c1 + c2) / 2;
const auto midh = mid || midheight(mid);
return {{start, midh, c1}, {end, midh, c2}};
}
else {
const auto radius {radii.second};
- const auto c1 = flatStart + GlobalPosition2D(sincosf(startDir - half_pi) * radius);
- const auto c2 = flatEnd + GlobalPosition2D(sincosf(endDir - half_pi) * radius);
+ const auto c1 = flatStart + (sincosf(startDir - half_pi) * radius);
+ const auto c2 = flatEnd + (sincosf(endDir - half_pi) * radius);
const auto mid = (c1 + c2) / 2;
const auto midh = mid || midheight(mid);
return {{midh, start, c1}, {midh, end, c2}};