OSDN Git Service

[Refactor] #38997 'while (1)' を 'while (TRUE)' に変更 / Changed 'while (1)' to 'while...
authorHourier <hourier@users.sourceforge.jp>
Sat, 11 Jan 2020 11:29:20 +0000 (20:29 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 11 Jan 2020 11:29:20 +0000 (20:29 +0900)
23 files changed:
src/birth.c
src/chuukei.c
src/cmd/cmd-dump.c
src/cmd/cmd-gameoption.c
src/cmd/cmd-item.c
src/cmd/cmd-spell.c
src/dungeon.c
src/files.c
src/floor-streams.c
src/floor.c
src/geometry.c
src/load.c
src/object2.c
src/player-status.c
src/quest.c
src/rumor.c
src/store.c
src/targeting.c
src/trap.c
src/util.c
src/view-mainwindow.c
src/wizard1.c
src/z-form.c

index 9eed176..41eb6de 100644 (file)
@@ -697,7 +697,7 @@ static byte choose_realm(player_type *creature_ptr, s32b choices, int *count)
        /* Get a realm */
        k = -1;
        os = n;
-       while (1)       {
+       while (TRUE)    {
                /* Move Cursol */
                if (cs != os)
                {
@@ -818,7 +818,7 @@ static bool get_player_realms(player_type *creature_ptr)
        /* Select the first realm */
        creature_ptr->realm1 = REALM_NONE;
        creature_ptr->realm2 = 255;
-       while (1)
+       while (TRUE)
        {
                char temp[80*10];
                concptr t;
@@ -866,7 +866,7 @@ static bool get_player_realms(player_type *creature_ptr)
                c_put_str(TERM_L_BLUE, realm_names[creature_ptr->realm1], 6, 15);
 
                /* Select the second realm */
-               while (1)
+               while (TRUE)
                {
                        char temp[80*8];
                        concptr t;
@@ -2525,7 +2525,7 @@ static bool get_player_race(player_type *creature_ptr)
        k = -1;
        cs = creature_ptr->prace;
        os = MAX_RACES;
-       while (1)
+       while (TRUE)
        {
                /* Move Cursol */
                if (cs != os)
@@ -2693,7 +2693,7 @@ static bool get_player_class(player_type *creature_ptr)
        k = -1;
        cs = creature_ptr->pclass;
        os = MAX_CLASS_CHOICE;
-       while (1)
+       while (TRUE)
        {
                /* Move Cursol */
                if (cs != os)
@@ -2857,7 +2857,7 @@ static bool get_player_seikaku(player_type *creature_ptr)
        k = -1;
        cs = creature_ptr->pseikaku;
        os = MAX_SEIKAKU;
-       while (1)
+       while (TRUE)
        {
                /* Move Cursol */
                if (cs != os)
@@ -3929,7 +3929,7 @@ static bool player_birth_aux(player_type *creature_ptr)
        k = -1;
        cs = 0;
        os = MAX_SEXES;
-       while (1)
+       while (TRUE)
        {
                if (cs != os)
                {
@@ -4502,7 +4502,7 @@ static bool ask_quick_start(player_type *creature_ptr)
        put_str(_("クイック・スタートを使うと以前と全く同じキャラクターで始められます。", "Do you want to use the quick start function(same character as your last one)."), 11, 2);
 
        /* Choose */
-       while (1)
+       while (TRUE)
        {
                char c;
 
@@ -4587,7 +4587,7 @@ void player_birth(player_type *creature_ptr)
                play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_DEFAULT);
 
                /* No, normal start */
-               while (1)
+               while (TRUE)
                {
                        /* Roll up a new character */
                        if (player_birth_aux(creature_ptr)) break;
index c75fd71..d843f5f 100644 (file)
@@ -233,7 +233,7 @@ void flush_ringbuf(void)
        FD_ZERO(&fdset);
        FD_SET(sd, &fdset);
 
-       while (1)
+       while (TRUE)
        {
                fd_set tmp_fdset;
                int result;
@@ -271,7 +271,7 @@ void flush_ringbuf(void)
 
        if (ring.inlen == 0) return;
 
-       while (1)
+       while (TRUE)
        {
                int result;
 
@@ -901,7 +901,7 @@ static bool get_nextbuf(char *buf)
 {
        char *ptr = buf;
 
-       while (1)
+       while (TRUE)
        {
                *ptr = ring.buf[ring.rptr ++];
                ring.inlen --;
@@ -1043,7 +1043,7 @@ void browse_chuukei()
        Term_fresh();
        Term_xtra(TERM_XTRA_REACT, 0);
 
-       while (1)
+       while (TRUE)
        {
                fd_set tmp_fdset;
                struct timeval tmp_tv;
@@ -1074,7 +1074,7 @@ void browse_chuukei()
        Term_fresh();
        Term_xtra(TERM_XTRA_REACT, 0);
 
-       while (1)
+       while (TRUE)
        {
                UInt32  unreadData = 0;
                int n;
index 2a5c35b..91e091a 100644 (file)
@@ -2277,7 +2277,7 @@ void do_cmd_visuals(player_type *creature_ptr)
                        prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
 
                        /* Hack -- query until done */
-                       while (1)
+                       while (TRUE)
                        {
                                monster_race *r_ptr = &r_info[r];
                                int c;
@@ -2366,7 +2366,7 @@ void do_cmd_visuals(player_type *creature_ptr)
                        prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
 
                        /* Hack -- query until done */
-                       while (1)
+                       while (TRUE)
                        {
                                object_kind *k_ptr = &k_info[k];
                                int c;
@@ -2457,7 +2457,7 @@ void do_cmd_visuals(player_type *creature_ptr)
                        prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0);
 
                        /* Hack -- query until done */
-                       while (1)
+                       while (TRUE)
                        {
                                feature_type *f_ptr = &f_info[f];
                                int c;
@@ -2729,7 +2729,7 @@ void do_cmd_colors(player_type *creature_ptr)
                        prt(_("コマンド: カラーの設定を変更します", "Command: Modify colors"), 8, 0);
 
                        /* Hack -- query until done */
-                       while (1)
+                       while (TRUE)
                        {
                                concptr name;
                                byte j;
index 7a05814..12076bf 100644 (file)
@@ -1190,7 +1190,7 @@ void do_cmd_options(void)
        screen_save();
 
        /* Interact */
-       while (1)
+       while (TRUE)
        {
                int n = OPT_NUM;
 
@@ -1201,7 +1201,7 @@ void do_cmd_options(void)
                /* Why are we here */
                prt(_("[ オプションの設定 ]", "TinyAngband options"), 1, 0);
 
-               while (1)
+               while (TRUE)
                {
                        /* Give some choices */
                        for (i = 0; i < n; i++)
@@ -1366,7 +1366,7 @@ void do_cmd_options(void)
                        prt(_("コマンド: 基本ウェイト量", "Command: Base Delay Factor"), 19, 0);
 
                        /* Get a new value */
-                       while (1)
+                       while (TRUE)
                        {
                                int msec = delay_factor * delay_factor * delay_factor;
                                prt(format(_("現在のウェイト: %d (%dミリ秒)", "Current base delay factor: %d (%d msec)"), delay_factor, msec), 22, 0);
@@ -1394,7 +1394,7 @@ void do_cmd_options(void)
                        prt(_("コマンド: 低ヒットポイント警告", "Command: Hitpoint Warning"), 19, 0);
 
                        /* Get a new value */
-                       while (1)
+                       while (TRUE)
                        {
                                prt(format(_("現在の低ヒットポイント警告: %d0%%", "Current hitpoint warning: %d0%%"), hitpoint_warn), 22, 0);
                                prt(_("低ヒットポイント警告 (0-9) ESCで決定: ", "Hitpoint Warning (0-9 or ESC to accept): "), 20, 0);
@@ -1421,7 +1421,7 @@ void do_cmd_options(void)
                        prt(_("コマンド: 低魔力色閾値", "Command: Mana Color Threshold"), 19, 0);
 
                        /* Get a new value */
-                       while (1)
+                       while (TRUE)
                        {
                                prt(format(_("現在の低魔力色閾値: %d0%%", "Current mana color threshold: %d0%%"), mana_warn), 22, 0);
                                prt(_("低魔力閾値 (0-9) ESCで決定: ", "Mana color Threshold (0-9 or ESC to accept): "), 20, 0);
index 882a8ee..277a9c1 100644 (file)
@@ -1121,7 +1121,7 @@ void do_cmd_locate(player_type *creature_ptr)
        x2 = x1 = panel_col_min;
 
        /* Show panels until done */
-       while (1)
+       while (TRUE)
        {
                /* Describe the location */
                if ((y2 == y1) && (x2 == x1))
@@ -1366,7 +1366,7 @@ void do_cmd_query_symbol(player_type *creature_ptr)
        i = n - 1;
 
        /* Scan the monster memory */
-       while (1)
+       while (TRUE)
        {
                r_idx = who[i];
 
@@ -1375,7 +1375,7 @@ void do_cmd_query_symbol(player_type *creature_ptr)
                handle_stuff(creature_ptr);
 
                /* Interact */
-               while (1)
+               while (TRUE)
                {
                        if (recall)
                        {
index 158dc7f..aafa5ae 100644 (file)
@@ -589,7 +589,7 @@ static void confirm_use_force(player_type *caster_ptr, bool browse_only)
        /* Show the prompt */
        prt(_("('w'練気術, ESC) 'w'かESCを押してください。 ", "(w for the Force, ESC) Hit 'w' or ESC. "), 0, 0);
 
-       while (1)
+       while (TRUE)
        {
                /* Get a key */
                which = inkey();
index f0c9ea1..3eb84ed 100644 (file)
@@ -70,7 +70,7 @@ DUNGEON_IDX choose_dungeon(concptr note, POSITION y, POSITION x)
        }
 
        prt(format(_("どのダンジョン%sしますか:", "Which dungeon do you %s?: "), note), 0, 0);
-       while (1)
+       while (TRUE)
        {
                i = inkey();
                if ((i == ESCAPE) || !num)
index d4a3190..11c9abc 100644 (file)
@@ -5872,7 +5872,7 @@ void process_player_name(player_type *creature_ptr, bool sf)
        {
                concptr s;
                s = savefile;
-               while (1)
+               while (TRUE)
                {
                        concptr t;
                        t = my_strstr(s, PATH_SEP);
@@ -6738,7 +6738,7 @@ static errr counts_seek(int fd, u32b where, bool flag)
                temp1[i] ^= (i+1) * 63;
 
        seekpoint = 0;
-       while (1)
+       while (TRUE)
        {
                if (fd_seek(fd, seekpoint + 3 * sizeof(u32b)))
                        return 1;
index adeb09c..597cc22 100644 (file)
@@ -271,7 +271,7 @@ void build_streamer(player_type *player_ptr, FEAT_IDX feat, int chance)
                        int d = DUN_STR_RNG;
 
                        /* Pick a nearby grid */
-                       while (1)
+                       while (TRUE)
                        {
                                ty = rand_spread(y, d);
                                tx = rand_spread(x, d);
index eba38a0..39745dd 100644 (file)
@@ -1358,7 +1358,7 @@ sint project_path(floor_type *floor_ptr, u16b *gp, POSITION range, POSITION y1,
                }
 
                /* Create the projection path */
-               while (1)
+               while (TRUE)
                {
                        /* Save grid */
                        gp[n++] = GRID(y, x);
@@ -1447,7 +1447,7 @@ sint project_path(floor_type *floor_ptr, u16b *gp, POSITION range, POSITION y1,
                }
 
                /* Create the projection path */
-               while (1)
+               while (TRUE)
                {
                        /* Save grid */
                        gp[n++] = GRID(y, x);
@@ -1518,7 +1518,7 @@ sint project_path(floor_type *floor_ptr, u16b *gp, POSITION range, POSITION y1,
                x = x1 + sx;
 
                /* Create the projection path */
-               while (1)
+               while (TRUE)
                {
                        /* Save grid */
                        gp[n++] = GRID(y, x);
index bed7731..6dbb03c 100644 (file)
@@ -77,7 +77,7 @@ POSITION distance(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
        /* Simple case */
        if (!dy || !dx) return d;
 
-       while (1)
+       while (TRUE)
        {
                /* Approximate error */
                err = (target - d * d) / (2 * d);
index 5187c60..d9c8769 100644 (file)
@@ -2429,7 +2429,7 @@ static errr rd_inventory(void)
        C_MAKE(p_ptr->inventory_list, INVEN_TOTAL, object_type);
 
        /* Read until done */
-       while (1)
+       while (TRUE)
        {
                u16b n;
 
index c79cc82..1f14a7a 100644 (file)
@@ -1870,7 +1870,7 @@ void apply_magic_weapon(player_type *owner_ptr, object_type *o_ptr, DEPTH level,
                                become_random_artifact(owner_ptr, o_ptr, FALSE);
                                break;
                        }
-                       while (1)
+                       while (TRUE)
                        {
                                /* Roll for an ego-item */
                                o_ptr->name2 = get_random_ego(INVEN_RARM, TRUE);
@@ -1988,7 +1988,7 @@ void apply_magic_weapon(player_type *owner_ptr, object_type *o_ptr, DEPTH level,
                        /* Roll for ego-item */
                        if (randint0(MAX_DEPTH) < level)
                        {
-                               while (1)
+                               while (TRUE)
                                {
                                        o_ptr->name2 = get_random_ego(INVEN_RARM, FALSE);
                                        if (o_ptr->name2 == EGO_WEIRD && o_ptr->tval != TV_SWORD)
@@ -2170,7 +2170,7 @@ static void a_m_aux_2(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                                break;
                        }
 
-                       while (1)
+                       while (TRUE)
                        {
                                bool okay_flag = TRUE;
 
@@ -2258,7 +2258,7 @@ static void a_m_aux_2(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                                break;
                        }
 
-                       while (1)
+                       while (TRUE)
                        {
                                o_ptr->name2 = get_random_ego(INVEN_LARM, TRUE);
                                if (o_ptr->sval != SV_SMALL_METAL_SHIELD && o_ptr->sval != SV_LARGE_METAL_SHIELD
@@ -2361,7 +2361,7 @@ static void a_m_aux_2(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                                become_random_artifact(owner_ptr, o_ptr, FALSE);
                                break;
                        }
-                       while (1)
+                       while (TRUE)
                        {
                                bool ok_flag = TRUE;
                                o_ptr->name2 = get_random_ego(INVEN_HEAD, TRUE);
@@ -2389,7 +2389,7 @@ static void a_m_aux_2(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                                        ok_flag = FALSE;
                                }
                                if (ok_flag)
-                                       break; /* while (1) */
+                                       break; /* while (TRUE) */
                        }
                        break;
                }
@@ -2397,7 +2397,7 @@ static void a_m_aux_2(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                /* Very cursed */
                else if (power < -1)
                {
-                       while (1)
+                       while (TRUE)
                        {
                                bool ok_flag = TRUE;
                                o_ptr->name2 = get_random_ego(INVEN_HEAD, FALSE);
@@ -2414,7 +2414,7 @@ static void a_m_aux_2(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                                        break;
                                }
                                if (ok_flag)
-                                       break; /* while (1) */
+                                       break; /* while (TRUE) */
                        }
                }
 
@@ -2437,7 +2437,7 @@ static void a_m_aux_2(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                                become_random_artifact(owner_ptr, o_ptr, FALSE);
                                break;
                        }
-                       while (1)
+                       while (TRUE)
                        {
                                bool ok_flag = TRUE;
                                o_ptr->name2 = get_random_ego(INVEN_HEAD, TRUE);
@@ -2481,14 +2481,14 @@ static void a_m_aux_2(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                                        ok_flag = FALSE;
                                }
                                if (ok_flag)
-                                       break; /* while (1) */
+                                       break; /* while (TRUE) */
                        }
                        break;
                }
                /* Very cursed */
                else if (power < -1)
                {
-                       while (1)
+                       while (TRUE)
                        {
                                bool ok_flag = TRUE;
                                o_ptr->name2 = get_random_ego(INVEN_HEAD, FALSE);
@@ -2499,7 +2499,7 @@ static void a_m_aux_2(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                                        ok_flag = FALSE;
                                }
                                if (ok_flag)
-                                       break; /* while (1) */
+                                       break; /* while (TRUE) */
                        }
                }
                break;
@@ -3404,7 +3404,7 @@ static void a_m_aux_4(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                {
                        while (!o_ptr->name2)
                        {
-                               while (1)
+                               while (TRUE)
                                {
                                        bool okay_flag = TRUE;
 
@@ -3482,7 +3482,7 @@ static void a_m_aux_4(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                monster_race *r_ptr;
 
                /* Pick a random non-unique monster race */
-               while (1)
+               while (TRUE)
                {
                        i = randint1(max_r_idx - 1);
 
@@ -3535,7 +3535,7 @@ static void a_m_aux_4(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                get_mon_num_prep(item_monster_okay, NULL);
 
                /* Pick a random non-unique monster race */
-               while (1)
+               while (TRUE)
                {
                        i = get_mon_num(floor_ptr->dun_level);
 
@@ -3569,7 +3569,7 @@ static void a_m_aux_4(player_type *owner_ptr, object_type *o_ptr, DEPTH level, i
                monster_race *r_ptr;
 
                /* Pick a random monster race */
-               while (1)
+               while (TRUE)
                {
                        i = randint1(max_r_idx - 1);
 
index 2dae77f..d3a5172 100644 (file)
@@ -5591,7 +5591,7 @@ void check_experience(player_type *creature_ptr)
                        {
                                int choice;
                                screen_save();
-                               while (1)
+                               while (TRUE)
                                {
                                        int n;
                                        char tmp[32];
@@ -5612,7 +5612,7 @@ void check_experience(player_type *creature_ptr)
                                        prt("", 8, 14);
                                        prt(_("        どの能力値を上げますか?", "        Which stat do you want to raise?"), 1, 14);
 
-                                       while (1)
+                                       while (TRUE)
                                        {
                                                choice = inkey();
                                                if ((choice >= 'a') && (choice <= 'f')) break;
index 6363917..ee37ee1 100644 (file)
@@ -49,7 +49,7 @@ void determine_random_questor(quest_type *q_ptr)
 
        get_mon_num_prep(mon_hook_quest, NULL);
 
-       while (1)
+       while (TRUE)
        {
                /*
                 * Random monster 5 - 10 levels out of depth
index c2d2bdb..7b576c2 100644 (file)
@@ -72,7 +72,7 @@ void display_rumor(bool ex)
                                object_type *q_ptr = &forge;
                                artifact_type *a_ptr;
 
-                               while (1)
+                               while (TRUE)
                                {
                                        a_idx = rumor_num(zz[1], max_a_idx);
 
@@ -91,7 +91,7 @@ void display_rumor(bool ex)
                                MONRACE_IDX r_idx;
                                monster_race *r_ptr;
 
-                               while (1)
+                               while (TRUE)
                                {
                                        r_idx = rumor_num(zz[1], max_r_idx);
                                        r_ptr = &r_info[r_idx];
@@ -111,7 +111,7 @@ void display_rumor(bool ex)
                                DUNGEON_IDX d_idx;
                                dungeon_type *d_ptr;
 
-                               while (1)
+                               while (TRUE)
                                {
                                        d_idx = rumor_num(zz[1], current_world_ptr->max_d_idx);
                                        d_ptr = &d_info[d_idx];
@@ -131,7 +131,7 @@ void display_rumor(bool ex)
                                IDX t_idx;
                                s32b visit;
 
-                               while (1)
+                               while (TRUE)
                                {
                                        t_idx = rumor_num(zz[1], NO_TOWN);
                                        if (town_info[t_idx].name) break;
index 57aed29..43672a9 100644 (file)
@@ -4428,7 +4428,7 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
        /* Haggle */
        for (flag = FALSE; !flag; )
        {
-               while (1)
+               while (TRUE)
                {
                        loop_flag = TRUE;
 
index 05dd6da..a7a8851 100644 (file)
@@ -609,7 +609,7 @@ static char target_set_aux(player_type *subject_ptr, POSITION y, POSITION x, BIT
                handle_stuff(subject_ptr);
 
                /* Interact */
-               while (1)
+               while (TRUE)
                {
                        char acount[10];
 
@@ -726,7 +726,7 @@ static char target_set_aux(player_type *subject_ptr, POSITION y, POSITION x, BIT
        {
                int min_width = 0;
 
-               while (1)
+               while (TRUE)
                {
                        if (floor_num == 1)
                        {
@@ -775,7 +775,7 @@ static char target_set_aux(player_type *subject_ptr, POSITION y, POSITION x, BIT
                        /** Display list of items **/
 
                        /* Continue scrolling list if requested */
-                       while (1)
+                       while (TRUE)
                        {
                                int i;
                                OBJECT_IDX o_idx;
index 2a653af..590f4db 100644 (file)
@@ -149,7 +149,7 @@ FEAT_IDX choose_random_trap(floor_type *floor_ptr)
        FEAT_IDX feat;
 
        /* Pick a trap */
-       while (1)
+       while (TRUE)
        {
                /* Hack -- pick a trap */
                feat = normal_traps[randint0(MAX_NORMAL_TRAPS)];
index c85fa8b..e897b7c 100644 (file)
@@ -1173,7 +1173,7 @@ static void trigger_text_to_ascii(char **bufptr, concptr *strptr)
        str++;
 
        /* Examine modifier keys */
-       while (1)
+       while (TRUE)
        {
                for (i=0; macro_modifier_chr[i]; i++)
                {
@@ -2842,7 +2842,7 @@ static void msg_flush(int x)
                Term_putstr(x, 0, -1, a, _("-続く-", "-more-"));
 
                /* Get an acceptable keypress */
-               while (1)
+               while (TRUE)
                {
                        int cmd = inkey();
                        if (cmd == ESCAPE) {
@@ -4491,7 +4491,7 @@ void request_command(int shopping)
 
 
        /* Get command */
-       while (1)
+       while (TRUE)
        {
                /* Hack -- auto-commands */
                if (command_new)
@@ -4538,7 +4538,7 @@ void request_command(int shopping)
                        prt(_("回数: ", "Count: "), 0, 0);
 
                        /* Get a command count */
-                       while (1)
+                       while (TRUE)
                        {
                                /* Get a new keypress */
                                cmd = inkey();
index cc9f560..5e9504d 100644 (file)
@@ -3693,7 +3693,7 @@ void do_cmd_view_map(void)
        {
                display_autopick = ITEM_DISPLAY;
 
-               while (1)
+               while (TRUE)
                {
                        int i;
                        byte flag;
index 6d8602e..3dcf907 100644 (file)
@@ -1430,7 +1430,7 @@ static void spoiler_outlist(concptr header, concptr *list, char separator)
        line_len = strlen(line);
 
        /* Now begin the tedious task */
-       while (1)
+       while (TRUE)
        {
                /* Copy the current item to a buffer */
                strcpy(buf, *list);
@@ -2337,7 +2337,7 @@ void do_cmd_spoilers(void)
        screen_save();
 
        /* Interact */
-       while (1)
+       while (TRUE)
        {
                Term_clear();
 
index ce2b3de..db43884 100644 (file)
@@ -654,7 +654,7 @@ char *vformat(concptr fmt, va_list vp)
        if (!fmt) return (format_buf);
 
        /* Keep going until successful */
-       while (1)
+       while (TRUE)
        {
                uint len;