OSDN Git Service

[Refactor] #2155 oのフォルダについて、return (hoge); をreturn hoge; に置換した
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 12 Feb 2022 10:46:53 +0000 (19:46 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sun, 13 Feb 2022 06:54:08 +0000 (15:54 +0900)
src/object-enchant/object-boost.cpp
src/object/object-info.cpp
src/object/object-value.cpp

index 2636e73..8aaf314 100644 (file)
@@ -88,8 +88,8 @@ int m_bonus(int max, DEPTH level)
 
     /* Enforce the maximum value */
     if (value > max)
-        return (max);
-    return (value);
+        return max;
+    return value;
 }
 
 /*!
index a0dbbe5..c693e67 100644 (file)
@@ -58,7 +58,7 @@ static concptr item_activation_dragon_breath(ObjectType *o_ptr)
     }
 
     strcat(desc, _("のブレス(250)", " (250)"));
-    return (desc);
+    return desc;
 }
 
 /*!
@@ -176,7 +176,7 @@ concptr activation_explanation(ObjectType *o_ptr)
 {
     auto flgs = object_flags(o_ptr);
     if (flgs.has_not(TR_ACTIVATE))
-        return (_("なし", "nothing"));
+        return _("なし", "nothing");
 
     if (activation_index(o_ptr) > RandomArtActType::NONE) {
         return item_activation_aux(o_ptr);
@@ -200,7 +200,7 @@ concptr activation_explanation(ObjectType *o_ptr)
  * @return 対応するアルファベット
  * @details Note that the label does NOT distinguish inven/equip.
  */
