From: Hourier Date: Sat, 11 Jan 2020 11:29:20 +0000 (+0900) Subject: [Refactor] #38997 'while (1)' を 'while (TRUE)' に変更 / Changed 'while (1)' to 'while... X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=commitdiff_plain;h=bd519d53bf8418cc2225f944092684de915be365 [Refactor] #38997 'while (1)' を 'while (TRUE)' に変更 / Changed 'while (1)' to 'while (TRUE)' --- diff --git a/src/birth.c b/src/birth.c index 9eed1761c..41eb6de38 100644 --- a/src/birth.c +++ b/src/birth.c @@ -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; diff --git a/src/chuukei.c b/src/chuukei.c index c75fd7163..d843f5f2d 100644 --- a/src/chuukei.c +++ b/src/chuukei.c @@ -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; diff --git a/src/cmd/cmd-dump.c b/src/cmd/cmd-dump.c index 2a5c35be6..91e091ae8 100644 --- a/src/cmd/cmd-dump.c +++ b/src/cmd/cmd-dump.c @@ -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; diff --git a/src/cmd/cmd-gameoption.c b/src/cmd/cmd-gameoption.c index 7a05814f3..12076bfea 100644 --- a/src/cmd/cmd-gameoption.c +++ b/src/cmd/cmd-gameoption.c @@ -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); diff --git a/src/cmd/cmd-item.c b/src/cmd/cmd-item.c index 882a8eebd..277a9c1b1 100644 --- a/src/cmd/cmd-item.c +++ b/src/cmd/cmd-item.c @@ -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) { diff --git a/src/cmd/cmd-spell.c b/src/cmd/cmd-spell.c index 158dc7f0e..aafa5ae70 100644 --- a/src/cmd/cmd-spell.c +++ b/src/cmd/cmd-spell.c @@ -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(); diff --git a/src/dungeon.c b/src/dungeon.c index f0c9ea12b..3eb84edaa 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -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) diff --git a/src/files.c b/src/files.c index d4a3190f6..11c9abccd 100644 --- a/src/files.c +++ b/src/files.c @@ -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; diff --git a/src/floor-streams.c b/src/floor-streams.c index adeb09c18..597cc2266 100644 --- a/src/floor-streams.c +++ b/src/floor-streams.c @@ -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); diff --git a/src/floor.c b/src/floor.c index eba38a002..39745dd71 100644 --- a/src/floor.c +++ b/src/floor.c @@ -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); diff --git a/src/geometry.c b/src/geometry.c index bed7731d6..6dbb03c2b 100644 --- a/src/geometry.c +++ b/src/geometry.c @@ -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); diff --git a/src/load.c b/src/load.c index 5187c60d9..d9c876986 100644 --- a/src/load.c +++ b/src/load.c @@ -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; diff --git a/src/object2.c b/src/object2.c index c79cc82a0..1f14a7ac6 100644 --- a/src/object2.c +++ b/src/object2.c @@ -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); diff --git a/src/player-status.c b/src/player-status.c index 2dae77f82..d3a517290 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -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; diff --git a/src/quest.c b/src/quest.c index 63639176d..ee37ee173 100644 --- a/src/quest.c +++ b/src/quest.c @@ -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 diff --git a/src/rumor.c b/src/rumor.c index c2d2bdbf8..7b576c221 100644 --- a/src/rumor.c +++ b/src/rumor.c @@ -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; diff --git a/src/store.c b/src/store.c index 57aed2957..43672a9d0 100644 --- a/src/store.c +++ b/src/store.c @@ -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; diff --git a/src/targeting.c b/src/targeting.c index 05dd6da30..a7a88519b 100644 --- a/src/targeting.c +++ b/src/targeting.c @@ -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; diff --git a/src/trap.c b/src/trap.c index 2a653aff1..590f4db3c 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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)]; diff --git a/src/util.c b/src/util.c index c85fa8bdb..e897b7cfa 100644 --- a/src/util.c +++ b/src/util.c @@ -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(); diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index cc9f5606a..5e9504d6c 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -3693,7 +3693,7 @@ void do_cmd_view_map(void) { display_autopick = ITEM_DISPLAY; - while (1) + while (TRUE) { int i; byte flag; diff --git a/src/wizard1.c b/src/wizard1.c index 6d8602e71..3dcf9074e 100644 --- a/src/wizard1.c +++ b/src/wizard1.c @@ -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(); diff --git a/src/z-form.c b/src/z-form.c index ce2b3dea2..db43884a4 100644 --- a/src/z-form.c +++ b/src/z-form.c @@ -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;