OSDN Git Service

[Refactor] #2155 a~hのフォルダについて、return (hoge); をreturn hoge; に置換した (一部機械的置換でi以降のフォルダも巻き...
authorHourier <66951241+Hourier@users.noreply.github.com>
Sat, 12 Feb 2022 10:11:34 +0000 (19:11 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Sun, 13 Feb 2022 06:54:08 +0000 (15:54 +0900)
23 files changed:
src/autopick/autopick-finder.cpp
src/autopick/autopick-util.h
src/birth/birth-select-realm.cpp
src/cmd-action/cmd-spell.cpp
src/cmd-io/macro-util.cpp
src/combat/attack-accuracy.cpp
src/combat/shoot.cpp
src/combat/slaying.cpp
src/core/asking-player.cpp
src/core/score-util.cpp
src/core/scores.cpp
src/core/show-file.cpp
src/dungeon/quest.cpp
src/effect/effect-feature.cpp
src/effect/effect-monster-switcher.cpp
src/floor/wild.cpp
src/game-option/keymap-directory-getter.cpp
src/grid/grid.cpp
src/grid/trap.cpp
src/term/z-form.cpp
src/term/z-rand.cpp
src/term/z-util.cpp
src/util/angband-files.cpp

index fe7a30a..fac2620 100644 (file)
@@ -167,14 +167,17 @@ byte get_string_for_search(PlayerType *player_ptr, ObjectType **o_handle, concpt
 
         case '\n':
         case '\r':
-        case KTRL('s'):
-            if (*o_handle)
-                return (back ? -1 : 1);
+        case KTRL('s'): {
+            byte ret = back ? -1 : 1;
+            if (*o_handle) {
+                return ret;
+            }
+
             string_free(*search_strp);
             *search_strp = string_make(buf);
             *o_handle = nullptr;
-            return (back ? -1 : 1);
-
+            return ret;
+        }
         case KTRL('i'):
             return get_object_for_search(player_ptr, o_handle, search_strp);
 
index c52dee2..f37fe2a 100644 (file)
@@ -94,5 +94,5 @@ int count_line(text_body_type *tb);
  */
 inline bool is_greater_autopick_max_line(int count)
 {
-    return (count > MAX_LINES - 3);
+    return count > MAX_LINES - 3;
 }
index 61de23f..ff69ee9 100644 (file)
@@ -274,7 +274,7 @@ static byte select_realm(PlayerType *player_ptr, uint32_t choices, int *count)
         return REALM_SELECT_CANCEL;
 
     clear_from(10);
-    return (byte)(birth_realm_ptr->picks[birth_realm_ptr->k]);
+    return static_cast<byte>(birth_realm_ptr->picks[birth_realm_ptr->k]);
 }
 
 static void cleanup_realm_selection_window(void)
index 35edce6..a31c5f2 100644 (file)
@@ -274,11 +274,11 @@ static bool spell_okay(PlayerType *player_ptr, int spell, bool learned, bool stu
     /* Spell is learned */
     if ((use_realm == player_ptr->realm2) ? (player_ptr->spell_learned2 & (1UL << spell)) : (player_ptr->spell_learned1 & (1UL << spell))) {
         /* Always true */
-        return (!study_pray);
+        return !study_pray;
     }
 
     /* Okay to study, not to cast */
-    return (!learned);
+    return !learned;
 }
 
 /*!
index 789fde3..98250ec 100644 (file)
@@ -29,7 +29,7 @@ int macro_find_exact(concptr pat)
         if (!streq(macro__pat[i], pat))
             continue;
 
-        return (i);
+        return i;
     }
 
     return -1;
@@ -48,7 +48,7 @@ int macro_find_check(concptr pat)
         if (!prefix(macro__pat[i], pat))
             continue;
 
-        return (i);
+        return i;
     }
 
     return -1;
@@ -69,7 +69,7 @@ int macro_find_maybe(concptr pat)
         if (streq(macro__pat[i], pat))
             continue;
 
-        return (i);
+        return i;
     }
 
     return -1;
@@ -98,7 +98,7 @@ int macro_find_ready(concptr pat)
         s = t;
     }
 
-    return (n);
+    return n;
 }
 
 /*
index 7b3b376..35b9da7 100644 (file)
@@ -71,7 +71,7 @@ bool check_hit_from_monster_to_player(PlayerType *player_ptr, int power, DEPTH l
     if (stun && one_in_(2))
         return false;
     if (k < 10)
-        return (k < 5);
+        return k < 5;
     int i = (power + (level * 3));
 
     int ac = player_ptr->ac + player_ptr->to_a;
@@ -97,7 +97,7 @@ bool check_hit_from_monster_to_monster(int power, DEPTH level, ARMOUR_CLASS ac,
     if (stun && one_in_(2))
         return false;
     if (k < 10)
-        return (k < 5);
+        return k < 5;
     int i = (power + (level * 3));
 
     if ((i > 0) && (randint1(i) > ((ac * 3) / 4)))
index 4a6cd33..e3633fb 100644 (file)
@@ -421,7 +421,7 @@ static MULTIPLY calc_shot_damage_with_slay(
         mult = calc_snipe_damage_with_slay(player_ptr, mult, monster_ptr, snipe_type);
 
     /* Return the total damage */
-    return (tdam * mult / 10);
+    return tdam * mult / 10;
 }
 
 /*!
@@ -1047,7 +1047,7 @@ HIT_POINT critical_shot(PlayerType *player_ptr, WEIGHT weight, int plus_ammo, in
         }
     }
 
-    return (dam);
+    return dam;
 }
 
 /*!
@@ -1098,7 +1098,7 @@ ENERGY bow_energy(OBJECT_SUBTYPE_VALUE sval)
     }
     }
 
-    return (energy);
+    return energy;
 }
 
 /*
@@ -1147,7 +1147,7 @@ int bow_tmul(OBJECT_SUBTYPE_VALUE sval)
     }
     }
 
-    return (tmul);
+    return tmul;
 }
 
 /*!
index a2653a1..9417dcb 100644 (file)
@@ -208,7 +208,7 @@ HIT_POINT calc_attack_damage_with_slay(PlayerType *player_ptr, ObjectType *o_ptr
 
     if (mult > 150)
         mult = 150;
-    return (tdam * mult / 10);
+    return tdam * mult / 10;
 }
 
 AttributeFlags melee_attribute(PlayerType *player_ptr, ObjectType *o_ptr, combat_options mode)
index 149e664..25e5411 100644 (file)
@@ -222,7 +222,7 @@ bool get_string(concptr prompt, char *buf, int len)
     prt(prompt, 0, 0);
     res = askfor(buf, len);
     prt("", 0, 0);
-    return (res);
+    return res;
 }
 
 /*
@@ -361,7 +361,7 @@ QUANTITY get_quantity(concptr prompt, QUANTITY max)
         if (amt > max)
             amt = max;
 
-        return (amt);
+        return amt;
     }
 
     COMMAND_CODE code;
@@ -373,7 +373,7 @@ QUANTITY get_quantity(concptr prompt, QUANTITY max)
         if (amt < 0)
             amt = 0;
 
-        return (amt);
+        return amt;
     }
 
     if (!prompt) {
@@ -404,7 +404,7 @@ QUANTITY get_quantity(concptr prompt, QUANTITY max)
    if (amt)
         repeat_push((COMMAND_CODE)amt);
 
-    return (amt);
+    return amt;
 }
 
 /*
index 3675d16..b20b046 100644 (file)
@@ -13,7 +13,7 @@ int highscore_fd = -1;
  */
 int highscore_seek(int i)
 {
-    return (fd_seek(highscore_fd, (ulong)(i) * sizeof(high_score)));
+    return fd_seek(highscore_fd, (ulong)(i) * sizeof(high_score));
 }
 
 /*!
@@ -23,5 +23,5 @@ int highscore_seek(int i)
  */
 errr highscore_read(high_score *score)
 {
-    return (fd_read(highscore_fd, (char *)(score), sizeof(high_score)));
+    return fd_read(highscore_fd, (char *)(score), sizeof(high_score));
 }
