X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fcmd4.c;h=d4551e554291089d04018010c09777ac064198b9;hb=6ab40036f862c33829d4a5fbe66cda44214db2ad;hp=7db4847109b680478e905995d8e4381d6175d002;hpb=bf3562737ea5c7bb69f6b1393d903d3aea8272cd;p=hengband%2Fhengband.git diff --git a/src/cmd4.c b/src/cmd4.c index 7db484710..d4551e554 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -40,7 +40,7 @@ */ #include "angband.h" - +#include "cmd-pet.h" /* @@ -369,7 +369,7 @@ errr do_cmd_write_nikki(int type, int num, cptr note) cptr note_level = ""; bool do_level = TRUE; char note_level_buf[40]; - int q_idx; + QUEST_IDX q_idx; static bool disable_nikki = FALSE; @@ -383,7 +383,7 @@ errr do_cmd_write_nikki(int type, int num, cptr note) type == NIKKI_RAND_QUEST_F || type == NIKKI_TO_QUEST) { - int old_quest; + IDX old_quest; old_quest = p_ptr->inside_quest; p_ptr->inside_quest = (quest[num].type == QUEST_TYPE_RANDOM) ? 0 : num; @@ -426,14 +426,14 @@ errr do_cmd_write_nikki(int type, int num, cptr note) else if (!dun_level) note_level = _("地上:", "Surface:"); else if (q_idx && (is_fixed_quest_idx(q_idx) - && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT)))) + && !((q_idx == QUEST_OBERON) || (q_idx == QUEST_SERPENT)))) note_level = _("クエスト:", "Quest:"); else { #ifdef JP - sprintf(note_level_buf, "%d階(%s):", dun_level, d_name+d_info[dungeon_type].name); + sprintf(note_level_buf, "%d階(%s):", (int)dun_level, d_name+d_info[dungeon_type].name); #else - sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, dun_level); + sprintf(note_level_buf, "%s L%d:", d_name+d_info[dungeon_type].name, (int)dun_level); #endif note_level = note_level_buf; } @@ -464,6 +464,11 @@ errr do_cmd_write_nikki(int type, int num, cptr note) fprintf(fff, _(" %2d:%02d %20s %sを発見した。\n", " %2d:%02d %20s discovered %s.\n"), hour, min, note_level, note); break; } + case NIKKI_ART_SCROLL: + { + fprintf(fff, _(" %2d:%02d %20s 巻物によって%sを生成した。\n", " %2d:%02d %20s created %s by scroll.\n"), hour, min, note_level, note); + break; + } case NIKKI_UNIQUE: { fprintf(fff, _(" %2d:%02d %20s %sを倒した。\n", " %2d:%02d %20s defeated %s.\n"), hour, min, note_level, note); @@ -511,8 +516,8 @@ errr do_cmd_write_nikki(int type, int num, cptr note) { fprintf(fff, _(" %2d:%02d %20s %s%sの最深階を%d階にセットした。\n", " %2d:%02d %20s reset recall level of %s to %d %s.\n"), hour, min, note_level, note, - _(d_name + d_info[num].name, max_dlv[num]), - _(max_dlv[num], d_name + d_info[num].name)); + _(d_name + d_info[num].name, (int)max_dlv[num]), + _((int)max_dlv[num], d_name + d_info[num].name)); break; } case NIKKI_STAIR: @@ -535,8 +540,8 @@ errr do_cmd_write_nikki(int type, int num, cptr note) { if (!num) fprintf(fff, _(" %2d:%02d %20s 帰還を使って%sの%d階へ下りた。\n", " %2d:%02d %20s recalled to dungeon level %d of %s.\n"), - hour, min, note_level, _(d_name+d_info[dungeon_type].name, max_dlv[dungeon_type]), - _(max_dlv[dungeon_type], d_name+d_info[dungeon_type].name)); + hour, min, note_level, _(d_name+d_info[dungeon_type].name, (int)max_dlv[dungeon_type]), + _((int)max_dlv[dungeon_type], d_name+d_info[dungeon_type].name)); else fprintf(fff, _(" %2d:%02d %20s 帰還を使って地上へと戻った。\n", " %2d:%02d %20s recalled from dungeon to surface.\n"), hour, min, note_level); break; @@ -680,12 +685,19 @@ errr do_cmd_write_nikki(int type, int num, cptr note) case RECORD_NAMED_PET_LOSE_PARENT: fprintf(fff, _("%sの召喚者が既にいないため消え去った。\n", "%s disappeared because there does not exist summoner.\n"), note); break; + + default: fprintf(fff, "\n"); break; } break; } + + case NIKKI_WIZARD_LOG: + fprintf(fff, "%s\n", note); + break; + default: break; } @@ -786,7 +798,7 @@ static void do_cmd_disp_nikki(void) if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER) strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]); - else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER) + else if (IS_WIZARD_CLASS()) strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]); else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]); @@ -906,7 +918,6 @@ void do_cmd_nikki(void) /* Prompt */ i = inkey(); - /* Done */ if (i == ESCAPE) break; switch (i) @@ -972,7 +983,6 @@ void do_cmd_redraw(void) /* Update torch */ p_ptr->update |= (PU_TORCH); - /* Update stuff */ p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); /* Forget lite/view */ @@ -987,10 +997,8 @@ void do_cmd_redraw(void) /* Redraw everything */ p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP | PR_EQUIPPY); - /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER); - /* Window stuff */ p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT); update_playtime(); @@ -1097,7 +1105,6 @@ void do_cmd_change_name(void) mode++; } - /* Oops */ else { bell(); @@ -1124,7 +1131,7 @@ void do_cmd_change_name(void) */ void do_cmd_message_one(void) { - /* Recall one message XXX XXX XXX */ + /* Recall one message */ prt(format("> %s", message_str(0)), 0, 0); } @@ -1161,7 +1168,6 @@ void do_cmd_messages(int num_now) int wid, hgt; int num_lines; - /* Get size */ Term_get_size(&wid, &hgt); /* Number of message lines in a screen */ @@ -1224,15 +1230,10 @@ void do_cmd_messages(int num_now) Term_erase(0, num_lines + 1 - j, 255); } - /* Display header XXX XXX XXX */ -#ifdef JP + /* Display header */ /* translation */ - prt(format("以前のメッセージ %d-%d 全部で(%d)", + prt(format(_("以前のメッセージ %d-%d 全部で(%d)", "Message Recall (%d-%d of %d)"), i, i + j - 1, n), 0, 0); -#else - prt(format("Message Recall (%d-%d of %d)", - i, i + j - 1, n), 0, 0); -#endif /* Display prompt (not very informative) */ prt(_("[ 'p' で更に古いもの, 'n' で更に新しいもの, '/' で検索, ESC で中断 ]", @@ -1263,7 +1264,6 @@ void do_cmd_messages(int num_now) } else strcpy(shower_str, back_str); - /* Okay */ continue; /* Hack -- handle find */ @@ -1302,7 +1302,6 @@ void do_cmd_messages(int num_now) /* New location */ i = z; - /* Done */ break; } } @@ -1376,46 +1375,6 @@ void do_cmd_messages(int num_now) } - -/*! - * チートオプションの最大数 / Number of cheating options - */ -#define CHEAT_MAX 7 - -/*! - * チーとオプションの定義テーブル / Cheating options - */ -static option_type cheat_info[CHEAT_MAX] = -{ - { &cheat_peek, FALSE, 255, 0x01, 0x00, - "cheat_peek", _("アイテムの生成をのぞき見る", "Peek into object creation") - }, - - { &cheat_hear, FALSE, 255, 0x02, 0x00, - "cheat_hear", _("モンスターの生成をのぞき見る", "Peek into monster creation") - }, - - { &cheat_room, FALSE, 255, 0x04, 0x00, - "cheat_room", _("ダンジョンの生成をのぞき見る", "Peek into dungeon creation") - }, - - { &cheat_xtra, FALSE, 255, 0x08, 0x00, - "cheat_xtra", _("その他の事をのぞき見る", "Peek into something else") - }, - - { &cheat_know, FALSE, 255, 0x10, 0x00, - "cheat_know", _("完全なモンスターの思い出を知る", "Know complete monster info") - }, - - { &cheat_live, FALSE, 255, 0x20, 0x00, - "cheat_live", _("死を回避することを可能にする", "Allow player to avoid death") - }, - - { &cheat_save, FALSE, 255, 0x40, 0x00, - "cheat_save", _("死んだ時セーブするか確認する", "Ask for saving death") - } -}; - /*! * @brief チートオプションを変更するコマンドのメインルーチン * Interact with some options for cheating @@ -1425,21 +1384,18 @@ static option_type cheat_info[CHEAT_MAX] = static void do_cmd_options_cheat(cptr info) { char ch; - int i, k = 0, n = CHEAT_MAX; - char buf[80]; - /* Clear screen */ Term_clear(); /* Interact with the player */ while (TRUE) { - int dir; + DIRECTION dir; - /* Prompt XXX XXX XXX */ + /* Prompt */ sprintf(buf, _("%s ( リターンで次へ, y/n でセット, ESC で決定 )", "%s (RET to advance, y/n to set, ESC to accept) "), info); prt(buf, 0, 0); @@ -1548,18 +1504,6 @@ static void do_cmd_options_cheat(cptr info) /*! - * 自動セーブオプションテーブル - */ -static option_type autosave_info[2] = -{ - { &autosave_l, FALSE, 255, 0x01, 0x00, - "autosave_l", _("新しい階に入る度に自動セーブする", "Autosave when entering new levels") }, - - { &autosave_t, FALSE, 255, 0x02, 0x00, - "autosave_t", _("一定ターン毎に自動セーブする", "Timed autosave") }, -}; - -/*! * @brief セーブ頻度ターンの次の値を返す * @param current 現在のセーブ頻度ターン値 * @return 次のセーブ頻度ターン値 @@ -1589,11 +1533,9 @@ static s16b toggle_frequency(s16b current) */ static void do_cmd_options_autosave(cptr info) { - char ch; - - int i, k = 0, n = 2; - - char buf[80]; + char ch; + int i, k = 0, n = 2; + char buf[80]; /* Clear screen */ @@ -1602,7 +1544,7 @@ static void do_cmd_options_autosave(cptr info) /* Interact with the player */ while (TRUE) { - /* Prompt XXX XXX XXX */ + /* Prompt */ sprintf(buf, _("%s ( リターンで次へ, y/n でセット, F で頻度を入力, ESC で決定 ) ", "%s (RET to advance, y/n to set, 'F' for frequency, ESC to accept) "), info); @@ -1618,9 +1560,9 @@ static void do_cmd_options_autosave(cptr info) /* Display the option text */ sprintf(buf, "%-48s: %s (%s)", - autosave_info[i].o_desc, - (*autosave_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")), - autosave_info[i].o_text); + autosave_info[i].o_desc, + (*autosave_info[i].o_var ? _("はい ", "yes") : _("いいえ", "no ")), + autosave_info[i].o_text); c_prt(a, buf, i + 2, 0); } prt(format(_("自動セーブの頻度: %d ターン毎", "Timed autosave frequency: every %d turns"), autosave_freq), 5, 0); @@ -1726,16 +1668,15 @@ void do_cmd_options_aux(int page, cptr info) if (option_info[i].o_page == page) opt[n++] = i; } - /* Clear screen */ Term_clear(); /* Interact with the player */ while (TRUE) { - int dir; + DIRECTION dir; - /* Prompt XXX XXX XXX */ + /* Prompt */ sprintf(buf, _("%s (リターン:次, %sESC:終了, ?:ヘルプ) ", "%s (RET:next, %s, ?:help) "), info, browse_only ? _("", "ESC:exit") : _("y/n:変更, ", "y/n:change, ESC:accept")); prt(buf, 0, 0); @@ -1858,14 +1799,10 @@ void do_cmd_options_aux(int page, cptr info) static void do_cmd_options_win(void) { int i, j, d; - - int y = 0; - int x = 0; - + TERM_LEN y = 0; + TERM_LEN x = 0; char ch; - bool go = TRUE; - u32b old_flag[8]; @@ -1883,7 +1820,7 @@ static void do_cmd_options_win(void) /* Interact */ while (go) { - /* Prompt XXX XXX XXX */ + /* Prompt */ prt(_("ウィンドウ・フラグ (<方向>で移動, tでチェンジ, y/n でセット, ESC)", "Window Flags (, t, y, n, ESC) "), 0, 0); /* Display the windows */ @@ -1919,9 +1856,8 @@ static void do_cmd_options_win(void) /* Display the windows */ for (j = 0; j < 8; j++) { - byte a = TERM_WHITE; - char c = '.'; + a = TERM_WHITE; /* Use color */ if ((i == y) && (j == x)) a = TERM_L_BLUE; @@ -2096,8 +2032,8 @@ option_fields[OPT_NUM] = void do_cmd_options(void) { char k; - int i, d, skey; - int y = 0; + int d, skey; + TERM_LEN i, y = 0; /* Save the screen */ screen_save(); @@ -2364,7 +2300,6 @@ void do_cmd_options(void) /* Unknown option */ default: { - /* Oops */ bell(); break; } @@ -2389,7 +2324,7 @@ void do_cmd_options(void) * Ask for a "user pref line" and process it * @return なし * @details - * XXX XXX XXX Allow absolute file names? + * Allow absolute file names? */ void do_cmd_pref(void) { @@ -2484,12 +2419,10 @@ static errr macro_dump(cptr fname) */ static void do_cmd_macro_aux(char *buf) { - int i, n = 0; - + char i; + int n = 0; char tmp[1024]; - - /* Flush */ flush(); /* Do not process macros */ @@ -2517,10 +2450,8 @@ static void do_cmd_macro_aux(char *buf) /* Terminate */ buf[n] = '\0'; - /* Flush */ flush(); - /* Convert the trigger */ ascii_to_text(tmp, buf); @@ -2538,31 +2469,25 @@ static void do_cmd_macro_aux(char *buf) * @details *
  * Note that both "flush()" calls are extremely important.  This may
