OSDN Git Service

refactor: drain-life->HP damage, drain-exp->Exp damage
[hengband/hengband.git] / src / cmd4.c
index 8e11092..fd29579 100644 (file)
@@ -1,23 +1,18 @@
-/* File: cmd4.c */
-
-/*
+/*!
+ * @file cmd4.c
+ * @brief ¥×¥ì¥¤¥ä¡¼¤Î¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤Ë´Ø¤¹¤ë¥³¥Þ¥ó¥É¤Î¼ÂÁõ / Interface commands
+ * @date 2014/01/02
+ * @author
+ * <pre>
  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
- *
  * This software may be copied and distributed for educational, research,
  * and not for profit purposes provided that this copyright and statement
  * are included in all such copies.  Other copyrights may also apply.
- */
-
-/* Purpose: Interface commands */
-
-#include "angband.h"
-
-
-
-/*
+ * </pre>
+ * @details
+ * <pre>
  * A set of functions to maintain automatic dumps of various kinds.
  * -Mogami-
- *
  * remove_auto_dump(orig_file, mark)
  *     Remove the old automatic dump of type "mark".
  * auto_dump_printf(fmt, ...)
  *     Open a file, remove old dump, and add new header.
  * close_auto_dump(void)
  *     Add a footer, and close the file.
- *
  *    The dump commands of original Angband simply add new lines to
  * existing files; these files will become bigger and bigger unless
  * an user deletes some or all of these files by hand at some
  * point.
- *
  *     These three functions automatically delete old dumped lines 
  * before adding new ones.  Since there are various kinds of automatic 
  * dumps in a single file, we add a header and a footer with a type 
  * name for every automatic dump, and kill old lines only when the 
  * lines have the correct type of header and footer.
- *
  *     We need to be quite paranoid about correctness; the user might 
  * (mistakenly) edit the file by hand, and see all their work come
  * to nothing on the next auto dump otherwise.  The current code only 
  * detects changes by noting inconsistencies between the actual number 
  * of lines and the number written in the footer.  Note that this will 
  * not catch single-line edits.
+ * </pre>
+ */
+
+#include "angband.h"
+
+
+
+/*
  */
 
 /*
@@ -59,8 +59,11 @@ static FILE *auto_dump_stream;
 static cptr auto_dump_mark;
 static int auto_dump_line_num;
 
-/*
+
+/*!
+ * @brief prf½ÐÎÏÆâÍƤò¾Ãµî¤¹¤ë /
  * Remove old lines automatically generated before.
+ * @param orig_file ¾Ãµî¤ò¹Ô¤¦¥Õ¥¡¥¤¥ë̾
  */
 static void remove_auto_dump(cptr orig_file)
 {
@@ -223,8 +226,10 @@ static void remove_auto_dump(cptr orig_file)
 }
 
 
-/*
+/*!
+ * @brief prf¥Õ¥¡¥¤¥ë¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤Ë½¾¤Ã¤¿ÆâÍƤò½ÐÎϤ¹¤ë /
  * Dump a formatted line, using "vstrnfmt()".
+ * @param fmt ½ÐÎÏÆâÍÆ
  */
 static void auto_dump_printf(cptr fmt, ...)
 {
@@ -253,8 +258,12 @@ static void auto_dump_printf(cptr fmt, ...)
 }
 
 
-/*
- *  Open file to append auto dump.
+/*!
+ * @brief prf¥Õ¥¡¥¤¥ë¤ò¥Õ¥¡¥¤¥ë¥ª¡¼¥×¥ó¤¹¤ë /
+ * Open file to append auto dump.
+ * @param buf ¥Õ¥¡¥¤¥ë̾
+ * @param mark ½ÐÎϤ¹¤ë¥Ø¥Ã¥À¥Þ¡¼¥¯
+ * @return ¥Õ¥¡¥¤¥ë¥Ý¥¤¥ó¥¿¤ò¼èÆÀ¤Ç¤­¤¿¤éTRUE¤òÊÖ¤¹
  */
 static bool open_auto_dump(cptr buf, cptr mark)
 {
@@ -304,8 +313,10 @@ static bool open_auto_dump(cptr buf, cptr mark)
        return TRUE;
 }
 
