From 239b3ab10b460da34c490a7e06a21c984e21ffb6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 26 Nov 2021 20:21:12 +0000 Subject: Enable all Jason Turner recommended warnings --- game/network/network.cpp | 4 ++-- game/network/rail.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'game/network') diff --git a/game/network/network.cpp b/game/network/network.cpp index 6eaccef..47e51e2 100644 --- a/game/network/network.cpp +++ b/game/network/network.cpp @@ -36,8 +36,8 @@ void Network::joinLinks(const LinkPtr & l, const LinkPtr & ol) { if (l != ol) { - for (const auto oe : {0, 1}) { - for (const auto te : {0, 1}) { + for (const auto oe : {0U, 1U}) { + for (const auto te : {0U, 1U}) { if (l->ends[te].node == ol->ends[oe].node) { l->ends[te].nexts.emplace_back(ol, oe); ol->ends[oe].nexts.emplace_back(l, te); diff --git a/game/network/rail.cpp b/game/network/rail.cpp index 5127e34..46f11d6 100644 --- a/game/network/rail.cpp +++ b/game/network/rail.cpp @@ -135,7 +135,7 @@ RailLinkStraight::RailLinkStraight(NodePtr a, NodePtr b, const glm::vec3 & diff) vertices.reserve(2 * railCrossSection.size()); const auto len = round_sleepers(length / 2.F); const auto e {flat_orientation(diff)}; - for (int ei : {1, 0}) { + for (auto ei : {1U, 0U}) { const auto trans {glm::translate(ends[ei].node->pos) * e}; for (const auto & rcs : railCrossSection) { const glm::vec3 m {(trans * glm::vec4 {rcs.first, 1})}; @@ -164,10 +164,10 @@ RailLinkCurve::RailLinkCurve(const NodePtr & a, const NodePtr & b, glm::vec3 c, const auto step {glm::vec3 {arc_length(arc), e1p.z - e0p.z, slength} / segs}; const auto trans {glm::translate(centreBase)}; - auto segCount = std::lround(segs); + auto segCount = static_cast(std::lround(segs)) + 1; std::vector vertices; - vertices.reserve((segCount + 1) * railCrossSection.size()); - for (glm::vec3 swing = {arc.first, centreBase.z - e0p.z, 0.F}; segCount >= 0; swing += step, --segCount) { + vertices.reserve(segCount * railCrossSection.size()); + for (glm::vec3 swing = {arc.first, centreBase.z - e0p.z, 0.F}; segCount; swing += step, --segCount) { const auto t { trans * glm::rotate(half_pi - swing.x, up) * glm::translate(glm::vec3 {radius, 0.F, swing.y})}; for (const auto & rcs : railCrossSection) { -- cgit v1.2.3