index c5c75ea..7b3e1b1 100644 (file)
@@ -49,7 +49,7 @@
 static int highscore_write(high_score *score)
 {
     /* Write the record, note failure */
-    return (fd_write(highscore_fd, (char *)(score), sizeof(high_score)));
+    return fd_write(highscore_fd, (char *)(score), sizeof(high_score));
 }
 
 /*!
@@ -73,10 +73,10 @@ static int highscore_where(high_score *score)
     for (int i = 0; i < MAX_HISCORES; i++) {
         int old_score;
         if (highscore_read(&the_score))
-            return (i);
+            return i;
         old_score = atoi(the_score.pts);
         if (my_score > old_score)
-            return (i);
+            return i;
     }
 
     /* The "last" entry is always usable */
index 619dd4b..4aa6c3c 100644 (file)
@@ -494,7 +494,7 @@ bool show_file(PlayerType *player_ptr, bool show_version, concptr name, concptr
     }
 
     angband_fclose(fff);
-    return (skey != 'q');
+    return skey != 'q';
 }
 
 /*
index 483e3ad..44fb069 100644 (file)
@@ -218,7 +218,7 @@ QuestId quest_number(PlayerType *player_ptr, DEPTH level)
 {
     auto *floor_ptr = player_ptr->current_floor_ptr;
     if (inside_quest(floor_ptr->quest_number))
-        return (floor_ptr->quest_number);
+        return floor_ptr->quest_number;
 
     for (int16_t i = 0; i < max_q_idx; i++) {
         if (quest[i].status != QuestStatusType::TAKEN)
index 94099e6..9ed9279 100644 (file)
@@ -472,5 +472,5 @@ bool affect_feature(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITIO
     }
 
     lite_spot(player_ptr, y, x);
-    return (obvious);
+    return obvious;
 }
index f1a4f8b..c7ee343 100644 (file)
@@ -450,7 +450,7 @@ process_result switch_effects_monster(PlayerType *player_ptr, effect_monster_typ
     case AttributeType::CAPTURE:
         return effect_monster_capture(player_ptr, em_ptr);
     case AttributeType::ATTACK:
-        return (process_result)do_cmd_attack(player_ptr, em_ptr->y, em_ptr->x, i2enum<combat_options>(em_ptr->dam));
+        return do_cmd_attack(player_ptr, em_ptr->y, em_ptr->x, i2enum<combat_options>(em_ptr->dam)) ? PROCESS_TRUE : PROCESS_FALSE;
     case AttributeType::ENGETSU:
         return effect_monster_engetsu(player_ptr, em_ptr);
     case AttributeType::GENOCIDE:
index 83827e0..bd9738a 100644 (file)
@@ -624,7 +624,7 @@ static wilderness_grid w_letter[255];
 parse_error_type parse_line_wilderness(PlayerType *player_ptr, char *buf, int xmin, int xmax, int *y, int *x)
 {
     if (!(buf[0] == 'W'))
-        return (PARSE_ERROR_GENERIC);
+        return PARSE_ERROR_GENERIC;
 
     int num;
     char *zz[33];
@@ -671,7 +671,7 @@ parse_error_type parse_line_wilderness(PlayerType *player_ptr, char *buf, int xm
                 w_letter[index].name[0] = 0;
         } else {
             /* Failure */