-char index_to_label(int i) { return (i < INVEN_MAIN_HAND) ? (I2A(i)) : (I2A(i - INVEN_MAIN_HAND)); }
+char index_to_label(int i) { return i < INVEN_MAIN_HAND ? I2A(i) : I2A(i - INVEN_MAIN_HAND); }
 
 /*!
  * @brief オブジェクトの該当装備部位IDを返す /
@@ -216,53 +216,53 @@ int16_t wield_slot(PlayerType *player_ptr, const ObjectType *o_ptr)
     case ItemKindType::POLEARM:
     case ItemKindType::SWORD: {
         if (!player_ptr->inventory_list[INVEN_MAIN_HAND].k_idx)
-            return (INVEN_MAIN_HAND);
+            return INVEN_MAIN_HAND;
         if (player_ptr->inventory_list[INVEN_SUB_HAND].k_idx)
-            return (INVEN_MAIN_HAND);
-        return (INVEN_SUB_HAND);
+            return INVEN_MAIN_HAND;
+        return INVEN_SUB_HAND;
     }
     case ItemKindType::CAPTURE:
     case ItemKindType::CARD:
     case ItemKindType::SHIELD: {
         if (!player_ptr->inventory_list[INVEN_SUB_HAND].k_idx)
-            return (INVEN_SUB_HAND);
+            return INVEN_SUB_HAND;
         if (player_ptr->inventory_list[INVEN_MAIN_HAND].k_idx)
-            return (INVEN_SUB_HAND);
-        return (INVEN_MAIN_HAND);
+            return INVEN_SUB_HAND;
+        return INVEN_MAIN_HAND;
     }
     case ItemKindType::BOW: {
-        return (INVEN_BOW);
+        return INVEN_BOW;
     }
     case ItemKindType::RING: {
         if (!player_ptr->inventory_list[INVEN_MAIN_RING].k_idx)
-            return (INVEN_MAIN_RING);
+            return INVEN_MAIN_RING;
 
-        return (INVEN_SUB_RING);
+        return INVEN_SUB_RING;
     }
     case ItemKindType::AMULET:
     case ItemKindType::WHISTLE: {
-        return (INVEN_NECK);
+        return INVEN_NECK;
     }
     case ItemKindType::LITE: {
-        return (INVEN_LITE);
+        return INVEN_LITE;
     }
     case ItemKindType::DRAG_ARMOR:
     case ItemKindType::HARD_ARMOR:
     case ItemKindType::SOFT_ARMOR: {
-        return (INVEN_BODY);
+        return INVEN_BODY;
     }
     case ItemKindType::CLOAK: {
-        return (INVEN_OUTER);
+        return INVEN_OUTER;
     }
     case ItemKindType::CROWN:
     case ItemKindType::HELM: {
-        return (INVEN_HEAD);
+        return INVEN_HEAD;
     }
     case ItemKindType::GLOVES: {
-        return (INVEN_ARMS);
+        return INVEN_ARMS;
     }
     case ItemKindType::BOOTS: {
-        return (INVEN_FEET);
+        return INVEN_FEET;
     }
 
     default:
index 4e93f80..98b9079 100644 (file)
 static PRICE object_value_base(const ObjectType *o_ptr)
 {
     if (o_ptr->is_aware())
-        return (k_info[o_ptr->k_idx].cost);
+        return k_info[o_ptr->k_idx].cost;
 
     switch (o_ptr->tval) {
     case ItemKindType::FOOD:
-        return (5L);
+        return 5;
     case ItemKindType::POTION:
-        return (20L);
+        return 20;
     case ItemKindType::SCROLL:
-        return (20L);
+        return 20;
     case ItemKindType::STAFF:
-        return (70L);
+        return 70;
     case ItemKindType::WAND:
-        return (50L);
+        return 50;
     case ItemKindType::ROD:
-        return (90L);
+        return 90;
     case ItemKindType::RING:
-        return (45L);
+        return 45;
     case ItemKindType::AMULET:
-        return (45L);
+        return 45;
     case ItemKindType::FIGURINE: {
         DEPTH level = r_info[o_ptr->pval].level;
         if (level < 20)
             return level * 50L;
         else if (level < 30)
-            return 1000 + (level - 20) * 150L;
+            return 1000 + (level - 20) * 150;
         else if (level < 40)
-            return 2500 + (level - 30) * 350L;
+            return 2500 + (level - 30) * 350;
         else if (level < 50)
-            return 6000 + (level - 40) * 800L;
+            return 6000 + (level - 40) * 800;
         else
-            return 14000 + (level - 50) * 2000L;
+            return 14000 + (level - 50) * 2000;
     }
     case ItemKindType::CAPTURE:
         if (!o_ptr->pval)
-            return 1000L;
+            return 1000;
         else
-            return ((r_info[o_ptr->pval].level) * 50L + 1000);
+            return (r_info[o_ptr->pval].level) * 50 + 1000;
 
     default:
         break;
     }
 
-    return (0L);
+    return 0;
 }
 
 /*!
@@ -89,16 +89,16 @@ PRICE object_value(const ObjectType *o_ptr)
 
     if (o_ptr->is_known()) {
         if (o_ptr->is_broken())
-            return (0L);
+            return 0;
         if (o_ptr->is_cursed())
-            return (0L);
+            return 0;
 
         value = object_value_real(o_ptr);
     } else {
         if ((o_ptr->ident & (IDENT_SENSE)) && o_ptr->is_broken())
-            return (0L);
+            return 0;
         if ((o_ptr->ident & (IDENT_SENSE)) && o_ptr->is_cursed())
-            return (0L);
+            return 0;
 
         value = object_value_base(o_ptr);
     }
@@ -106,7 +106,7 @@ PRICE object_value(const ObjectType *o_ptr)
     if (o_ptr->discount)
         value -= (value * o_ptr->discount / 100L);
 
-    return (value);
+    return value;
 }
 
 /*!
@@ -140,22 +140,22 @@ PRICE object_value_real(const ObjectType *o_ptr)
     auto *k_ptr = &k_info[o_ptr->k_idx];
 
     if (!k_info[o_ptr->k_idx].cost)
-        return (0L);
+        return 0;
 
     PRICE value = k_info[o_ptr->k_idx].cost;
     auto flgs = object_flags(o_ptr);
     if (o_ptr->is_fixed_artifact()) {
         auto *a_ptr = &a_info[o_ptr->name1];
         if (!a_ptr->cost)
-            return (0L);
+            return 0;
 
         value = a_ptr->cost;
         value += flag_cost(o_ptr, o_ptr->pval);
-        return (value);
+        return value;
     } else if (o_ptr->is_ego()) {
         ego_item_type *e_ptr = &e_info[o_ptr->name2];
         if (!e_ptr->cost)
-            return (0L);
+            return 0;
 
         value += e_ptr->cost;
         value += flag_cost(o_ptr, o_ptr->pval);
@@ -189,7 +189,7 @@ PRICE object_value_real(const ObjectType *o_ptr)
         if (!o_ptr->pval)
             break;
         if (o_ptr->pval < 0)
-            return (0L);
+            return 0;
 
         if (flgs.has(TR_STR))
             value += (o_ptr->pval * 200L);
@@ -241,7 +241,7 @@ PRICE object_value_real(const ObjectType *o_ptr)
     case ItemKindType::RING:
     case ItemKindType::AMULET: {
         if (o_ptr->to_h + o_ptr->to_d + o_ptr->to_a < 0)
-            return (0L);
+            return 0;
 
         value += ((o_ptr->to_h + o_ptr->to_d + o_ptr->to_a) * 200L);
         break;
@@ -256,7 +256,7 @@ PRICE object_value_real(const ObjectType *o_ptr)
     case ItemKindType::HARD_ARMOR:
     case ItemKindType::DRAG_ARMOR: {
         if (o_ptr->to_a < 0)
-            return (0L);
+            return 0;
 
         value += (((o_ptr->to_h - k_ptr->to_h) + (o_ptr->to_d - k_ptr->to_d)) * 200L + (o_ptr->to_a) * 100L);
         break;
@@ -267,7 +267,7 @@ PRICE object_value_real(const ObjectType *o_ptr)
     case ItemKindType::SWORD:
     case ItemKindType::POLEARM: {
         if (o_ptr->to_h + o_ptr->to_d < 0)
-            return (0L);
+            return 0;
 
         value += ((o_ptr->to_h + o_ptr->to_d + o_ptr->to_a) * 100L);
         value += (o_ptr->dd - k_ptr->dd) * o_ptr->ds * 250L;
@@ -278,7 +278,7 @@ PRICE object_value_real(const ObjectType *o_ptr)
     case ItemKindType::ARROW:
     case ItemKindType::BOLT: {
         if (o_ptr->to_h + o_ptr->to_d < 0)
-            return (0L);
+            return 0;
 
         value += ((o_ptr->to_h + o_ptr->to_d) * 5L);
         value += (o_ptr->dd - k_ptr->dd) * o_ptr->ds * 5L;
@@ -319,5 +319,5 @@ PRICE object_value_real(const ObjectType *o_ptr)
     if (value < 0)
         return 0L;
 
-    return (value);
+    return value;
 }