- * no longer be true, since "util.c" is much simpler now.  XXX XXX XXX
+ * no longer be true, since "util.c" is much simpler now.  
  * 
*/ static void do_cmd_macro_aux_keymap(char *buf) { char tmp[1024]; - - /* Flush */ flush(); - /* Get a key */ buf[0] = inkey(); buf[1] = '\0'; - /* Convert to ascii */ ascii_to_text(tmp, buf); /* Hack -- display the trigger */ Term_addstr(-1, TERM_WHITE, tmp); - - /* Flush */ flush(); } @@ -2582,7 +2507,7 @@ static errr keymap_dump(cptr fname) char key[1024]; char buf[1024]; - int mode; + BIT_FLAGS mode; /* Roguelike */ if (rogue_like_commands) @@ -2621,7 +2546,7 @@ static errr keymap_dump(cptr fname) if (!act) continue; /* Encode the key */ - buf[0] = i; + buf[0] = (char)i; buf[1] = '\0'; ascii_to_text(key, buf); @@ -2649,7 +2574,7 @@ static errr keymap_dump(cptr fname) *
  * Note that the macro "action" must be defined before the trigger.
  *
- * Could use some helpful instructions on this page.  XXX XXX XXX
+ * Could use some helpful instructions on this page.  
  * 
