From 048f18e2a0b32044525cef41fa053984433c74b9 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 29 Dec 2023 14:12:40 +0000 Subject: Remove misleading power operator^ on vec2/3 --- game/network/link.cpp | 2 +- game/network/network.cpp | 4 ++-- game/network/rail.cpp | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'game/network') diff --git a/game/network/link.cpp b/game/network/link.cpp index d8479dd..703a1ca 100644 --- a/game/network/link.cpp +++ b/game/network/link.cpp @@ -46,7 +46,7 @@ LinkCurve::positionAt(float dist, unsigned char start) const const auto es {std::make_pair(ends[start].node.get(), ends[1 - start].node.get())}; const auto as {std::make_pair(arc[start], arc[1 - start])}; const auto ang {as.first + ((as.second - as.first) * frac)}; - const auto relPos {sincosf(ang) ^ 0.F * radius}; + const auto relPos {(sincosf(ang) || 0.F) * radius}; const auto relClimb {vehiclePositionOffset() + Position3D {0, 0, es.first->pos.z - centreBase.z + ((es.second->pos.z - es.first->pos.z) * frac)}}; const auto pitch {vector_pitch({0, 0, (es.second->pos.z - es.first->pos.z) / length})}; diff --git a/game/network/network.cpp b/game/network/network.cpp index 5de2f5d..1ff5b26 100644 --- a/game/network/network.cpp +++ b/game/network/network.cpp @@ -125,7 +125,7 @@ Network::genCurveDef(const Position3D & start, const Position3D & end, float sta const auto c1 = flatStart + sincosf(startDir + half_pi) * radius; const auto c2 = flatEnd + sincosf(endDir + half_pi) * radius; const auto mid = (c1 + c2) / 2.F; - const auto midh = mid ^ midheight(mid); + const auto midh = mid || midheight(mid); return {{start, midh, c1}, {end, midh, c2}}; } else { @@ -133,7 +133,7 @@ Network::genCurveDef(const Position3D & start, const Position3D & end, float sta const auto c1 = flatStart + sincosf(startDir - half_pi) * radius; const auto c2 = flatEnd + sincosf(endDir - half_pi) * radius; const auto mid = (c1 + c2) / 2.F; - const auto midh = mid ^ midheight(mid); + const auto midh = mid || midheight(mid); return {{midh, start, c1}, {midh, end, c2}}; } } diff --git a/game/network/rail.cpp b/game/network/rail.cpp index 545a728..303f1c8 100644 --- a/game/network/rail.cpp +++ b/game/network/rail.cpp @@ -57,7 +57,7 @@ RailLinks::addLinksBetween(Position3D start, Position3D end) const auto c1 = flatStart + sincosf(dir + half_pi) * radius; const auto c2 = flatEnd + sincosf(dir2 + half_pi) * radius; const auto mid = (c1 + c2) / 2.F; - const auto midh = mid ^ midheight(mid); + const auto midh = mid || midheight(mid); addLink(start, midh, c1); return addLink(end, midh, c2); } @@ -66,7 +66,7 @@ RailLinks::addLinksBetween(Position3D start, Position3D end) const auto c1 = flatStart + sincosf(dir - half_pi) * radius; const auto c2 = flatEnd + sincosf(dir2 - half_pi) * radius; const auto mid = (c1 + c2) / 2.F; - const auto midh = mid ^ midheight(mid); + const auto midh = mid || midheight(mid); addLink(midh, start, c1); return addLink(midh, end, c2); } @@ -133,7 +133,7 @@ RailLinkStraight::RailLinkStraight(Node::Ptr a, Node::Ptr b, const Position3D & for (auto ei : {1U, 0U}) { const auto trans {glm::translate(ends[ei].node->pos) * e}; for (const auto & rcs : railCrossSection) { - const Position3D m {(trans * (rcs.first ^ 1))}; + const Position3D m {(trans * (rcs.first || 1.F))}; vertices.emplace_back(m, Position2D {rcs.second, len * static_cast(ei)}, up); } } @@ -142,7 +142,7 @@ RailLinkStraight::RailLinkStraight(Node::Ptr a, Node::Ptr b, const Position3D & } RailLinkCurve::RailLinkCurve(const Node::Ptr & a, const Node::Ptr & b, Position2D c) : - RailLinkCurve(a, b, c ^ a->pos.z, {c ^ 0.F, a->pos, b->pos}) + RailLinkCurve(a, b, c || a->pos.z, {c || 0.F, a->pos, b->pos}) { } @@ -166,7 +166,7 @@ RailLinkCurve::RailLinkCurve(const Node::Ptr & a, const Node::Ptr & b, Position3 const auto t { trans * glm::rotate(half_pi - swing.x, up) * glm::translate(Position3D {radius, 0.F, swing.y})}; for (const auto & rcs : railCrossSection) { - const Position3D m {(t * (rcs.first ^ 1))}; + const Position3D m {(t * (rcs.first || 1.F))}; vertices.emplace_back(m, Position2D {rcs.second, swing.z}, up); } } -- cgit v1.2.3