OSDN Git Service

[Refactor] #2118 Reshaped the constructor of LiteEnchanter
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 12 Feb 2022 03:31:13 +0000 (12:31 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sat, 12 Feb 2022 13:08:34 +0000 (22:08 +0900)
src/object-enchant/others/apply-magic-lite.cpp

index 8f896e4..ab3f71c 100644 (file)
@@ -12,16 +12,23 @@ LiteEnchanter::LiteEnchanter(PlayerType *player_ptr, ObjectType *o_ptr, DEPTH le
     , level(level)
     , power(power)
 {
-    if (o_ptr->sval == SV_LITE_TORCH) {
-        if (o_ptr->pval > 0)
+    switch (o_ptr->sval) {
+    case SV_LITE_TORCH:
+        if (o_ptr->pval > 0) {
             o_ptr->xtra4 = randint1(o_ptr->pval);
-        o_ptr->pval = 0;
-    }
+        }
 
-    if (o_ptr->sval == SV_LITE_LANTERN) {
-        if (o_ptr->pval > 0)
+        o_ptr->pval = 0;
+        return;
+    case SV_LITE_LANTERN:
+        if (o_ptr->pval > 0) {
             o_ptr->xtra4 = randint1(o_ptr->pval);
+        }
+
         o_ptr->pval = 0;
+        return;
+    default:
+        return;
     }
 }