-            return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
+            return PARSE_ERROR_TOO_FEW_ARGUMENTS;
         }
 
         break;
index a352bd2..6ed378d 100644 (file)
@@ -38,5 +38,5 @@ int get_keymap_dir(char ch)
     if (d == 5)
         d = 0;
 
-    return (d);
+    return d;
 }
index 719a4f8..72bc9ad 100644 (file)
@@ -240,7 +240,7 @@ void update_local_illumination(PlayerType *player_ptr, POSITION y, POSITION x)
  */
 bool no_lite(PlayerType *player_ptr)
 {
-    return (!player_can_see_bold(player_ptr, player_ptr->y, player_ptr->x));
+    return !player_can_see_bold(player_ptr, player_ptr->y, player_ptr->x);
 }
 
 /*
index 7a08e9d..4352b4d 100644 (file)
@@ -258,7 +258,7 @@ static int check_hit_from_monster_to_player(PlayerType *player_ptr, int power)
 
     /* Hack -- 5% hit, 5% miss */
     if (k < 10)
-        return (k < 5);
+        return k < 5;
 
     if (player_ptr->ppersonality == PERSONALITY_LAZY)
         if (one_in_(20))
index e6caa5b..913fe04 100644 (file)
@@ -640,7 +640,7 @@ uint vstrnfmt(char *buf, uint max, concptr fmt, va_list vp)
     buf[n] = '\0';
 
     /* Return length */
-    return (n);
+    return n;
 }
 
 /*
index 6f9f116..32e08ce 100644 (file)
@@ -120,7 +120,7 @@ int32_t div_round(int32_t n, int32_t d)
 
     /* Refuse to divide by zero */
     if (!d)
-        return (n);
+        return n;
 
     /* Division */
     tmp = n / d;
index e23bd69..4dfd551 100644 (file)
@@ -285,7 +285,7 @@ int count_bits(BIT_FLAGS x)
                n++;
        } while (0 != (x = x&(x - 1)));
 
-       return (n);
+       return n;
 }
 
 /*!
index 10abeae..13ecb8a 100644 (file)
@@ -195,7 +195,7 @@ FILE *angband_fopen(concptr file, concptr mode)
     if (path_parse(buf, 1024, file))
         return nullptr;
 
-    return (fopen(buf, mode));
+    return fopen(buf, mode);
 }
 
 /*
@@ -218,7 +218,7 @@ FILE *angband_fopen_temp(char *buf, int max)
     if (fd < 0)
         return nullptr;
 
-    return (fdopen(fd, "w"));
+    return fdopen(fd, "w");
 }
 #else /* HAVE_MKSTEMP */
 FILE *angband_fopen_temp(char *buf, int max)