diff --git a/apps/openmw/mwworld/cellpreloader.cpp b/apps/openmw/mwworld/cellpreloader.cpp index 6bc60968cb..dfd69b2e5c 100644 --- a/apps/openmw/mwworld/cellpreloader.cpp +++ b/apps/openmw/mwworld/cellpreloader.cpp @@ -448,7 +448,7 @@ namespace MWWorld void CellPreloader::abortTerrainPreloadExcept(const CellPreloader::PositionCellGrid *exceptPos) { const float resetThreshold = ESM::Land::REAL_SIZE; - for (auto pos : mTerrainPreloadPositions) + for (const auto& pos : mTerrainPreloadPositions) if (exceptPos && (pos.first-exceptPos->first).length2() < resetThreshold*resetThreshold && pos.second == exceptPos->second) return; if (mTerrainPreloadItem && !mTerrainPreloadItem->isDone()) @@ -461,10 +461,10 @@ namespace MWWorld bool contains(const std::vector& container, const std::vector& contained) { - for (auto pos : contained) + for (const auto& pos : contained) { bool found = false; - for (auto pos2 : container) + for (const auto& pos2 : container) { if ((pos.first-pos2.first).length2() < 1 && pos.second == pos2.second) { diff --git a/components/sceneutil/mwshadowtechnique.cpp b/components/sceneutil/mwshadowtechnique.cpp index bf6581ae60..e9eb9b2b2f 100644 --- a/components/sceneutil/mwshadowtechnique.cpp +++ b/components/sceneutil/mwshadowtechnique.cpp @@ -1361,7 +1361,7 @@ void MWShadowTechnique::cull(osgUtil::CullVisitor& cv) if (settings->getMultipleShadowMapHint() == ShadowSettings::CASCADED) { cropShadowCameraToMainFrustum(frustum, camera, cascaseNear, cascadeFar, extraPlanes); - for (auto plane : extraPlanes) + for (const auto& plane : extraPlanes) local_polytope.getPlaneList().push_back(plane); local_polytope.setupMask(); } @@ -1998,19 +1998,19 @@ struct ConvexHull Vertices findInternalEdges(osg::Vec3d mainVertex, Vertices connectedVertices) { Vertices internalEdgeVertices; - for (auto vertex : connectedVertices) + for (const auto& vertex : connectedVertices) { osg::Matrixd matrix; osg::Vec3d dir = vertex - mainVertex; matrix.makeLookAt(mainVertex, vertex, dir.z() == 0 ? osg::Vec3d(0, 0, 1) : osg::Vec3d(1, 0, 0)); Vertices testVertices; - for (auto testVertex : connectedVertices) + for (const auto& testVertex : connectedVertices) { if (vertex != testVertex) testVertices.push_back(testVertex); } std::vector bearings; - for (auto testVertex : testVertices) + for (const auto& testVertex : testVertices) { osg::Vec3d transformedVertex = testVertex * matrix; bearings.push_back(atan2(transformedVertex.y(), transformedVertex.x())); @@ -2039,7 +2039,7 @@ struct ConvexHull // Collect the set of vertices VertexSet vertices; - for (Edge edge : _edges) + for (const Edge& edge : _edges) { vertices.insert(edge.first); vertices.insert(edge.second); @@ -2069,7 +2069,7 @@ struct ConvexHull for (auto vertex : extremeVertices) { Vertices connectedVertices; - for (Edge edge : _edges) + for (const Edge& edge : _edges) { if (edge.first == vertex) connectedVertices.push_back(edge.second); @@ -2107,7 +2107,7 @@ struct ConvexHull osg::Vec3d vertex = *unprocessedConnectedVertices.begin(); unprocessedConnectedVertices.erase(unprocessedConnectedVertices.begin()); connectedVertices.insert(vertex); - for (Edge edge : _edges) + for (const Edge& edge : _edges) { osg::Vec3d otherEnd; if (edge.first == vertex) @@ -2124,7 +2124,7 @@ struct ConvexHull } } - for (Edge edge : _edges) + for (const Edge& edge : _edges) { if (connectedVertices.count(edge.first) || connectedVertices.count(edge.second)) finalEdges.push_back(edge);