OSDN Git Service

Remove Dwarven-Ego randomly add Con process.
[hengband/hengband.git] / src / cmd4.c
index 3431bcc..ca578a2 100644 (file)
@@ -8635,8 +8635,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);
@@ -9405,12 +9405,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;
 
@@ -9422,71 +9485,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
@@ -9502,7 +9506,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;
 
@@ -9514,53 +9517,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
@@ -9622,10 +9584,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)