浏览代码

NFF: Use C++11 range-based for loop

Turo Lamminen 9 年之前
父节点
当前提交
3eb9b8e91b
共有 1 个文件被更改,包括 9 次插入12 次删除
  1. 9 12
      code/NFFLoader.cpp

+ 9 - 12
code/NFFLoader.cpp

@@ -673,12 +673,11 @@ void NFFImporter::InternReadFile( const std::string& pFile,
                 if ('t' == line[0])
                 if ('t' == line[0])
                 {
                 {
                     currentMeshWithUVCoords = NULL;
                     currentMeshWithUVCoords = NULL;
-                    for (std::vector<MeshInfo>::iterator it = meshesWithUVCoords.begin(), end = meshesWithUVCoords.end();
-                        it != end;++it)
+                    for (auto &mesh : meshesWithUVCoords)
                     {
                     {
-                        if ((*it).shader == s)
+                        if (mesh.shader == s)
                         {
                         {
-                            currentMeshWithUVCoords = &(*it);
+                            currentMeshWithUVCoords = &mesh;
                             break;
                             break;
                         }
                         }
                     }
                     }
@@ -695,12 +694,11 @@ void NFFImporter::InternReadFile( const std::string& pFile,
                 else if ('p' == line[1])
                 else if ('p' == line[1])
                 {
                 {
                     currentMeshWithNormals = NULL;
                     currentMeshWithNormals = NULL;
-                    for (std::vector<MeshInfo>::iterator it = meshesWithNormals.begin(), end = meshesWithNormals.end();
-                        it != end;++it)
+                    for (auto &mesh : meshesWithNormals)
                     {
                     {
-                        if ((*it).shader == s)
+                        if (mesh.shader == s)
                         {
                         {
-                            currentMeshWithNormals = &(*it);
+                            currentMeshWithNormals = &mesh;
                             break;
                             break;
                         }
                         }
                     }
                     }
@@ -717,12 +715,11 @@ void NFFImporter::InternReadFile( const std::string& pFile,
                 else
                 else
                 {
                 {
                     currentMesh = NULL;
                     currentMesh = NULL;
-                    for (std::vector<MeshInfo>::iterator it = meshes.begin(), end = meshes.end();
-                        it != end;++it)
+                    for (auto &mesh : meshes)
                     {
                     {
-                        if ((*it).shader == s)
+                        if (mesh.shader == s)
                         {
                         {
-                            currentMesh = &(*it);
+                            currentMesh = &mesh;
                             break;
                             break;
                         }
                         }
                     }
                     }