From 163c8f75265054a168cc1e2750a0adb40fb08d83 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 22 Mar 2025 13:01:14 +0000 Subject: Make Collections::objects protected, extend interface Keeps all required features accessible, but through a controlled interface. --- game/network/network.impl.h | 8 ++++---- game/network/rail.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'game') diff --git a/game/network/network.impl.h b/game/network/network.impl.h index 0a2f9ca..294f696 100644 --- a/game/network/network.impl.h +++ b/game/network/network.impl.h @@ -8,7 +8,7 @@ template void NetworkOf::joinLinks(const Link::Ptr & l) const { - for (const auto & ol : links.objects) { + for (const auto & ol : links) { Network::joinLinks(l, ol); } } @@ -18,11 +18,11 @@ Link::Ptr NetworkOf::intersectRayLinks(const Ray & ray) const { // Click link - if (const auto link = std::find_if(links.objects.begin(), links.objects.end(), + if (const auto link = std::find_if(links.begin(), links.end(), [&ray](const std::shared_ptr & link) { return link->intersectRay(ray); }); - link != links.objects.end()) { + link != links.end()) { return *link; } return {}; @@ -32,7 +32,7 @@ template float NetworkOf::findNodeDirection(Node::AnyCPtr n) const { - for (const auto & l : links.objects) { + for (const auto & l : links) { for (const auto & e : l->ends) { // cppcheck-suppress useStlAlgorithm if (e.node.get() == n.get()) { diff --git a/game/network/rail.cpp b/game/network/rail.cpp index 5ce6036..dfe1dca 100644 --- a/game/network/rail.cpp +++ b/game/network/rail.cpp @@ -168,7 +168,7 @@ namespace { void RailLinks::render(const SceneShader & shader, const Frustum &) const { - if (!links.objects.empty()) { + if (!links.empty()) { texture->bind(); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1, 0); -- cgit v1.2.3