diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-02-24 00:10:27 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-02-24 00:10:27 +0000 |
commit | 80529930ea3bc874c8da22c66343745ff6fdd45b (patch) | |
tree | 6441b090f24cf33638c5257e6b9eea4f14929503 /game/network/link.cpp | |
parent | Merge branch 'glcontainer-fix' (diff) | |
download | ilt-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/link.cpp')
-rw-r--r-- | game/network/link.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/game/network/link.cpp b/game/network/link.cpp index 932fc67..122eaf4 100644 --- a/game/network/link.cpp +++ b/game/network/link.cpp @@ -28,8 +28,7 @@ LinkStraight::positionAt(RelativeDistance dist, unsigned char start) const const auto es {std::make_pair(ends[start].node.get(), ends[1 - start].node.get())}; const RelativePosition3D diff {es.second->pos - es.first->pos}; const auto dir {glm::normalize(diff)}; - return Location {es.first->pos + GlobalPosition3D(vehiclePositionOffset() + dir * dist), - {vector_pitch(dir), vector_yaw(dir), 0}}; + return Location {es.first->pos + (vehiclePositionOffset() + dir * dist), {vector_pitch(dir), vector_yaw(dir), 0}}; } bool @@ -70,7 +69,7 @@ LinkCurve::intersectRay(const Ray<GlobalPosition3D> & ray) const points.reserve(segCount); for (std::remove_const_t<decltype(step)> swing = {arc.first, centreBase.z - e0p.z}; segCount; swing += step, --segCount) { - points.emplace_back(centreBase + GlobalPosition3D((sincosf(swing.x) * radius) || swing.y)); + points.emplace_back(centreBase + ((sincosf(swing.x) * radius) || swing.y)); } return ray.passesCloseToEdges(points, 1.F); } |