浏览代码

Fix warning in Graphics::GetResolutions()

1vanK 3 年之前
父节点
当前提交
01e0f3c250
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      Source/Urho3D/Graphics/Graphics.cpp

+ 5 - 4
Source/Urho3D/Graphics/Graphics.cpp

@@ -224,11 +224,12 @@ IntVector2 Graphics::GetWindowPosition() const
 Vector<IntVector3> Graphics::GetResolutions(int monitor) const
 Vector<IntVector3> Graphics::GetResolutions(int monitor) const
 {
 {
     Vector<IntVector3> ret;
     Vector<IntVector3> ret;
+
     // Emscripten is not able to return a valid list
     // Emscripten is not able to return a valid list
 #ifndef __EMSCRIPTEN__
 #ifndef __EMSCRIPTEN__
-    auto numModes = (unsigned)SDL_GetNumDisplayModes(monitor);
+    i32 numModes = SDL_GetNumDisplayModes(monitor);
 
 
-    for (unsigned i = 0; i < numModes; ++i)
+    for (i32 i = 0; i < numModes; ++i)
     {
     {
         SDL_DisplayMode mode;
         SDL_DisplayMode mode;
         SDL_GetDisplayMode(monitor, i, &mode);
         SDL_GetDisplayMode(monitor, i, &mode);
@@ -238,9 +239,9 @@ Vector<IntVector3> Graphics::GetResolutions(int monitor) const
 
 
         // Store mode if unique
         // Store mode if unique
         bool unique = true;
         bool unique = true;
-        for (unsigned j = 0; j < ret.Size(); ++j)
+        for (const IntVector3& resolution : ret)
         {
         {
-            if (ret[j].x_ == width && ret[j].y_ == height && ret[j].z_ == rate)
+            if (resolution.x_ == width && resolution.y_ == height && resolution.z_ == rate)
             {
             {
                 unique = false;
                 unique = false;
                 break;
                 break;