*/ void do_cmd_macros(void) @@ -2660,7 +2585,7 @@ void do_cmd_macros(void) char buf[1024]; - int mode; + BIT_FLAGS mode; /* Roguelike */ @@ -2688,8 +2613,6 @@ void do_cmd_macros(void) { /* Clear screen */ Term_clear(); - - /* Describe */ prt(_("[ マクロの設定 ]", "Interact with Macros"), 2, 0); /* Describe that action */ @@ -3038,10 +2961,8 @@ void do_cmd_macros(void) #endif /* ALLOW_MACROS */ - /* Oops */ else { - /* Oops */ bell(); } @@ -3077,19 +2998,19 @@ static cptr lighting_level_str[F_LIT_MAX] = * @param max ビジュアルIDの最大数 * @return 指定が実際に行われた場合TRUE、キャンセルされた場合FALSE */ -static bool cmd_visuals_aux(int i, int *num, int max) +static bool cmd_visuals_aux(int i, IDX *num, IDX max) { if (iscntrl(i)) { char str[10] = ""; - int tmp; + IDX tmp; sprintf(str, "%d", *num); if (!get_string(format("Input new number(0-%d): ", max-1), str, 4)) return FALSE; - tmp = strtol(str, NULL, 0); + tmp = (IDX)strtol(str, NULL, 0); if (tmp >= 0 && tmp < max) *num = tmp; } @@ -3131,9 +3052,9 @@ static void print_visuals_menu(cptr choice_msg) prt(format("コマンド: %s", choice_msg ? choice_msg : _("", "")), 15, 0); } -static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx); -static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx); -static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level); +static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx); +static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx); +static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level); /* * Interact with "visuals" @@ -3166,7 +3087,6 @@ void do_cmd_visuals(void) /* Prompt */ i = inkey(); - /* Done */ if (i == ESCAPE) break; switch (i) @@ -3238,7 +3158,6 @@ void do_cmd_visuals(void) /* Close */ close_auto_dump(); - /* Message */ msg_print(_("モンスターの[色/文字]をファイルに書き出しました。", "Dumped monster attr/chars.")); break; @@ -3248,6 +3167,7 @@ void do_cmd_visuals(void) case '2': { static cptr mark = "Object attr/chars"; + KIND_OBJECT_IDX k_idx; /* Prompt */ prt(_("コマンド: アイテムの[色/文字]をファイルに書き出します", "Command: Dump object attr/chars"), 15, 0); @@ -3271,10 +3191,10 @@ void do_cmd_visuals(void) auto_dump_printf(_("\n# アイテムの[色/文字]の設定\n\n", "\n# Object attr/char definitions\n\n")); /* Dump objects */ - for (i = 0; i < max_k_idx; i++) + for (k_idx = 0; k_idx < max_k_idx; k_idx++) { char o_name[80]; - object_kind *k_ptr = &k_info[i]; + object_kind *k_ptr = &k_info[k_idx]; /* Skip non-entries */ if (!k_ptr->name) continue; @@ -3282,14 +3202,14 @@ void do_cmd_visuals(void) if (!k_ptr->flavor) { /* Tidy name */ - strip_name(o_name, i); + strip_name(o_name, k_idx); } else { object_type forge; /* Prepare dummy object */ - object_prep(&forge, i); + object_prep(&forge, k_idx); /* Get un-shuffled flavor name */ object_desc(o_name, &forge, OD_FORCE_FLAVOR); @@ -3299,14 +3219,13 @@ void do_cmd_visuals(void) auto_dump_printf("# %s\n", o_name); /* Dump the object attr/char info */ - auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", i, + auto_dump_printf("K:%d:0x%02X/0x%02X\n\n", (int)k_idx, (byte)(k_ptr->x_attr), (byte)(k_ptr->x_char)); } /* Close */ close_auto_dump(); - /* Message */ msg_print(_("アイテムの[色/文字]をファイルに書き出しました。", "Dumped object attr/chars.")); break; @@ -3362,7 +3281,6 @@ void do_cmd_visuals(void) /* Close */ close_auto_dump(); - /* Message */ msg_print(_("地形の[色/文字]をファイルに書き出しました。", "Dumped feature attr/chars.")); break; @@ -3372,7 +3290,7 @@ void do_cmd_visuals(void) case '4': { static cptr choice_msg = _("モンスターの[色/文字]を変更します", "Change monster attr/chars"); - static int r = 0; + static IDX r = 0; prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0); @@ -3380,12 +3298,12 @@ void do_cmd_visuals(void) while (1) { monster_race *r_ptr = &r_info[r]; - char c; - int t; + int c; + IDX t; - byte da = r_ptr->d_attr; + TERM_COLOR da = r_ptr->d_attr; byte dc = r_ptr->d_char; - byte ca = r_ptr->x_attr; + TERM_COLOR ca = r_ptr->x_attr; byte cc = r_ptr->x_char; /* Label the object */ @@ -3424,7 +3342,7 @@ void do_cmd_visuals(void) { case 'n': { - int prev_r = r; + IDX prev_r = r; do { if (!cmd_visuals_aux(i, &r, max_r_idx)) @@ -3465,20 +3383,20 @@ void do_cmd_visuals(void) case '5': { static cptr choice_msg = _("アイテムの[色/文字]を変更します", "Change object attr/chars"); - static int k = 0; + static IDX k = 0; prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0); /* Hack -- query until done */ while (1) { object_kind *k_ptr = &k_info[k]; - char c; - int t; + int c; + IDX t; - byte da = k_ptr->d_attr; - byte dc = k_ptr->d_char; - byte ca = k_ptr->x_attr; - byte cc = k_ptr->x_char; + TERM_COLOR da = k_ptr->d_attr; + SYMBOL_CODE dc = k_ptr->d_char; + TERM_COLOR ca = k_ptr->x_attr; + SYMBOL_CODE cc = k_ptr->x_char; /* Label the object */ Term_putstr(5, 17, -1, TERM_WHITE, @@ -3517,7 +3435,7 @@ void do_cmd_visuals(void) { case 'n': { - int prev_k = k; + IDX prev_k = k; do { if (!cmd_visuals_aux(i, &k, max_k_idx)) @@ -3558,20 +3476,20 @@ void do_cmd_visuals(void) case '6': { static cptr choice_msg = _("地形の[色/文字]を変更します", "Change feature attr/chars"); - static int f = 0; - static int lighting_level = F_LIT_STANDARD; + static IDX f = 0; + static IDX lighting_level = F_LIT_STANDARD; prt(format(_("コマンド: %s", "Command: %s"), choice_msg), 15, 0); /* Hack -- query until done */ while (1) { feature_type *f_ptr = &f_info[f]; - char c; - int t; + int c; + IDX t; - byte da = f_ptr->d_attr[lighting_level]; + TERM_COLOR da = f_ptr->d_attr[lighting_level]; byte dc = f_ptr->d_char[lighting_level]; - byte ca = f_ptr->x_attr[lighting_level]; + TERM_COLOR ca = f_ptr->x_attr[lighting_level]; byte cc = f_ptr->x_char[lighting_level]; /* Label the object */ @@ -3622,7 +3540,7 @@ void do_cmd_visuals(void) { case 'n': { - int prev_f = f; + IDX prev_f = f; do { if (!cmd_visuals_aux(i, &f, max_f_idx)) @@ -3679,7 +3597,7 @@ void do_cmd_visuals(void) /* Modify feature attr/chars (visual mode) */ case '9': { - int lighting_level = F_LIT_STANDARD; + IDX lighting_level = F_LIT_STANDARD; do_cmd_knowledge_features(&need_redraw, TRUE, -1, &lighting_level); break; } @@ -3692,7 +3610,6 @@ void do_cmd_visuals(void) /* Reset */ reset_visuals(); - /* Message */ msg_print(_("画面上の[色/文字]を初期値にリセットしました。", "Visual attr/char tables reset.")); need_redraw = TRUE; break; @@ -3756,7 +3673,6 @@ void do_cmd_colors(void) /* Prompt */ i = inkey(); - /* Done */ if (i == ESCAPE) break; /* Load a 'pref' file */ @@ -3839,7 +3755,6 @@ void do_cmd_colors(void) /* Close */ close_auto_dump(); - /* Message */ msg_print(_("カラーの設定をファイルに書き出しました。", "Dumped color redefinitions.")); } @@ -3961,8 +3876,14 @@ void do_cmd_note(void) void do_cmd_version(void) { /* Silly message */ + +#if FAKE_VER_EXTRA > 0 + msg_format(_("変愚蛮怒(Hengband) %d.%d.%d.%d", "You are playing Hengband %d.%d.%d.%d."), + FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH, FAKE_VER_EXTRA); +#else msg_format(_("変愚蛮怒(Hengband) %d.%d.%d", "You are playing Hengband %d.%d.%d."), - FAKE_VER_MAJOR-10, FAKE_VER_MINOR, FAKE_VER_PATCH); + FAKE_VER_MAJOR - 10, FAKE_VER_MINOR, FAKE_VER_PATCH); +#endif } @@ -4296,9 +4217,10 @@ static bool ang_sort_comp_monster_level(vptr u, vptr v, int a, int b) * mode & 0x01 : check for non-empty group * mode & 0x02 : visual operation only */ -static int collect_monsters(int grp_cur, s16b mon_idx[], byte mode) +static IDX collect_monsters(IDX grp_cur, IDX mon_idx[], BIT_FLAGS8 mode) { - int i, mon_cnt = 0; + IDX i; + IDX mon_cnt = 0; int dummy_why; /* Get a list of x_char in this group */ @@ -4542,9 +4464,10 @@ static byte object_group_tval[] = * mode & 0x01 : check for non-empty group * mode & 0x02 : visual operation only */ -static int collect_objects(int grp_cur, int object_idx[], byte mode) +static int collect_objects(int grp_cur, IDX object_idx[], BIT_FLAGS8 mode) { - int i, j, k, object_cnt = 0; + IDX i; + int j, k, object_cnt = 0; /* Get a list of x_char in this group */ byte group_tval = object_group_tval[grp_cur]; @@ -4624,9 +4547,10 @@ static cptr feature_group_text[] = * * mode & 0x01 : check for non-empty group */ -static int collect_features(int grp_cur, int *feat_idx, byte mode) +static int collect_features(int grp_cur, IDX *feat_idx, BIT_FLAGS8 mode) { - int i, feat_cnt = 0; + IDX i; + int feat_cnt = 0; /* Unused; There is a single group. */ (void)grp_cur; @@ -4712,7 +4636,7 @@ void do_cmd_load_screen(void) { int i, y, x; - byte a = 0; + TERM_COLOR a = 0; char c = ' '; bool okay = TRUE; @@ -4731,7 +4655,6 @@ void do_cmd_load_screen(void) /* Append to the file */ fff = my_fopen(buf, "r"); - /* Oops */ if (!fff) { msg_format(_("%s を開くことができませんでした。", "Failed to open %s."), buf); msg_print(NULL); @@ -4794,7 +4717,7 @@ void do_cmd_load_screen(void) for (i = 0; i < 16; i++) { /* Use attr matches */ - if (hack[i] == buf[x]) a = i; + if (hack[i] == buf[x]) a = (byte_hack)i; } /* Put the attr/char */ @@ -4807,7 +4730,6 @@ void do_cmd_load_screen(void) my_fclose(fff); - /* Message */ prt(_("ファイルに書き出された画面(記念撮影)をロードしました。", "Screen dump loaded."), 0, 0); flush(); @@ -4842,10 +4764,10 @@ cptr inven_res_label = _(" 酸電火冷毒光闇 /* XTRA HACK RESLIST */ -static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, byte tval, char *where) +static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, OBJECT_TYPE_VALUE tval, char *where) { char o_name[MAX_NLEN]; - u32b flgs[TR_FLAG_SIZE]; + BIT_FLAGS flgs[TR_FLAG_SIZE]; if (!o_ptr->k_idx) return; if (o_ptr->tval != tval) return; @@ -4946,7 +4868,7 @@ static void do_cmd_knowledge_inven(void) store_type *st_ptr; - byte tval; + OBJECT_TYPE_VALUE tval; int i = 0; int j = 0; @@ -5004,7 +4926,7 @@ void do_cmd_save_screen_html_aux(char *filename, int message) { int y, x, i; - byte a = 0, old_a = 0; + TERM_COLOR a = 0, old_a = 0; char c = ' '; FILE *fff, *tmpfff; @@ -5039,7 +4961,6 @@ void do_cmd_save_screen_html_aux(char *filename, int message) /* Append to the file */ fff = my_fopen(filename, "w"); - /* Oops */ if (!fff) { if (message) { msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), filename); @@ -5145,7 +5066,6 @@ void do_cmd_save_screen_html_aux(char *filename, int message) /* Close it */ my_fclose(fff); - /* Message */ if (message) { msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved.")); msg_print(NULL); @@ -5239,7 +5159,7 @@ void do_cmd_save_screen(void) { int y, x; - byte a = 0; + TERM_COLOR a = 0; char c = ' '; FILE *fff; @@ -5255,7 +5175,6 @@ void do_cmd_save_screen(void) /* Append to the file */ fff = my_fopen(buf, "w"); - /* Oops */ if (!fff) { msg_format(_("ファイル %s を開けませんでした。", "Failed to open file %s."), buf); @@ -5319,7 +5238,6 @@ void do_cmd_save_screen(void) /* Close it */ my_fclose(fff); - /* Message */ msg_print(_("画面(記念撮影)をファイルに書き出しました。", "Screen dump saved.")); msg_print(NULL); @@ -5429,9 +5347,13 @@ static void ang_sort_art_swap(vptr u, vptr v, int a, int b) */ static void do_cmd_knowledge_artifacts(void) { - int i, k, z, x, y, n = 0; + IDX i; + IDX k; + POSITION x, y; + int n = 0; + IDX z; u16b why = 3; - s16b *who; + IDX *who; FILE *fff; @@ -5481,7 +5403,7 @@ static void do_cmd_knowledge_artifacts(void) { cave_type *c_ptr = &cave[y][x]; - s16b this_o_idx, next_o_idx = 0; + OBJECT_IDX this_o_idx, next_o_idx = 0; /* Scan all objects in the grid */ for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) @@ -5596,9 +5518,10 @@ static void do_cmd_knowledge_artifacts(void) */ static void do_cmd_knowledge_uniques(void) { - int i, k, n = 0; + IDX i; + int k, n = 0; u16b why = 2; - s16b *who; + IDX *who; FILE *fff; @@ -5699,8 +5622,7 @@ static void do_cmd_knowledge_uniques(void) { monster_race *r_ptr = &r_info[who[k]]; - /* Print a message */ - fprintf(fff, _(" %s (レベル%d)\n", " %s (level %d)\n"), r_name + r_ptr->name, r_ptr->level); + fprintf(fff, _(" %s (レベル%d)\n", " %s (level %d)\n"), r_name + r_ptr->name, (int)r_ptr->level); } /* Free the "who" array */ @@ -5722,7 +5644,8 @@ static void do_cmd_knowledge_uniques(void) */ static void do_cmd_knowledge_weapon_exp(void) { - int i, j, num, weapon_exp; + int i, num, weapon_exp; + KIND_OBJECT_IDX j; FILE *fff; @@ -5781,7 +5704,8 @@ static void do_cmd_knowledge_weapon_exp(void) */ static void do_cmd_knowledge_spell_exp(void) { - int i = 0, spell_exp, exp_level; + SPELL_IDX i = 0; + int spell_exp, exp_level; FILE *fff; const magic_type *s_ptr; @@ -6105,13 +6029,14 @@ static void do_cmd_knowledge_pets(void) * @brief 現在のペットを表示するコマンドのメインルーチン / * Total kill count * @return なし - * @note the player ghosts are ignored. XXX XXX XXX + * @note the player ghosts are ignored. */ static void do_cmd_knowledge_kill_count(void) { - int i, k, n = 0; + IDX i; + int k, n = 0; u16b why = 2; - s16b *who; + IDX *who; FILE *fff; @@ -6151,7 +6076,7 @@ static void do_cmd_knowledge_kill_count(void) } else { - s16b This = r_ptr->r_pkills; + MONSTER_NUMBER This = r_ptr->r_pkills; if (This > 0) { @@ -6199,24 +6124,22 @@ static void do_cmd_knowledge_kill_count(void) if (dead) { - /* Print a message */ - fprintf(fff, " %s\n", - (r_name + r_ptr->name)); + fprintf(fff, " %s\n", (r_name + r_ptr->name)); Total++; } } else { - s16b This = r_ptr->r_pkills; + MONSTER_NUMBER This = r_ptr->r_pkills; if (This > 0) { #ifdef JP /* p,tは人と数える by ita */ if (my_strchr("pt", r_ptr->d_char)) - fprintf(fff, " %3d 人の %s\n", This, r_name + r_ptr->name); + fprintf(fff, " %3d 人の %s\n", (int)This, r_name + r_ptr->name); else - fprintf(fff, " %3d 体の %s\n", This, r_name + r_ptr->name); + fprintf(fff, " %3d 体の %s\n", (int)This, r_name + r_ptr->name); #else if (This < 2) { @@ -6248,8 +6171,7 @@ static void do_cmd_knowledge_kill_count(void) #ifdef JP fprintf(fff," 合計: %lu 体を倒した。\n", (unsigned long int)Total); #else - fprintf(fff," Total: %lu creature%s killed.\n", - (unsigned long int)Total, (Total == 1 ? "" : "s")); + fprintf(fff," Total: %lu creature%s killed.\n", (unsigned long int)Total, (Total == 1 ? "" : "s")); #endif @@ -6280,8 +6202,7 @@ static void do_cmd_knowledge_kill_count(void) * @param grp_top 現在の選択リスト最上部ID * @return なし */ -static void display_group_list(int col, int row, int wid, int per_page, - int grp_idx[], cptr group_text[], int grp_cur, int grp_top) +static void display_group_list(int col, int row, int wid, int per_page, IDX grp_idx[], cptr group_text[], int grp_cur, int grp_top) { int i; @@ -6306,13 +6227,13 @@ static void display_group_list(int col, int row, int wid, int per_page, /* * Move the cursor in a browser window */ -static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt, - int *list_cur, int list_cnt) +static void browser_cursor(char ch, int *column, IDX *grp_cur, int grp_cnt, + IDX *list_cur, int list_cnt) { int d; int col = *column; - int grp = *grp_cur; - int list = *list_cur; + IDX grp = *grp_cur; + IDX list = *list_cur; /* Extract direction */ if (ch == ' ') @@ -6338,7 +6259,6 @@ static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt, int browser_rows; int wid, hgt; - /* Get size */ Term_get_size(&wid, &hgt); browser_rows = hgt - 8; @@ -6418,7 +6338,7 @@ static void browser_cursor(char ch, int *column, int *grp_cur, int grp_cnt, /* * Display visuals. */ -static void display_visual_list(int col, int row, int height, int width, byte attr_top, byte char_left) +static void display_visual_list(int col, int row, int height, int width, TERM_COLOR attr_top, byte char_left) { int i, j; @@ -6439,8 +6359,8 @@ static void display_visual_list(int col, int row, int height, int width, byte at { byte a; char c; - int x = col + j; - int y = row + i; + TERM_LEN x = col + j; + TERM_LEN y = row + i; int ia, ic; /* Bigtile mode uses double width */ @@ -6470,13 +6390,13 @@ static void display_visual_list(int col, int row, int height, int width, byte at /* * Place the cursor at the collect position for visual mode */ -static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr_top, byte char_left) +static void place_visual_list_cursor(TERM_LEN col, TERM_LEN row, TERM_COLOR a, byte c, TERM_COLOR attr_top, byte char_left) { int i = (a & 0x7f) - attr_top; int j = c - char_left; - int x = col + j; - int y = row + i; + TERM_LEN x = col + j; + TERM_LEN y = row + i; /* Bigtile mode uses double width */ if (use_bigtile) x += j; @@ -6489,11 +6409,11 @@ static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr /* * Clipboard variables for copy&paste in visual mode */ -static byte attr_idx = 0; +static TERM_COLOR attr_idx = 0; static byte char_idx = 0; /* Hack -- for feature lighting */ -static byte attr_idx_feat[F_LIT_MAX]; +static TERM_COLOR attr_idx_feat[F_LIT_MAX]; static byte char_idx_feat[F_LIT_MAX]; /* @@ -6501,10 +6421,11 @@ static byte char_idx_feat[F_LIT_MAX]; */ static bool visual_mode_command(char ch, bool *visual_list_ptr, int height, int width, - byte *attr_top_ptr, byte *char_left_ptr, - byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw) + TERM_COLOR *attr_top_ptr, byte *char_left_ptr, + TERM_COLOR *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw) { - static byte attr_old = 0, char_old = 0; + static TERM_COLOR attr_old = 0; + static byte char_old = 0; switch (ch) { @@ -6643,7 +6564,7 @@ static void display_monster_list(int col, int row, int per_page, s16b mon_idx[], byte attr; /* Get the race index */ - int r_idx = mon_idx[mon_top + i] ; + MONRACE_IDX r_idx = mon_idx[mon_top + i] ; /* Access the race */ monster_race *r_ptr = &r_info[r_idx]; @@ -6692,28 +6613,29 @@ static void display_monster_list(int col, int row, int per_page, s16b mon_idx[], /* * Display known monsters. */ -static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int direct_r_idx) +static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, IDX direct_r_idx) { - int i, len, max; - int grp_cur, grp_top, old_grp_cur; - int mon_cur, mon_top; - int grp_cnt, grp_idx[100]; - int mon_cnt; - s16b *mon_idx; + IDX i; + int len, max; + IDX grp_cur, grp_top, old_grp_cur; + IDX mon_cur, mon_top; + IDX grp_cnt, grp_idx[100]; + IDX mon_cnt; + IDX *mon_idx; int column = 0; bool flag; bool redraw; bool visual_list = FALSE; - byte attr_top = 0, char_left = 0; + TERM_COLOR attr_top = 0; + byte char_left = 0; int browser_rows; - int wid, hgt; + TERM_LEN wid, hgt; - byte mode; + BIT_FLAGS8 mode; - /* Get size */ Term_get_size(&wid, &hgt); browser_rows = hgt - 8; @@ -6952,7 +6874,7 @@ static void do_cmd_knowledge_monsters(bool *need_redraw, bool visual_only, int d /* * Display the objects in a group. */ -static void display_object_list(int col, int row, int per_page, int object_idx[], +static void display_object_list(int col, int row, int per_page, IDX object_idx[], int object_cur, int object_top, bool visual_only) { int i; @@ -6961,11 +6883,12 @@ static void display_object_list(int col, int row, int per_page, int object_idx[] for (i = 0; i < per_page && (object_idx[object_top + i] >= 0); i++) { char o_name[80]; - byte a, c; + TERM_COLOR a; + byte c; object_kind *flavor_k_ptr; /* Get the object index */ - int k_idx = object_idx[object_top + i]; + KIND_OBJECT_IDX k_idx = object_idx[object_top + i]; /* Access the object */ object_kind *k_ptr = &k_info[k_idx]; @@ -7031,15 +6954,13 @@ static void display_object_list(int col, int row, int per_page, int object_idx[] /* * Describe fake object */ -static void desc_obj_fake(int k_idx) +static void desc_obj_fake(KIND_OBJECT_IDX k_idx) { object_type *o_ptr; object_type object_type_body; /* Get local object */ o_ptr = &object_type_body; - - /* Wipe the object */ object_wipe(o_ptr); /* Create the artifact */ @@ -7069,34 +6990,36 @@ static void desc_obj_fake(int k_idx) /* * Display known objects */ -static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int direct_k_idx) +static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, IDX direct_k_idx) { - int i, len, max; - int grp_cur, grp_top, old_grp_cur; - int object_old, object_cur, object_top; - int grp_cnt, grp_idx[100]; + IDX i; + int len, max; + IDX grp_cur, grp_top, old_grp_cur; + IDX object_old, object_cur, object_top; + int grp_cnt; + IDX grp_idx[100]; int object_cnt; - int *object_idx; + IDX *object_idx; int column = 0; bool flag; bool redraw; bool visual_list = FALSE; - byte attr_top = 0, char_left = 0; + TERM_COLOR attr_top = 0; + byte char_left = 0; int browser_rows; int wid, hgt; byte mode; - /* Get size */ Term_get_size(&wid, &hgt); browser_rows = hgt - 8; /* Allocate the "object_idx" array */ - C_MAKE(object_idx, max_k_idx, int); + C_MAKE(object_idx, max_k_idx, IDX); max = 0; grp_cnt = 0; @@ -7350,15 +7273,15 @@ static void do_cmd_knowledge_objects(bool *need_redraw, bool visual_only, int di } /* Free the "object_idx" array */ - C_KILL(object_idx, max_k_idx, int); + C_KILL(object_idx, max_k_idx, IDX); } /* * Display the features in a group. */ -static void display_feature_list(int col, int row, int per_page, int *feat_idx, - int feat_cur, int feat_top, bool visual_only, int lighting_level) +static void display_feature_list(int col, int row, int per_page, FEAT_IDX *feat_idx, + FEAT_IDX feat_cur, FEAT_IDX feat_top, bool visual_only, int lighting_level) { int lit_col[F_LIT_MAX], i, j; int f_idx_col = use_bigtile ? 62 : 64; @@ -7374,7 +7297,7 @@ static void display_feature_list(int col, int row, int per_page, int *feat_idx, byte attr; /* Get the index */ - int f_idx = feat_idx[feat_top + i]; + FEAT_IDX f_idx = feat_idx[feat_top + i]; /* Access the index */ feature_type *f_ptr = &f_info[f_idx]; @@ -7428,39 +7351,42 @@ static void display_feature_list(int col, int row, int per_page, int *feat_idx, /* * Interact with feature visuals. */ -static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int direct_f_idx, int *lighting_level) +static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, IDX direct_f_idx, IDX *lighting_level) { - int i, len, max; - int grp_cur, grp_top, old_grp_cur; - int feat_cur, feat_top; - int grp_cnt, grp_idx[100]; + IDX i; + int len, max; + IDX grp_cur, grp_top, old_grp_cur; + IDX feat_cur, feat_top; + int grp_cnt; + IDX grp_idx[100]; int feat_cnt; - int *feat_idx; + IDX *feat_idx; int column = 0; bool flag; bool redraw; bool visual_list = FALSE; - byte attr_top = 0, char_left = 0; + TERM_COLOR attr_top = 0; + byte char_left = 0; int browser_rows; int wid, hgt; - byte attr_old[F_LIT_MAX]; + TERM_COLOR attr_old[F_LIT_MAX]; byte char_old[F_LIT_MAX]; - byte *cur_attr_ptr, *cur_char_ptr; + TERM_COLOR *cur_attr_ptr; + byte *cur_char_ptr; (void)C_WIPE(attr_old, F_LIT_MAX, byte); (void)C_WIPE(char_old, F_LIT_MAX, byte); - /* Get size */ Term_get_size(&wid, &hgt); browser_rows = hgt - 8; /* Allocate the "feat_idx" array */ - C_MAKE(feat_idx, max_f_idx, int); + C_MAKE(feat_idx, max_f_idx, IDX); max = 0; grp_cnt = 0; @@ -7670,7 +7596,7 @@ static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int d else if ((ch == 'D') || (ch == 'd')) { - byte prev_x_attr = f_ptr->x_attr[*lighting_level]; + TERM_COLOR prev_x_attr = f_ptr->x_attr[*lighting_level]; byte prev_x_char = f_ptr->x_char[*lighting_level]; apply_default_feat_lighting(f_ptr->x_attr, f_ptr->x_char); @@ -7766,7 +7692,7 @@ static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int d } /* Free the "feat_idx" array */ - C_KILL(feat_idx, max_f_idx, int); + C_KILL(feat_idx, max_f_idx, IDX); } @@ -7898,7 +7824,7 @@ static void do_cmd_knowledge_dungeon(void) } else if (max_dlv[i] == d_info[i].maxdepth) seiha = TRUE; - fprintf(fff, _("%c%-12s : %3d 階\n", "%c%-16s : level %3d\n"), seiha ? '!' : ' ', d_name + d_info[i].name, max_dlv[i]); + fprintf(fff, _("%c%-12s : %3d 階\n", "%c%-16s : level %3d\n"), seiha ? '!' : ' ', d_name + d_info[i].name, (int)max_dlv[i]); } } @@ -7975,20 +7901,20 @@ static void do_cmd_knowledge_quests_current(FILE *fff) char rand_tmp_str[120] = "\0"; char name[80]; monster_race *r_ptr; - int i; + IDX i; int rand_level = 100; int total = 0; fprintf(fff, _("《遂行中のクエスト》\n", "< Current Quest >\n")); - for (i = 1; i < max_quests; i++) + for (i = 1; i < max_q_idx; i++) { if ((quest[i].status == QUEST_STATUS_TAKEN) || ((quest[i].status == QUEST_STATUS_STAGE_COMPLETED) && (quest[i].type == QUEST_TYPE_TOWER)) || (quest[i].status == QUEST_STATUS_COMPLETED)) { /* Set the quest number temporary */ - int old_quest = p_ptr->inside_quest; + IDX old_quest = p_ptr->inside_quest; int j; /* Clear the text */ @@ -8026,11 +7952,11 @@ static void do_cmd_knowledge_quests_current(FILE *fff) { #ifdef JP sprintf(note," - %d 体の%sを倒す。(あと %d 体)", - quest[i].max_num, name, quest[i].max_num - quest[i].cur_num); + (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num)); #else plural_aux(name); sprintf(note," - kill %d %s, have killed %d.", - quest[i].max_num, name, quest[i].cur_num); + (int)quest[i].max_num, name, (int)quest[i].cur_num); #endif } else @@ -8043,7 +7969,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff) artifact_type *a_ptr = &a_info[quest[i].k_idx]; object_type forge; object_type *q_ptr = &forge; - int k_idx = lookup_kind(a_ptr->tval, a_ptr->sval); + KIND_OBJECT_IDX k_idx = lookup_kind(a_ptr->tval, a_ptr->sval); object_prep(q_ptr, k_idx); q_ptr->name1 = quest[i].k_idx; q_ptr->ident = IDENT_STORE; @@ -8058,10 +7984,10 @@ static void do_cmd_knowledge_quests_current(FILE *fff) case QUEST_TYPE_KILL_NUMBER: #ifdef JP sprintf(note," - %d 体のモンスターを倒す。(あと %d 体)", - quest[i].max_num, quest[i].max_num - quest[i].cur_num); + (int)quest[i].max_num, (int)(quest[i].max_num - quest[i].cur_num)); #else sprintf(note," - Kill %d monsters, have killed %d.", - quest[i].max_num, quest[i].cur_num); + (int)quest[i].max_num, (int)quest[i].cur_num); #endif break; @@ -8073,13 +7999,8 @@ static void do_cmd_knowledge_quests_current(FILE *fff) } /* Print the quest info */ -#ifdef JP - sprintf(tmp_str, " %s (危険度:%d階相当)%s\n", - quest[i].name, quest[i].level, note); -#else - sprintf(tmp_str, " %s (Danger level: %d)%s\n", - quest[i].name, quest[i].level, note); -#endif + sprintf(tmp_str, _(" %s (危険度:%d階相当)%s\n", " %s (Danger level: %d)%s\n"), + quest[i].name, (int)quest[i].level, note); fputs(tmp_str, fff); @@ -8114,25 +8035,20 @@ static void do_cmd_knowledge_quests_current(FILE *fff) { #ifdef JP sprintf(rand_tmp_str," %s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n", - quest[i].name, quest[i].level, - quest[i].max_num, name, quest[i].max_num - quest[i].cur_num); + quest[i].name, (int)quest[i].level, + (int)quest[i].max_num, name, (int)(quest[i].max_num - quest[i].cur_num)); #else plural_aux(name); sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n", - quest[i].name, quest[i].level, - quest[i].max_num, name, quest[i].cur_num); + quest[i].name, (int)quest[i].level, + (int)quest[i].max_num, name, (int)quest[i].cur_num); #endif } else { -#ifdef JP - sprintf(rand_tmp_str," %s (%d 階) - %sを倒す。\n", - quest[i].name, quest[i].level, name); -#else - sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n", - quest[i].name, quest[i].level, name); -#endif + sprintf(rand_tmp_str,_(" %s (%d 階) - %sを倒す。\n", " %s (Dungeon level: %d)\n Kill %s.\n"), + quest[i].name, (int)quest[i].level, name); } } } @@ -8146,7 +8062,7 @@ static void do_cmd_knowledge_quests_current(FILE *fff) } -static bool do_cmd_knowledge_quests_aux(FILE *fff, int q_idx) +static bool do_cmd_knowledge_quests_aux(FILE *fff, IDX q_idx) { char tmp_str[120]; char playtime_str[16]; @@ -8155,7 +8071,7 @@ static bool do_cmd_knowledge_quests_aux(FILE *fff, int q_idx) if (is_fixed_quest_idx(q_idx)) { /* Set the quest number temporary */ - int old_quest = p_ptr->inside_quest; + IDX old_quest = p_ptr->inside_quest; p_ptr->inside_quest = q_idx; @@ -8183,7 +8099,7 @@ static bool do_cmd_knowledge_quests_aux(FILE *fff, int q_idx) _(" %-35s (%3d階) - 不戦勝 - %s\n", " %-35s (Dungeon level: %3d) - Unearned - %s\n") , r_name+r_info[q_ptr->r_idx].name, - q_ptr->level, playtime_str); + (int)q_ptr->level, playtime_str); } else { @@ -8191,7 +8107,7 @@ static bool do_cmd_knowledge_quests_aux(FILE *fff, int q_idx) _(" %-35s (%3d階) - レベル%2d - %s\n", " %-35s (Dungeon level: %3d) - level %2d - %s\n") , r_name+r_info[q_ptr->r_idx].name, - q_ptr->level, + (int)q_ptr->level, q_ptr->complev, playtime_str); } @@ -8202,7 +8118,7 @@ static bool do_cmd_knowledge_quests_aux(FILE *fff, int q_idx) sprintf(tmp_str, _(" %-35s (危険度:%3d階相当) - レベル%2d - %s\n", " %-35s (Danger level: %3d) - level %2d - %s\n") , - q_ptr->name, q_ptr->level, q_ptr->complev, playtime_str); + q_ptr->name, (int)q_ptr->level, q_ptr->complev, playtime_str); } fputs(tmp_str, fff); @@ -8213,15 +8129,15 @@ static bool do_cmd_knowledge_quests_aux(FILE *fff, int q_idx) /* * Print all finished quests */ -void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[]) +void do_cmd_knowledge_quests_completed(FILE *fff, IDX quest_num[]) { int i; int total = 0; fprintf(fff, _("《達成したクエスト》\n", "< Completed Quest >\n")); - for (i = 1; i < max_quests; i++) + for (i = 1; i < max_q_idx; i++) { - int q_idx = quest_num[i]; + IDX q_idx = quest_num[i]; quest_type* const q_ptr = &quest[q_idx]; if (q_ptr->status == QUEST_STATUS_FINISHED && @@ -8237,15 +8153,15 @@ void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[]) /* * Print all failed quests */ -void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[]) +void do_cmd_knowledge_quests_failed(FILE *fff, IDX quest_num[]) { - int i; + IDX i; int total = 0; fprintf(fff, _("《失敗したクエスト》\n", "< Failed Quest >\n")); - for (i = 1; i < max_quests; i++) + for (i = 1; i < max_q_idx; i++) { - int q_idx = quest_num[i]; + IDX q_idx = quest_num[i]; quest_type* const q_ptr = &quest[q_idx]; if (((q_ptr->status == QUEST_STATUS_FAILED_DONE) || (q_ptr->status == QUEST_STATUS_FAILED)) && @@ -8268,7 +8184,7 @@ static void do_cmd_knowledge_quests_wiz_random(FILE *fff) int total = 0; fprintf(fff, _("《残りのランダムクエスト》\n", "< Remaining Random Quest >\n")); - for (i = 1; i < max_quests; i++) + for (i = 1; i < max_q_idx; i++) { /* No info from "silent" quests */ if (quest[i].flags & QUEST_FLAG_SILENT) continue; @@ -8278,13 +8194,8 @@ static void do_cmd_knowledge_quests_wiz_random(FILE *fff) total++; /* Print the quest info */ -#ifdef JP - sprintf(tmp_str, " %s (%d階, %s)\n", - quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name); -#else - sprintf(tmp_str, " %s (%d, %s)\n", - quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name); -#endif + sprintf(tmp_str, _(" %s (%d階, %s)\n", " %s (%d, %s)\n"), + quest[i].name, (int)quest[i].level, r_name+r_info[quest[i].r_idx].name); fputs(tmp_str, fff); } } @@ -8294,20 +8205,22 @@ static void do_cmd_knowledge_quests_wiz_random(FILE *fff) bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b) { - int *q_num = (int *)u; + QUEST_IDX *q_num = (QUEST_IDX *)u; quest_type *qa = &quest[q_num[a]]; quest_type *qb = &quest[q_num[b]]; /* Unused */ (void)v; - return (qa->comptime <= qb->comptime); + return (qa->comptime != qb->comptime) ? + (qa->comptime < qb->comptime) : + (qa->level <= qb->level); } void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b) { - int *q_num = (int *)u; - int tmp; + QUEST_IDX *q_num = (QUEST_IDX *)u; + QUEST_IDX tmp; /* Unused */ (void)v; @@ -8325,7 +8238,9 @@ static void do_cmd_knowledge_quests(void) { FILE *fff; char file_name[1024]; - int *quest_num, dummy, i; + IDX *quest_num; + int dummy; + IDX i; /* Open a new file */ fff = my_fopen_temp(file_name, 1024); @@ -8337,13 +8252,13 @@ static void do_cmd_knowledge_quests(void) } /* Allocate Memory */ - C_MAKE(quest_num, max_quests, int); + C_MAKE(quest_num, max_q_idx, IDX); /* Sort by compete level */ - for (i = 1; i < max_quests; i++) quest_num[i] = i; + for (i = 1; i < max_q_idx; i++) quest_num[i] = i; ang_sort_comp = ang_sort_comp_quest_num; ang_sort_swap = ang_sort_swap_quest_num; - ang_sort(quest_num, &dummy, max_quests); + ang_sort(quest_num, &dummy, max_q_idx); /* Dump Quest Information */ do_cmd_knowledge_quests_current(fff); @@ -8367,7 +8282,7 @@ static void do_cmd_knowledge_quests(void) fd_kill(file_name); /* Free Memory */ - C_KILL(quest_num, max_quests, int); + C_KILL(quest_num, max_q_idx, IDX); } @@ -8403,7 +8318,7 @@ static void do_cmd_knowledge_home(void) if (st_ptr->stock_num) { #ifdef JP - int x = 1; + TERM_LEN x = 1; #endif /* Header with name of the town */ fprintf(fff, _(" [ 我が家のアイテム ]\n", " [Home Inventory]\n")); @@ -8497,7 +8412,7 @@ static void do_cmd_knowledge_autopick(void) { tmp = _("拾う", "Pickup"); } - else /* if (act & DO_QUERY_AUTOPICK) */ /* Obvious */ + else { tmp = _("確認", "Query"); } @@ -8623,7 +8538,6 @@ void do_cmd_knowledge(void) /* Prompt */ i = inkey(); - /* Done */ if (i == ESCAPE) break; switch (i) { @@ -8660,7 +8574,7 @@ void do_cmd_knowledge(void) break; case '0': /* Feature list */ { - int lighting_level = F_LIT_STANDARD; + IDX lighting_level = F_LIT_STANDARD; do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level); } break; @@ -8753,7 +8667,6 @@ void do_cmd_time(void) if (day < MAX_DAYS) sprintf(day_buf, "%d", day); else strcpy(day_buf, "*****"); - /* Message */ #ifdef JP msg_format("%s日目, 時刻は%d:%02d %sです。", day_buf, (hour % 12 == 0) ? 12 : (hour % 12), @@ -8778,7 +8691,6 @@ void do_cmd_time(void) /* Open this file */ fff = my_fopen(buf, "rt"); - /* Oops */ if (!fff) return; /* Find this time */ @@ -8829,7 +8741,6 @@ void do_cmd_time(void) } } - /* Message */ msg_print(desc); /* Close the file */