OSDN Git Service

[Refactor] #3571 if文のネストを解消した
authorHourier <66951241+Hourier@users.noreply.github.com>
Thu, 27 Jul 2023 13:34:58 +0000 (22:34 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Thu, 27 Jul 2023 13:34:58 +0000 (22:34 +0900)
src/main-win/graphics-win.cpp

index c1ea343..12251af 100644 (file)
@@ -137,20 +137,23 @@ graphics_mode change_graphics(graphics_mode arg)
     infGraph.OffsetX = ox;
     infGraph.OffsetY = oy;
 
-    if (!name_mask.empty()) {
-        const auto &path_mask = path_build(ANGBAND_DIR_XTRA_GRAF, name_mask);
-        const auto &filename_mask = path_mask.string();
-        infGraph.hBitmapMask = read_graphic(filename_mask.data());
-        if (!infGraph.hBitmapMask) {
-            plog_fmt(_("ビットマップ '%s' を読み込めません。", "Cannot read bitmap file '%s'"), name_mask.data());
-            ANGBAND_GRAF = "ascii";
-            current_graphics_mode = graphics_mode::GRAPHICS_NONE;
-            return current_graphics_mode;
-        }
+    if (name_mask.empty()) {
+        current_graphics_mode = arg;
+        return arg;
     }
 
-    current_graphics_mode = arg;
-    return arg;
+    const auto &path_mask = path_build(ANGBAND_DIR_XTRA_GRAF, name_mask);
+    const auto &filename_mask = path_mask.string();
+    infGraph.hBitmapMask = read_graphic(filename_mask.data());
+    if (infGraph.hBitmapMask) {
+        current_graphics_mode = arg;
+        return arg;
+    }
+
+    plog_fmt(_("ビットマップ '%s' を読み込めません。", "Cannot read bitmap file '%s'"), name_mask.data());
+    ANGBAND_GRAF = "ascii";
+    current_graphics_mode = graphics_mode::GRAPHICS_NONE;
+    return current_graphics_mode;
 }
 }