OSDN Git Service

[Refactor] #38997 object-curse.c の整形 / Reshaped object-curse.c
authorHourier <hourier@users.sourceforge.jp>
Mon, 13 Jan 2020 13:07:54 +0000 (22:07 +0900)
committerHourier <hourier@users.sourceforge.jp>
Mon, 13 Jan 2020 13:07:54 +0000 (22:07 +0900)
src/birth.c
src/mind.c
src/object-curse.c
src/racial.c
src/snipe.c
src/util.c

index 94306bc..39081fc 100644 (file)
@@ -4023,7 +4023,7 @@ static bool player_birth_aux(player_type *creature_ptr)
 
        /* Choose the players race */
        creature_ptr->prace = 0;
-       while(1)
+       while (TRUE)
        {
                char temp[80*10];
                concptr t;
@@ -4059,7 +4059,7 @@ static bool player_birth_aux(player_type *creature_ptr)
 
        /* Choose the players class */
        creature_ptr->pclass = 0;
-       while(1)
+       while (TRUE)
        {
                char temp[80*9];
                concptr t;
@@ -4094,7 +4094,7 @@ static bool player_birth_aux(player_type *creature_ptr)
 
        /* Choose the players seikaku */
        creature_ptr->pseikaku = 0;
-       while(1)
+       while (TRUE)
        {
                char temp[80*8];
                concptr t;
index ad8758f..3288d51 100644 (file)
@@ -2080,7 +2080,7 @@ void do_cmd_mind_browse(player_type *caster_ptr)
 
        screen_save();
 
-       while(1)
+       while (TRUE)
        {
                if (!get_mind_power(caster_ptr, &n, TRUE))
                {
index 9897f49..199ad17 100644 (file)
@@ -14,7 +14,7 @@ BIT_FLAGS get_curse(int power, object_type *o_ptr)
 {
        BIT_FLAGS new_curse;
 
-       while(1)
+       while (TRUE)
        {
                new_curse = (1 << (randint0(MAX_CURSE)+4));
                if (power == 2)
@@ -29,13 +29,16 @@ BIT_FLAGS get_curse(int power, object_type *o_ptr)
                {
                        if (new_curse & TRC_HEAVY_MASK) continue;
                }
+
                if (new_curse == TRC_LOW_MELEE && !object_is_weapon(o_ptr)) continue;
                if (new_curse == TRC_LOW_AC && !object_is_armour(o_ptr)) continue;
                break;
        }
+
        return new_curse;
 }
 
+
 /*!
  * @brief 装備への呪い付加判定と付加処理
  * @param owner_ptr プレーヤーへの参照ポインタ
@@ -45,16 +48,13 @@ BIT_FLAGS get_curse(int power, object_type *o_ptr)
  */
 void curse_equipment(player_type *owner_ptr, PERCENTAGE chance, PERCENTAGE heavy_chance)
 {
-       bool changed = FALSE;
-       int curse_power = 0;
-       BIT_FLAGS new_curse;
-       BIT_FLAGS oflgs[TR_FLAG_SIZE];
-       object_type *o_ptr = &owner_ptr->inventory_list[INVEN_RARM + randint0(12)];
-       GAME_TEXT o_name[MAX_NLEN];
-
        if (randint1(100) > chance) return;
+
+       object_type *o_ptr = &owner_ptr->inventory_list[INVEN_RARM + randint0(12)];
        if (!o_ptr->k_idx) return;
+       BIT_FLAGS oflgs[TR_FLAG_SIZE];
        object_flags(o_ptr, oflgs);
+       GAME_TEXT o_name[MAX_NLEN];
        object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 
        /* Extra, biased saving throw for blessed items */
@@ -69,6 +69,8 @@ void curse_equipment(player_type *owner_ptr, PERCENTAGE chance, PERCENTAGE heavy
                return;
        }
 
+       bool changed = FALSE;
+       int curse_power = 0;
        if ((randint1(100) <= heavy_chance) &&
            (object_is_artifact(o_ptr) || object_is_ego(o_ptr)))
        {
@@ -84,9 +86,10 @@ void curse_equipment(player_type *owner_ptr, PERCENTAGE chance, PERCENTAGE heavy
                        changed = TRUE;
                o_ptr->curse_flags |= TRC_CURSED;
        }
+
        if (heavy_chance >= 50) curse_power++;
 
-       new_curse = get_curse(curse_power, o_ptr);
+       BIT_FLAGS new_curse = get_curse(curse_power, o_ptr);
        if (!(o_ptr->curse_flags & new_curse))
        {
                changed = TRUE;
@@ -98,6 +101,6 @@ void curse_equipment(player_type *owner_ptr, PERCENTAGE chance, PERCENTAGE heavy
                msg_format(_("悪意に満ちた黒いオーラが%sをとりまいた...", "There is a malignant black aura surrounding %s..."), o_name);
                o_ptr->feeling = FEEL_NONE;
        }
-       owner_ptr->update |= (PU_BONUS);
-}
 
+       owner_ptr->update |= PU_BONUS;
+}
index dcacead..ca7b0b3 100644 (file)
@@ -65,7 +65,7 @@ static bool choose_kamae(player_type *creature_ptr)
        prt("", 1, 0);
        prt(_("        どの構えをとりますか?", "        Choose Form: "), 1, 14);
 
-       while(1)
+       while (TRUE)
        {
                choice = inkey();
 
@@ -164,7 +164,7 @@ static bool choose_kata(player_type *creature_ptr)
        prt("", 1, 0);
        prt(_("        どの型で構えますか?", "        Choose Form: "), 1, 14);
 
-       while(1)
+       while (TRUE)
        {
                choice = inkey();
 
index 37066e2..d6d785b 100644 (file)
@@ -561,7 +561,7 @@ void do_cmd_snipe_browse(player_type *sniper_ptr)
 
        screen_save();
 
-       while(1)
+       while (TRUE)
        {
                if (!get_snipe_power(sniper_ptr, &n, TRUE))
                {
index c99810c..cd54751 100644 (file)
@@ -4313,7 +4313,7 @@ static char inkey_from_menu(void)
 
        screen_save();
 
-       while(1)
+       while (TRUE)
        {
                int i;
                char sub_cmd;