-/*
- *  Append foot part and close auto dump.
+/*!
+ * @brief prf¥Õ¥¡¥¤¥ë¤ò¥Õ¥¡¥¤¥ë¥¯¥í¡¼¥º¤¹¤ë /
+ * Append foot part and close auto dump.
+ * @return ¤Ê¤·
  */
 static void close_auto_dump(void)
 {
@@ -333,8 +344,11 @@ static void close_auto_dump(void)
 
 
 #ifndef JP
-/*
- * Return suffix of ordinal number
+
+/*!
+ * @brief Return suffix of ordinal number
+ * @param num number
+ * @return pointer of suffix string.
  */
 cptr get_ordinal_number_suffix(int num)
 {
@@ -354,8 +368,13 @@ cptr get_ordinal_number_suffix(int num)
 #endif
 
 
-/*
- *   Take note to the diary.
+/*!
+ * @brief Æüµ­¤Ë¥á¥Ã¥»¡¼¥¸¤òÄɲ乤ë /
+ * Take note to the diary.
+ * @param type Æüµ­ÆâÍƤÎID
+ * @param num Æüµ­ÆâÍƤÎID¤Ë±þ¤¸¤¿¿ôÃÍ
+ * @param note Æüµ­ÆâÍƤÎID¤Ë±þ¤¸¤¿Ê¸»úÎ󻲾ȥݥ¤¥ó¥¿
+ * @return ¥¨¥é¡¼ID
  */
 errr do_cmd_write_nikki(int type, int num, cptr note)
 {
@@ -876,6 +895,10 @@ errr do_cmd_write_nikki(int type, int num, cptr note)
 
 #define MAX_SUBTITLE (sizeof(subtitle)/sizeof(subtitle[0]))
 
+/*!
+ * @brief Æüµ­¤Î¥¿¥¤¥È¥ëɽµ­¤ÈÆâÍƽÐÎÏ /
+ * @return ¤Ê¤·
+ */
 static void do_cmd_disp_nikki(void)
 {
        char nikki_title[256];
@@ -975,6 +998,10 @@ static void do_cmd_disp_nikki(void)
        show_file(FALSE, buf, nikki_title, -1, 0);
 }
 
+/*!
+ * @brief Æüµ­¤ËǤ°Õ¤ÎÆâÍƤòɽµ­¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
+ * @return ¤Ê¤·
+ */
 static void do_cmd_bunshou(void)
 {
        char tmp[80] = "\0";
@@ -992,6 +1019,10 @@ static void do_cmd_bunshou(void)
        }
 }
 
+/*!
+ * @brief ºÇ¸å¤Ë¼èÆÀ¤·¤¿¥¢¥¤¥Æ¥à¤Î¾ðÊó¤òÆüµ­¤ËÄɲ乤ë¥á¥¤¥ó¥ë¡¼¥Á¥ó /
+ * @return ¤Ê¤·
+ */
 static void do_cmd_last_get(void)
 {
        char buf[256];
@@ -1059,7 +1090,10 @@ static void do_cmd_erase_nikki(void)
        msg_print(NULL);
 }
 
-
+/*!
+ * @brief Æüµ­¥³¥Þ¥ó¥É
+ * @return ¤Ê¤·
+ */
 void do_cmd_nikki(void)
 {
        int i;
@@ -1146,9 +1180,12 @@ void do_cmd_nikki(void)
        screen_load();
 }
 
-/*
+/*!
+ * @brief ²èÌ̤òºÆÉÁ²è¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
  * Hack -- redraw the screen
- *
+ * @return ¤Ê¤·
+ * @details
+ * <pre>
  * This command performs various low level updates, clears all the "extra"
  * windows, does a total redraw of the main window, and requests all of the
  * interesting updates and redraws that I can think of.
@@ -1156,6 +1193,7 @@ void do_cmd_nikki(void)
  * This command is also used to "instantiate" the results of the user
  * selecting various things, such as graphics mode, so it must call
  * the "TERM_XTRA_REACT" hook before redrawing the windows.
+ * </pre>
  */
 void do_cmd_redraw(void)
 {
@@ -1225,8 +1263,10 @@ void do_cmd_redraw(void)
 }
 
 
-/*
+/*!
+ * @brief Ì¾Á°¤òÊѹ¹¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
  * Hack -- change name
+ * @return ¤Ê¤·
  */
 void do_cmd_change_name(void)
 {
@@ -1323,8 +1363,10 @@ void do_cmd_change_name(void)
 }
 
 
-/*
+/*!
+ * @brief ºÇ¶áɽ¼¨¤µ¤ì¤¿¥á¥Ã¥»¡¼¥¸¤òºÆɽ¼¨¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
  * Recall the most recent message
+ * @return ¤Ê¤·
  */
 void do_cmd_message_one(void)
 {
@@ -1333,7 +1375,12 @@ void do_cmd_message_one(void)
 }
 
 
-/*
+/*!
+ * @brief ¥á¥Ã¥»¡¼¥¸¤Î¥í¥°¤òɽ¼¨¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
+ * Recall the most recent message
+ * @return ¤Ê¤·
+ * @details
+ * <pre>
  * Show previous messages to the user  -BEN-
  *
  * The screen format uses line 0 and 23 for headers and prompts,
@@ -1347,6 +1394,7 @@ void do_cmd_message_one(void)
  * "slide" the virtual display to the left or right.
  *
  * Attempt to only hilite the matching portions of the string.
+ * </pre>
  */
 void do_cmd_messages(int num_now)
 {
@@ -1586,13 +1634,13 @@ void do_cmd_messages(int num_now)
 
 
 
-/*
- * Number of cheating options
+/*!
+ * ¥Á¡¼¥È¥ª¥×¥·¥ç¥ó¤ÎºÇÂç¿ô / Number of cheating options
  */
 #define CHEAT_MAX 7
 
-/*
- * Cheating options
+/*!
+ * ¥Á¡¼¤È¥ª¥×¥·¥ç¥ó¤ÎÄêµÁ¥Æ¡¼¥Ö¥ë / Cheating options
  */
 static option_type cheat_info[CHEAT_MAX] =
 {
@@ -1653,8 +1701,11 @@ static option_type cheat_info[CHEAT_MAX] =
        }
 };
 
-/*
+/*!
+ * @brief ¥Á¡¼¥È¥ª¥×¥·¥ç¥ó¤òÊѹ¹¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
  * Interact with some options for cheating
+ * @param info É½¼¨¥á¥Ã¥»¡¼¥¸
+ * @return ¤Ê¤·
  */
 static void do_cmd_options_cheat(cptr info)
 {
@@ -1797,6 +1848,9 @@ static void do_cmd_options_cheat(cptr info)
 }
 
 
+/*!
+ * ¼«Æ°¥»¡¼¥Ö¥ª¥×¥·¥ç¥ó¥Æ¡¼¥Ö¥ë
+ */
 static option_type autosave_info[2] =
 {
        { &autosave_l,      FALSE, 255, 0x01, 0x00,
@@ -1816,7 +1870,11 @@ static option_type autosave_info[2] =
 
 };
 
-
+/*!
+ * @brief ¥»¡¼¥ÖÉÑÅÙ¥¿¡¼¥ó¤Î¼¡¤ÎÃͤòÊÖ¤¹
+ * @param current ¸½ºß¤Î¥»¡¼¥ÖÉÑÅÙ¥¿¡¼¥óÃÍ
+ * @return ¼¡¤Î¥»¡¼¥ÖÉÑÅÙ¥¿¡¼¥óÃÍ
+ */
 static s16b toggle_frequency(s16b current)
 {
        switch (current)
@@ -1835,8 +1893,10 @@ static s16b toggle_frequency(s16b current)
 }
 
 
-/*
- * Interact with some options for cheating
+/*!
+ * @brief ¼«Æ°¥»¡¼¥Ö¥ª¥×¥·¥ç¥ó¤òÊѹ¹¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
+ * @param info É½¼¨¥á¥Ã¥»¡¼¥¸
+ * @return ¤Ê¤·
  */
 static void do_cmd_options_autosave(cptr info)
 {
@@ -1977,8 +2037,12 @@ static void do_cmd_options_autosave(cptr info)
 }
 
 
-/*
+/*!
+ * @brief É¸½à¥ª¥×¥·¥ç¥ó¤òÊѹ¹¤¹¤ë¥³¥Þ¥ó¥É¤Î¥µ¥Ö¥ë¡¼¥Á¥ó /
  * Interact with some options
+ * @param page ¥ª¥×¥·¥ç¥ó¥Ú¡¼¥¸ÈÖ¹æ
+ * @param info É½¼¨¥á¥Ã¥»¡¼¥¸
+ * @return ¤Ê¤·
  */
 void do_cmd_options_aux(int page, cptr info)
 {
@@ -2140,8 +2204,10 @@ void do_cmd_options_aux(int page, cptr info)
 }
 
 
-/*
+/*!
+ * @brief ¥¦¥£¥ó¥É¥¦¥ª¥×¥·¥ç¥ó¤òÊѹ¹¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Modify the "window" options
+ * @return ¤Ê¤·
  */
 static void do_cmd_options_win(void)
 {
@@ -2386,11 +2452,15 @@ option_fields[OPT_NUM] =
 };
 
 
-/*
+/*!
+ * @brief É¸½à¥ª¥×¥·¥ç¥ó¤òÊѹ¹¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Set or unset various options.
- *
+ * @return ¤Ê¤·
+ * @details
+ * <pre>
  * The user must use the "Ctrl-R" command to "adapt" to changes
  * in any options which control "visual" aspects of the game.
+ * </pre>
  */
 void do_cmd_options(void)
 {
@@ -2793,9 +2863,11 @@ void do_cmd_options(void)
 
 
 
-/*
+/*!
+ * @brief pref¥Õ¥¡¥¤¥ë¤òÁªÂò¤·¤Æ½èÍý¤¹¤ë /
  * Ask for a "user pref line" and process it
- *
+ * @return ¤Ê¤·
+ * @details
  * XXX XXX XXX Allow absolute file names?
  */
 void do_cmd_pref(void)
@@ -2817,6 +2889,10 @@ void do_cmd_pref(void)
        (void)process_pref_file_command(buf);
 }
 
+/*!
+ * @brief ¼«Æ°½¦¤¤ÀßÄê¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
+ * @return ¤Ê¤·
+ */
 void do_cmd_reload_autopick(void)
 {
 #ifdef JP
@@ -2831,8 +2907,10 @@ void do_cmd_reload_autopick(void)
 
 #ifdef ALLOW_MACROS
 
-/*
- * Hack -- append all current macros to the given file
+/*!
+ * @brief ¥Þ¥¯¥í¾ðÊó¤òpref¥Õ¥¡¥¤¥ë¤ËÊݸ¤¹¤ë /
+ * @param fname ¥Õ¥¡¥¤¥ë̾
+ * @return ¤Ê¤·
  */
 static errr macro_dump(cptr fname)
 {
@@ -2885,12 +2963,17 @@ static errr macro_dump(cptr fname)
 }
 
 
-/*
+/*!
+ * @brief ¥Þ¥¯¥í¤Î¥È¥ê¥¬¡¼¥­¡¼¤ò¼èÆÀ¤¹¤ë /
  * Hack -- ask for a "trigger" (see below)
- *
+ * @param buf ¥­¡¼É½µ­¤òÊݴɤ¹¤ë¥Ð¥Ã¥Õ¥¡
+ * @return ¤Ê¤·
+ * @details
+ * <pre>
  * Note the complex use of the "inkey()" function from "util.c".
  *
  * Note that both "flush()" calls are extremely important.
+ * </pre>
  */
 static void do_cmd_macro_aux(char *buf)
 {
@@ -2940,12 +3023,16 @@ static void do_cmd_macro_aux(char *buf)
 
 #endif
 
-
-/*
+/*!
+ * @brief ¥Þ¥¯¥í¤Î¥­¡¼É½µ­¤«¤é¥¢¥¹¥­¡¼¥³¡¼¥É¤òÆÀ¤Æ¥¿¡¼¥ß¥Ê¥ë¤Ëɽ¼¨¤¹¤ë /
  * Hack -- ask for a keymap "trigger" (see below)
- *
+ * @param buf ¥­¡¼É½µ­¤ò¼èÆÀ¤¹¤ë¥Ð¥Ã¥Õ¥¡
+ * @return ¤Ê¤·
+ * @details
+ * <pre>
  * Note that both "flush()" calls are extremely important.  This may
  * no longer be true, since "util.c" is much simpler now.  XXX XXX XXX
+ * </pre>
  */
 static void do_cmd_macro_aux_keymap(char *buf)
 {
@@ -2973,8 +3060,12 @@ static void do_cmd_macro_aux_keymap(char *buf)
 }
 
 
-/*
+/*!
+ * @brief ¥­¡¼¥Þ¥Ã¥×¤òpref¥Õ¥¡¥¤¥ë¤Ë¥À¥ó¥×¤¹¤ë /
  * Hack -- append all keymaps to the given file
+ * @param fname ¥Õ¥¡¥¤¥ë¥Í¡¼¥à
+ * @return ¥¨¥é¡¼¥³¡¼¥É
+ * @details
  */
 static errr keymap_dump(cptr fname)
 {
@@ -3047,13 +3138,16 @@ static errr keymap_dump(cptr fname)
 }
 
 
-
-/*
+/*!
+ * @brief ¥Þ¥¯¥í¤òÀßÄꤹ¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Interact with "macros"
- *
+ * @return ¤Ê¤·
+ * @details
+ * <pre>
  * Note that the macro "action" must be defined before the trigger.
  *
  * Could use some helpful instructions on this page.  XXX XXX XXX
+ * </pre>
  */
 void do_cmd_macros(void)
 {
@@ -5955,7 +6049,7 @@ static void do_cmd_knowledge_inven_aux(FILE *fff, object_type *o_ptr, int *j, by
                        print_flag(TR_RES_CONF);
                        print_flag(TR_FREE_ACT);
                        print_flag(TR_SEE_INVIS);
-                       print_flag(TR_HOLD_LIFE);
+                       print_flag(TR_HOLD_EXP);
                        print_flag(TR_TELEPATHY);
                        print_flag(TR_SLOW_DIGEST);
                        print_flag(TR_REGEN);
@@ -6922,15 +7016,17 @@ static void do_cmd_knowledge_weapon_exp(void)
 }
 
 
-/*
+/*!
+ * @brief ËâË¡¤Î·Ð¸³Ãͤòɽ¼¨¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
  * Display spell-exp
+ * @return ¤Ê¤·
  */
 static void do_cmd_knowledge_spell_exp(void)
 {
        int i = 0, spell_exp, exp_level;
 
        FILE *fff;
-       magic_type *s_ptr;
+       const magic_type *s_ptr;
 
        char file_name[1024];
 
@@ -7026,8 +7122,10 @@ static void do_cmd_knowledge_spell_exp(void)
 }
 
 
-/*
+/*!
+ * @brief ¥¹¥­¥ë¾ðÊó¤òɽ¼¨¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Display skill-exp
+ * @return ¤Ê¤·
  */
 static void do_cmd_knowledge_skill_exp(void)
 {
@@ -7081,8 +7179,10 @@ static void do_cmd_knowledge_skill_exp(void)
 }
 
 
-/*
- * Pluralize a monster name
+/*!
+ * @brief ±Ññ¸ì¡¢¶ç¡¢Àâ¤òÊ£¿ô·Á¤òÊÑ´¹¤¹¤ë / Pluralize a monster name
+ * @param Name ÊÑ´¹¤·¤¿¤¤Ê¸»úÎó¤Î»²¾È¥Ý¥¤¥ó¥¿
+ * @return ¤Ê¤·
  */
 void plural_aux(char *Name)
 {
@@ -7204,8 +7304,10 @@ void plural_aux(char *Name)
        }
 }
 
-/*
+/*!
+ * @brief ¸½ºß¤Î¥Ú¥Ã¥È¤òɽ¼¨¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Display current pets
+ * @return ¤Ê¤·
  */
 static void do_cmd_knowledge_pets(void)
 {
@@ -7278,10 +7380,11 @@ static void do_cmd_knowledge_pets(void)
 }
 
 
-/*
+/*!
+ * @brief ¸½ºß¤Î¥Ú¥Ã¥È¤òɽ¼¨¤¹¤ë¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
  * Total kill count
- *
- * Note that the player ghosts are ignored.  XXX XXX XXX
+ * @return ¤Ê¤·
+ * @note the player ghosts are ignored.  XXX XXX XXX
  */
 static void do_cmd_knowledge_kill_count(void)
 {
@@ -7456,8 +7559,18 @@ static void do_cmd_knowledge_kill_count(void)
 }
 
 
-/*
+/*!
+ * @brief ¥â¥ó¥¹¥¿¡¼¾ðÊó¥ê¥¹¥ÈÃæ¤Î¥°¥ë¡¼¥×¤òɽ¼¨¤¹¤ë /
  * Display the object groups.
+ * @param col ³«»Ï¹Ô
+ * @param row ³«»ÏÎó
+ * @param wid É½¼¨Ê¸»ú¿ôÉý
+ * @param per_page ¥ê¥¹¥È¤Îɽ¼¨¹Ô
+ * @param grp_idx ¥°¥ë¡¼¥×¤ÎIDÇÛÎó
+ * @param group_text ¥°¥ë¡¼¥×̾¤Îʸ»úÎóÇÛÎó
+ * @param grp_cur ¸½ºß¤ÎÁªÂòID
+ * @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)
@@ -8635,8 +8748,8 @@ static void do_cmd_knowledge_features(bool *need_redraw, bool visual_only, int d
        byte char_old[F_LIT_MAX];
        byte *cur_attr_ptr, *cur_char_ptr;
 
-       C_WIPE(attr_old, F_LIT_MAX, byte);
-       C_WIPE(char_old, F_LIT_MAX, byte);
+       (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);
@@ -9277,19 +9390,28 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
                                                break;
 
                                        case QUEST_TYPE_FIND_ARTIFACT:
-                                               strcpy(name, a_name + a_info[quest[i].k_idx].name);
+                                               if (quest[i].k_idx)
+                                               {
+                                                       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);
+                                                       object_prep(q_ptr, k_idx);
+                                                       q_ptr->name1 = quest[i].k_idx;
+                                                       q_ptr->ident = IDENT_STORE;
+                                                       object_desc(name, q_ptr, OD_NAME_ONLY);
+                                               }
 #ifdef JP
-                                               sprintf(note," - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
+                                               sprintf(note,"\n   - %s¤ò¸«¤Ä¤±½Ð¤¹¡£", name);
 #else
-                                               sprintf(note," - Find out %s.", name);
+                                               sprintf(note,"\n   - Find out %s.", name);
 #endif
                                                break;
-
                                        case QUEST_TYPE_FIND_EXIT:
 #ifdef JP
-                                               sprintf(note," - Ãµº÷¤¹¤ë¡£");
+                                               sprintf(note," - ½Ð¸ý¤ËÅþ㤹¤ë¡£");
 #else
-                                               sprintf(note," - Search.");
+                                               sprintf(note," - Reach to Exit.");
 #endif
                                                break;
 
@@ -9396,12 +9518,75 @@ static void do_cmd_knowledge_quests_current(FILE *fff)
 }
 
 
+static bool do_cmd_knowledge_quests_aux(FILE *fff, int q_idx)
+{
+       char tmp_str[120];
+       char playtime_str[16];
+       quest_type* const q_ptr = &quest[q_idx];
+
+       if (is_fixed_quest_idx(q_idx))
+       {
+               /* Set the quest number temporary */
+               int old_quest = p_ptr->inside_quest;
+
+               p_ptr->inside_quest = q_idx;
+
+               /* Get the quest */
+               init_flags = INIT_NAME_ONLY;
+
+               process_dungeon_file("q_info.txt", 0, 0, 0, 0);
+
+               /* Reset the old quest number */
+               p_ptr->inside_quest = old_quest;
+
+               /* No info from "silent" quests */
+               if (q_ptr->flags & QUEST_FLAG_SILENT) return FALSE;
+       }
+
+       strnfmt(playtime_str, sizeof(playtime_str), "%02d:%02d:%02d",
+               q_ptr->comptime/(60*60), (q_ptr->comptime/60)%60, q_ptr->comptime%60);
+
+       if (!is_fixed_quest_idx(q_idx) && q_ptr->r_idx)
+       {
+               /* Print the quest info */
+               if (q_ptr->complev == 0)
+               {
+                       sprintf(tmp_str,
+                               _("  %-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);
+               }
+               else
+               {
+                       sprintf(tmp_str,
+                               _("  %-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,
+                               q_ptr->complev,
+                               playtime_str);
+               }
+       }
+       else
+       {
+               /* Print the quest info */
+               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);
+       }
+
+       fputs(tmp_str, fff);
+
+       return TRUE;
+}
+
 /*
  * Print all finished quests
  */
 void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
 {
-       char tmp_str[120];
        int i;
        int total = 0;
 
@@ -9413,71 +9598,12 @@ void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
        for (i = 1; i < max_quests; i++)
        {
                int q_idx = quest_num[i];
+               quest_type* const q_ptr = &quest[q_idx];
 
-               if (quest[q_idx].status == QUEST_STATUS_FINISHED)
+               if (q_ptr->status == QUEST_STATUS_FINISHED &&
+                   do_cmd_knowledge_quests_aux(fff, q_idx))
                {
-                       if (is_fixed_quest_idx(q_idx))
-                       {
-                               /* Set the quest number temporary */
-                               int old_quest = p_ptr->inside_quest;
-
-                               p_ptr->inside_quest = q_idx;
-
-                               /* Get the quest */
-                               init_flags = INIT_NAME_ONLY;
-
-                               process_dungeon_file("q_info.txt", 0, 0, 0, 0);
-
-                               /* Reset the old quest number */
-                               p_ptr->inside_quest = old_quest;
-
-                               /* No info from "silent" quests */
-                               if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
-                       }
-
-                       total++;
-
-                       if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
-                       {
-                               /* Print the quest info */
-
-                               if (quest[q_idx].complev == 0)
-                               {
-                                       sprintf(tmp_str,
-#ifdef JP
-                                               "  %-40s (%3d³¬)            -   ÉÔÀᄀ\n",
-#else
-                                               "  %-40s (Dungeon level: %3d) - (Cancelled)\n",
-#endif
-                                               r_name+r_info[quest[q_idx].r_idx].name,
-                                               quest[q_idx].level);
-                               }
-                               else
-                               {
-                                       sprintf(tmp_str,
-#ifdef JP
-                                               "  %-40s (%3d³¬)            - ¥ì¥Ù¥ë%2d\n",
-#else
-                                               "  %-40s (Dungeon level: %3d) - level %2d\n",
-#endif
-                                               r_name+r_info[quest[q_idx].r_idx].name,
-                                               quest[q_idx].level,
-                                               quest[q_idx].complev);
-                               }
-                       }
-                       else
-                       {
-                               /* Print the quest info */
-#ifdef JP
-                               sprintf(tmp_str, "  %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
-                                       quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
-#else
-                               sprintf(tmp_str, "  %-40s (Danger  level: %3d) - level %2d\n",
-                                       quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
-#endif
-                       }
-
-                       fputs(tmp_str, fff);
+                       ++ total;
                }
        }
 #ifdef JP
@@ -9493,7 +9619,6 @@ void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
  */
 void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
 {
-       char tmp_str[120];
        int i;
        int total = 0;
 
@@ -9505,53 +9630,12 @@ void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
        for (i = 1; i < max_quests; i++)
        {
                int q_idx = quest_num[i];
+               quest_type* const q_ptr = &quest[q_idx];
 
-               if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
+               if (((q_ptr->status == QUEST_STATUS_FAILED_DONE) || (q_ptr->status == QUEST_STATUS_FAILED)) &&
+                   do_cmd_knowledge_quests_aux(fff, q_idx))
                {
-                       if (is_fixed_quest_idx(q_idx))
-                       {
-                               /* Set the quest number temporary */
-                               int old_quest = p_ptr->inside_quest;
-
-                               p_ptr->inside_quest = q_idx;
-
-                               /* Get the quest text */
-                               init_flags = INIT_NAME_ONLY;
-
-                               process_dungeon_file("q_info.txt", 0, 0, 0, 0);
-
-                               /* Reset the old quest number */
-                               p_ptr->inside_quest = old_quest;
-
-                               /* No info from "silent" quests */
-                               if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
-                       }
-
-                       total++;
-
-                       if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
-                       {
-                               /* Print the quest info */
-#ifdef JP
-                               sprintf(tmp_str, "  %-40s (%3d³¬)            - ¥ì¥Ù¥ë%2d\n",
-                                       r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
-#else
-                               sprintf(tmp_str, "  %-40s (Dungeon level: %3d) - level %2d\n",
-                                       r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
-#endif
-                       }
-                       else
-                       {
-                               /* Print the quest info */
-#ifdef JP
-                               sprintf(tmp_str, "  %-40s (´í¸±ÅÙ:%3d³¬ÁêÅö) - ¥ì¥Ù¥ë%2d\n",
-                                       quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
-#else
-                               sprintf(tmp_str, "  %-40s (Danger  level: %3d) - level %2d\n",
-                                       quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
-#endif
-                       }
-                       fputs(tmp_str, fff);
+                       ++ total;
                }
        }
 #ifdef JP
@@ -9613,10 +9697,7 @@ bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
        /* Unused */
        (void)v;
 
-       if (qa->complev < qb->complev) return TRUE;
-       if (qa->complev > qb->complev) return FALSE;
-       if (qa->level <= qb->level) return TRUE;
-       return FALSE;
+       return (qa->comptime <= qb->comptime);
 }
 
 void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)