• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revisionaa1f6cd12c92d5effb6e72fcd2a080561c32381d (tree)
Time2003-06-05 23:52:37
Authornothere <nothere@0568...>
Commiternothere

Log Message

クエスト情報を'Q'で表示する部分とダンプにクエスト情報を表示する部分
で共通な部分を関数にまとめた. また, 達成した/失敗したクエストはダンプ
と同様に, '
Q'でも達成時/失敗時レベルでソートして表記するように変更.

Change Summary

Incremental Difference

--- a/src/cmd4.c
+++ b/src/cmd4.c
@@ -8615,12 +8615,10 @@ static void do_cmd_knowledge_stat(void)
86158615
86168616
86178617 /*
8618- * Print quest status of all active quests
8618+ * Print all active quests
86198619 */
8620-static void do_cmd_knowledge_quests(void)
8620+static void do_cmd_knowledge_quests_current(FILE *fff)
86218621 {
8622- FILE *fff;
8623- char file_name[1024];
86248622 char tmp_str[120];
86258623 char rand_tmp_str[120] = "\0";
86268624 char name[80];
@@ -8629,18 +8627,6 @@ static void do_cmd_knowledge_quests(void)
86298627 int rand_level = 100;
86308628 int total = 0;
86318629
8632- /* Open a new file */
8633- fff = my_fopen_temp(file_name, 1024);
8634- if (!fff) {
8635-#ifdef JP
8636- msg_format("一時ファイル %s を作成できませんでした。", file_name);
8637-#else
8638- msg_format("Failed to create temporary file %s.", file_name);
8639-#endif
8640- msg_print(NULL);
8641- return;
8642- }
8643-
86448630 #ifdef JP
86458631 fprintf(fff, "《遂行中のクエスト》\n");
86468632 #else
@@ -8649,21 +8635,16 @@ static void do_cmd_knowledge_quests(void)
86498635
86508636 for (i = 1; i < max_quests; i++)
86518637 {
8652- if (quest[i].status == QUEST_STATUS_TAKEN || quest[i].status == QUEST_STATUS_COMPLETED)
8638+ if ((quest[i].status == QUEST_STATUS_TAKEN) || (quest[i].status == QUEST_STATUS_COMPLETED))
86538639 {
8654- int old_quest;
8640+ /* Set the quest number temporary */
8641+ int old_quest = p_ptr->inside_quest;
86558642 int j;
86568643
86578644 /* Clear the text */
8658- for (j = 0; j < 10; j++)
8659- {
8660- quest_text[j][0] = '\0';
8661- }
8662-
8645+ for (j = 0; j < 10; j++) quest_text[j][0] = '\0';
86638646 quest_text_line = 0;
86648647
8665- /* Set the quest number temporary */
8666- old_quest = p_ptr->inside_quest;
86678648 p_ptr->inside_quest = i;
86688649
86698650 /* Get the quest text */
@@ -8685,17 +8666,21 @@ static void do_cmd_knowledge_quests(void)
86858666
86868667 if (quest[i].status == QUEST_STATUS_TAKEN)
86878668 {
8688- if (quest[i].type == QUEST_TYPE_KILL_LEVEL || quest[i].type == QUEST_TYPE_KILL_ANY_LEVEL)
8669+ switch (quest[i].type)
86898670 {
8671+ case QUEST_TYPE_KILL_LEVEL:
8672+ case QUEST_TYPE_KILL_ANY_LEVEL:
86908673 r_ptr = &r_info[quest[i].r_idx];
86918674 strcpy(name, r_name + r_ptr->name);
86928675 if (quest[i].max_num > 1)
86938676 {
86948677 #ifdef JP
8695- sprintf(note," - %d 体の%sを倒す。(あと %d 体)",quest[i].max_num, name, quest[i].max_num-quest[i].cur_num);
8678+ sprintf(note," - %d 体の%sを倒す。(あと %d 体)",
8679+ quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
86968680 #else
86978681 plural_aux(name);
8698- sprintf(note," - kill %d %s, have killed %d.",quest[i].max_num, name, quest[i].cur_num);
8682+ sprintf(note," - kill %d %s, have killed %d.",
8683+ quest[i].max_num, name, quest[i].cur_num);
86998684 #endif
87008685 }
87018686 else
@@ -8704,44 +8689,51 @@ static void do_cmd_knowledge_quests(void)
87048689 #else
87058690 sprintf(note," - kill %s.",name);
87068691 #endif
8707- }
8708- else if (quest[i].type == QUEST_TYPE_KILL_NUMBER)
8709- {
8710-#ifdef JP
8711- sprintf(note," - %d 体のモンスターを倒す。(あと %d 体)",quest[i].max_num, quest[i].max_num-quest[i].cur_num);
8712-#else
8713- sprintf(note," - Kill %d monsters, have killed %d.",quest[i].max_num, quest[i].cur_num);
8714-#endif
8715- }
8716- else if (quest[i].type == QUEST_TYPE_FIND_ARTIFACT)
8717- {
8692+ break;
8693+
8694+ case QUEST_TYPE_FIND_ARTIFACT:
87188695 strcpy(name, a_name + a_info[quest[i].k_idx].name);
87198696 #ifdef JP
87208697 sprintf(note," - %sを見つけ出す。", name);
87218698 #else
87228699 sprintf(note," - Find out %s.", name);
87238700 #endif
8724- }
8725- else if (quest[i].type == QUEST_TYPE_FIND_EXIT)
8701+ break;
8702+
8703+ case QUEST_TYPE_FIND_EXIT:
87268704 #ifdef JP
87278705 sprintf(note," - 探索する。");
87288706 #else
87298707 sprintf(note," - Search.");
87308708 #endif
8731- else if (quest[i].type == QUEST_TYPE_KILL_ALL)
8709+ break;
8710+
8711+ case QUEST_TYPE_KILL_NUMBER:
8712+#ifdef JP
8713+ sprintf(note," - %d 体のモンスターを倒す。(あと %d 体)",
8714+ quest[i].max_num, quest[i].max_num - quest[i].cur_num);
8715+#else
8716+ sprintf(note," - Kill %d monsters, have killed %d.",
8717+ quest[i].max_num, quest[i].cur_num);
8718+#endif
8719+ break;
8720+
8721+ case QUEST_TYPE_KILL_ALL:
87328722 #ifdef JP
87338723 sprintf(note," - 全てのモンスターを倒す。");
87348724 #else
87358725 sprintf(note," - Kill all monsters.");
87368726 #endif
8727+ break;
8728+ }
87378729 }
87388730
87398731 /* Print the quest info */
87408732 #ifdef JP
8741- sprintf(tmp_str, "%s (危険度:%d階相当)%s\n",
8733+ sprintf(tmp_str, " %s (危険度:%d階相当)%s\n",
87428734 quest[i].name, quest[i].level, note);
87438735 #else
8744- sprintf(tmp_str, "%s (Danger level: %d)%s\n",
8736+ sprintf(tmp_str, " %s (Danger level: %d)%s\n",
87458737 quest[i].name, quest[i].level, note);
87468738 #endif
87478739
@@ -8750,11 +8742,10 @@ static void do_cmd_knowledge_quests(void)
87508742 if (quest[i].status == QUEST_STATUS_COMPLETED)
87518743 {
87528744 #ifdef JP
8753- sprintf(tmp_str, " クエスト達成 - まだ報酬を受けとってない。\n");
8745+ sprintf(tmp_str, " クエスト達成 - まだ報酬を受けとってない。\n");
87548746 #else
8755- sprintf(tmp_str, " Quest Completed - Unrewarded\n");
8747+ sprintf(tmp_str, " Quest Completed - Unrewarded\n");
87568748 #endif
8757-
87588749 fprintf(fff, tmp_str);
87598750 }
87608751 else
@@ -8763,13 +8754,12 @@ static void do_cmd_knowledge_quests(void)
87638754
87648755 while (quest_text[j][0] && j < 10)
87658756 {
8766- fprintf(fff, " %s\n", quest_text[j]);
8757+ fprintf(fff, " %s\n", quest_text[j]);
87678758 j++;
87688759 }
87698760 }
87708761 }
8771- else if ((quest[i].type == QUEST_TYPE_RANDOM) &&
8772- (quest[i].level < rand_level))
8762+ else if (quest[i].level < rand_level) /* QUEST_TYPE_RANDOM */
87738763 {
87748764 /* New random */
87758765 rand_level = quest[i].level;
@@ -8783,13 +8773,13 @@ static void do_cmd_knowledge_quests(void)
87838773 if (quest[i].max_num > 1)
87848774 {
87858775 #ifdef JP
8786- sprintf(rand_tmp_str,"%s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n",
8776+ sprintf(rand_tmp_str," %s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n",
87878777 quest[i].name, quest[i].level,
8788- quest[i].max_num, name, quest[i].max_num-quest[i].cur_num);
8778+ quest[i].max_num, name, quest[i].max_num - quest[i].cur_num);
87898779 #else
87908780 plural_aux(name);
87918781
8792- sprintf(rand_tmp_str,"%s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
8782+ sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %d %s, have killed %d.\n",
87938783 quest[i].name, quest[i].level,
87948784 quest[i].max_num, name, quest[i].cur_num);
87958785 #endif
@@ -8797,10 +8787,10 @@ static void do_cmd_knowledge_quests(void)
87978787 else
87988788 {
87998789 #ifdef JP
8800- sprintf(rand_tmp_str,"%s (%d 階) - %sを倒す。\n",
8790+ sprintf(rand_tmp_str," %s (%d 階) - %sを倒す。\n",
88018791 quest[i].name, quest[i].level, name);
88028792 #else
8803- sprintf(rand_tmp_str,"%s (Dungeon level: %d)\n Kill %s.\n",
8793+ sprintf(rand_tmp_str," %s (Dungeon level: %d)\n Kill %s.\n",
88048794 quest[i].name, quest[i].level, name);
88058795 #endif
88068796 }
@@ -8813,28 +8803,39 @@ static void do_cmd_knowledge_quests(void)
88138803 if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str);
88148804
88158805 #ifdef JP
8816- if (!total) fprintf(fff, "なし\n");
8806+ if (!total) fprintf(fff, " なし\n");
88178807 #else
8818- if (!total) fprintf(fff, "Nothing.\n");
8808+ if (!total) fprintf(fff, " Nothing.\n");
88198809 #endif
8810+}
8811+
8812+
8813+/*
8814+ * Print all finished quests
8815+ */
8816+void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[])
8817+{
8818+ char tmp_str[120];
8819+ int i;
8820+ int total = 0;
88208821
88218822 #ifdef JP
8822- fprintf(fff, "\n《達成したクエスト》\n");
8823+ fprintf(fff, "《達成したクエスト》\n");
88238824 #else
8824- fprintf(fff, "\n< Completed Quest >\n");
8825+ fprintf(fff, "< Completed Quest >\n");
88258826 #endif
8826- total = 0;
88278827 for (i = 1; i < max_quests; i++)
88288828 {
8829- if (quest[i].status == QUEST_STATUS_FINISHED)
8829+ int q_idx = quest_num[i];
8830+
8831+ if (quest[q_idx].status == QUEST_STATUS_FINISHED)
88308832 {
8831- if (is_fixed_quest_idx(i))
8833+ if (is_fixed_quest_idx(q_idx))
88328834 {
8833- int old_quest;
8834-
88358835 /* Set the quest number temporary */
8836- old_quest = p_ptr->inside_quest;
8837- p_ptr->inside_quest = i;
8836+ int old_quest = p_ptr->inside_quest;
8837+
8838+ p_ptr->inside_quest = q_idx;
88388839
88398840 /* Get the quest */
88408841 init_flags = INIT_ASSIGN;
@@ -8845,48 +8846,48 @@ static void do_cmd_knowledge_quests(void)
88458846 p_ptr->inside_quest = old_quest;
88468847
88478848 /* No info from "silent" quests */
8848- if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8849+ if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
88498850 }
88508851
88518852 total++;
88528853
8853- if (!is_fixed_quest_idx(i) && quest[i].r_idx)
8854+ if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
88548855 {
88558856 /* Print the quest info */
88568857
8857- if (quest[i].complev == 0)
8858+ if (quest[q_idx].complev == 0)
88588859 {
8859- sprintf(tmp_str,
8860+ sprintf(tmp_str,
88608861 #ifdef JP
8861- "%s (%d階) - 不戦勝\n",
8862+ " %s (%d階) - 不戦勝\n",
88628863 #else
8863- "%s (Dungeon level: %d) - (Cancelled)\n",
8864+ " %s (Dungeon level: %d) - (Cancelled)\n",
88648865 #endif
8865- r_name+r_info[quest[i].r_idx].name,
8866- quest[i].level);
8866+ r_name+r_info[quest[q_idx].r_idx].name,
8867+ quest[q_idx].level);
88678868 }
88688869 else
88698870 {
8870- sprintf(tmp_str,
8871+ sprintf(tmp_str,
88718872 #ifdef JP
8872- "%s (%d階) - レベル%d\n",
8873+ " %s (%d階) - レベル%d\n",
88738874 #else
8874- "%s (Dungeon level: %d) - level %d\n",
8875+ " %s (Dungeon level: %d) - level %d\n",
88758876 #endif
8876- r_name+r_info[quest[i].r_idx].name,
8877- quest[i].level,
8878- quest[i].complev);
8877+ r_name+r_info[quest[q_idx].r_idx].name,
8878+ quest[q_idx].level,
8879+ quest[q_idx].complev);
88798880 }
88808881 }
88818882 else
88828883 {
88838884 /* Print the quest info */
88848885 #ifdef JP
8885- sprintf(tmp_str, "%s (危険度:%d階相当) - レベル%d\n",
8886- quest[i].name, quest[i].level, quest[i].complev);
8886+ sprintf(tmp_str, " %s (危険度:%d階相当) - レベル%d\n",
8887+ quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
88878888 #else
8888- sprintf(tmp_str, "%s (Danger level: %d) - level %d\n",
8889- quest[i].name, quest[i].level, quest[i].complev);
8889+ sprintf(tmp_str, " %s (Danger level: %d) - level %d\n",
8890+ quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
88908891 #endif
88918892 }
88928893
@@ -8894,28 +8895,39 @@ static void do_cmd_knowledge_quests(void)
88948895 }
88958896 }
88968897 #ifdef JP
8897- if (!total) fprintf(fff, "なし\n");
8898+ if (!total) fprintf(fff, " なし\n");
88988899 #else
8899- if (!total) fprintf(fff, "Nothing.\n");
8900+ if (!total) fprintf(fff, " Nothing.\n");
89008901 #endif
8902+}
8903+
8904+
8905+/*
8906+ * Print all failed quests
8907+ */
8908+void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[])
8909+{
8910+ char tmp_str[120];
8911+ int i;
8912+ int total = 0;
89018913
89028914 #ifdef JP
8903- fprintf(fff, "\n《失敗したクエスト》\n");
8915+ fprintf(fff, "《失敗したクエスト》\n");
89048916 #else
8905- fprintf(fff, "\n< Failed Quest >\n");
8917+ fprintf(fff, "< Failed Quest >\n");
89068918 #endif
8907- total = 0;
89088919 for (i = 1; i < max_quests; i++)
89098920 {
8910- if ((quest[i].status == QUEST_STATUS_FAILED_DONE) || (quest[i].status == QUEST_STATUS_FAILED))
8921+ int q_idx = quest_num[i];
8922+
8923+ if ((quest[q_idx].status == QUEST_STATUS_FAILED_DONE) || (quest[q_idx].status == QUEST_STATUS_FAILED))
89118924 {
8912- if (is_fixed_quest_idx(i))
8925+ if (is_fixed_quest_idx(q_idx))
89138926 {
8914- int old_quest;
8915-
89168927 /* Set the quest number temporary */
8917- old_quest = p_ptr->inside_quest;
8918- p_ptr->inside_quest = i;
8928+ int old_quest = p_ptr->inside_quest;
8929+
8930+ p_ptr->inside_quest = q_idx;
89198931
89208932 /* Get the quest text */
89218933 init_flags = INIT_ASSIGN;
@@ -8926,49 +8938,58 @@ static void do_cmd_knowledge_quests(void)
89268938 p_ptr->inside_quest = old_quest;
89278939
89288940 /* No info from "silent" quests */
8929- if (quest[i].flags & QUEST_FLAG_SILENT) continue;
8941+ if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue;
89308942 }
89318943
89328944 total++;
89338945
8934- if (!is_fixed_quest_idx(i) && quest[i].r_idx)
8946+ if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx)
89358947 {
89368948 /* Print the quest info */
89378949 #ifdef JP
8938- sprintf(tmp_str, "%s (%d階) - レベル%d\n",
8939- r_name+r_info[quest[i].r_idx].name, quest[i].level, quest[i].complev);
8950+ sprintf(tmp_str, " %s (%d階) - レベル%d\n",
8951+ r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
89408952 #else
8941- sprintf(tmp_str, "%s (Dungeon level: %d) - level %d\n",
8942- r_name+r_info[quest[i].r_idx].name, quest[i].level, quest[i].complev);
8953+ sprintf(tmp_str, " %s (Dungeon level: %d) - level %d\n",
8954+ r_name+r_info[quest[q_idx].r_idx].name, quest[q_idx].level, quest[q_idx].complev);
89438955 #endif
89448956 }
89458957 else
89468958 {
89478959 /* Print the quest info */
89488960 #ifdef JP
8949- sprintf(tmp_str, "%s (危険度:%d階相当) - レベル%d\n",
8950- quest[i].name, quest[i].level, quest[i].complev);
8961+ sprintf(tmp_str, " %s (危険度:%d階相当) - レベル%d\n",
8962+ quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
89518963 #else
8952- sprintf(tmp_str, "%s (Danger level: %d) - level %d\n",
8953- quest[i].name, quest[i].level, quest[i].complev);
8964+ sprintf(tmp_str, " %s (Danger level: %d) - level %d\n",
8965+ quest[q_idx].name, quest[q_idx].level, quest[q_idx].complev);
89548966 #endif
89558967 }
89568968 fprintf(fff, tmp_str);
89578969 }
89588970 }
89598971 #ifdef JP
8960- if (!total) fprintf(fff, "なし\n");
8972+ if (!total) fprintf(fff, " なし\n");
89618973 #else
8962- if (!total) fprintf(fff, "Nothing.\n");
8974+ if (!total) fprintf(fff, " Nothing.\n");
89638975 #endif
8976+}
8977+
8978+
8979+/*
8980+ * Print all random quests
8981+ */
8982+static void do_cmd_knowledge_quests_wiz_random(FILE *fff)
8983+{
8984+ char tmp_str[120];
8985+ int i;
8986+ int total = 0;
89648987
8965- if (p_ptr->wizard) {
89668988 #ifdef JP
8967- fprintf(fff, "\n《残りのランダムクエスト》\n");
8989+ fprintf(fff, "《残りのランダムクエスト》\n");
89688990 #else
8969- fprintf(fff, "\n< Remaining Random Quest >\n");
8991+ fprintf(fff, "< Remaining Random Quest >\n");
89708992 #endif
8971- total = 0;
89728993 for (i = 1; i < max_quests; i++)
89738994 {
89748995 /* No info from "silent" quests */
@@ -8980,21 +9001,94 @@ static void do_cmd_knowledge_quests(void)
89809001
89819002 /* Print the quest info */
89829003 #ifdef JP
8983- sprintf(tmp_str, "%s (%d階, %s)\n",
9004+ sprintf(tmp_str, " %s (%d階, %s)\n",
89849005 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
89859006 #else
8986- sprintf(tmp_str, "%s (%d, %s)\n",
9007+ sprintf(tmp_str, " %s (%d, %s)\n",
89879008 quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name);
89889009 #endif
89899010 fprintf(fff, tmp_str);
89909011 }
89919012 }
89929013 #ifdef JP
8993- if (!total) fprintf(fff, "なし\n");
9014+ if (!total) fprintf(fff, " なし\n");
89949015 #else
8995- if (!total) fprintf(fff, "Nothing.\n");
9016+ if (!total) fprintf(fff, " Nothing.\n");
89969017 #endif
8997- }
9018+}
9019+
9020+
9021+bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
9022+{
9023+ int *q_num = (int *)u;
9024+ quest_type *qa = &quest[q_num[a]];
9025+ quest_type *qb = &quest[q_num[b]];
9026+
9027+ /* Unused */
9028+ (void)v;
9029+
9030+ if (qa->complev < qb->complev) return TRUE;
9031+ if (qa->complev > qb->complev) return FALSE;
9032+ if (qa->level <= qb->level) return TRUE;
9033+ return FALSE;
9034+}
9035+
9036+void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
9037+{
9038+ int *q_num = (int *)u;
9039+ int tmp;
9040+
9041+ /* Unused */
9042+ (void)v;
9043+
9044+ tmp = q_num[a];
9045+ q_num[a] = q_num[b];
9046+ q_num[b] = tmp;
9047+}
9048+
9049+
9050+/*
9051+ * Print quest status of all active quests
9052+ */
9053+static void do_cmd_knowledge_quests(void)
9054+{
9055+ FILE *fff;
9056+ char file_name[1024];
9057+ int *quest_num, dummy, i;
9058+
9059+ /* Open a new file */
9060+ fff = my_fopen_temp(file_name, 1024);
9061+ if (!fff)
9062+ {
9063+#ifdef JP
9064+ msg_format("一時ファイル %s を作成できませんでした。", file_name);
9065+#else
9066+ msg_format("Failed to create temporary file %s.", file_name);
9067+#endif
9068+ msg_print(NULL);
9069+ return;
9070+ }
9071+
9072+ /* Allocate Memory */
9073+ C_MAKE(quest_num, max_quests, int);
9074+
9075+ /* Sort by compete level */
9076+ for (i = 1; i < max_quests; i++) quest_num[i] = i;
9077+ ang_sort_comp = ang_sort_comp_quest_num;
9078+ ang_sort_swap = ang_sort_swap_quest_num;
9079+ ang_sort(quest_num, &dummy, max_quests);
9080+
9081+ /* Dump Quest Information */
9082+ do_cmd_knowledge_quests_current(fff);
9083+ fputc('\n', fff);
9084+ do_cmd_knowledge_quests_completed(fff, quest_num);
9085+ fputc('\n', fff);
9086+ do_cmd_knowledge_quests_failed(fff, quest_num);
9087+ if (p_ptr->wizard)
9088+ {
9089+ fputc('\n', fff);
9090+ do_cmd_knowledge_quests_wiz_random(fff);
9091+ }
89989092
89999093 /* Close the file */
90009094 my_fclose(fff);
@@ -9006,11 +9100,12 @@ static void do_cmd_knowledge_quests(void)
90069100 show_file(TRUE, file_name, "Quest status", 0, 0);
90079101 #endif
90089102
9009-
90109103 /* Remove the file */
90119104 fd_kill(file_name);
9012-}
90139105
9106+ /* Free Memory */
9107+ C_KILL(quest_num, max_quests, int);
9108+}
90149109
90159110
90169111 /*
--- a/src/externs.h
+++ b/src/externs.h
@@ -669,6 +669,10 @@ extern void do_cmd_feeling(void);
669669 extern void do_cmd_load_screen(void);
670670 extern void do_cmd_save_screen_html_aux(char *filename, int message);
671671 extern void do_cmd_save_screen(void);
672+extern void do_cmd_knowledge_quests_completed(FILE *fff, int quest_num[]);
673+extern void do_cmd_knowledge_quests_failed(FILE *fff, int quest_num[]);
674+extern bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b);
675+extern void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b);
672676 extern void do_cmd_knowledge(void);
673677 extern void plural_aux(char * Name);
674678 extern void do_cmd_checkquest(void);
--- a/src/files.c
+++ b/src/files.c
@@ -3922,33 +3922,6 @@ void display_player(int mode)
39223922 }
39233923 }
39243924
3925-static bool ang_sort_comp_quest_num(vptr u, vptr v, int a, int b)
3926-{
3927- int *q_num = (int *)u;
3928- quest_type *qa = &quest[q_num[a]];
3929- quest_type *qb = &quest[q_num[b]];
3930-
3931- /* Unused */
3932- (void)v;
3933-
3934- if (qa->complev < qb->complev) return TRUE;
3935- if (qa->complev > qb->complev) return FALSE;
3936- if (qa->level <= qb->level) return TRUE;
3937- return FALSE;
3938-}
3939-
3940-static void ang_sort_swap_quest_num(vptr u, vptr v, int a, int b)
3941-{
3942- int *q_num = (int *)u;
3943- int tmp;
3944-
3945- /* Unused */
3946- (void)v;
3947-
3948- tmp = q_num[a];
3949- q_num[a] = q_num[b];
3950- q_num[b] = tmp;
3951-}
39523925
39533926 errr make_character_dump(FILE *fff)
39543927 {
@@ -3959,7 +3932,6 @@ errr make_character_dump(FILE *fff)
39593932 store_type *st_ptr;
39603933 char o_name[MAX_NLEN];
39613934 char buf[1024];
3962- int total;
39633935 int *quest_num;
39643936 int dummy;
39653937
@@ -4130,166 +4102,20 @@ errr make_character_dump(FILE *fff)
41304102 fprintf(fff, "\n [Quest information]\n");
41314103 #endif
41324104
4133-#ifdef JP
4134- fprintf(fff, "\n《達成したクエスト》\n");
4135-#else
4136- fprintf(fff, "\n< Completed Quest >\n");
4137-#endif
4138-
41394105 /* Allocate Memory */
41404106 C_MAKE(quest_num, max_quests, int);
41414107
41424108 /* Sort by compete level */
4143- for (i = 1; i < max_quests; i++)
4144- {
4145- quest_num[i] = i;
4146- }
4109+ for (i = 1; i < max_quests; i++) quest_num[i] = i;
41474110 ang_sort_comp = ang_sort_comp_quest_num;
41484111 ang_sort_swap = ang_sort_swap_quest_num;
41494112 ang_sort(quest_num, &dummy, max_quests);
41504113
41514114 /* Dump Quest Information */
4152- total = 0;
4153- for (i = 1; i < max_quests; i++)
4154- {
4155- int num = quest_num[i];
4156-
4157- if (quest[num].status == QUEST_STATUS_FINISHED)
4158- {
4159- if (is_fixed_quest_idx(num))
4160- {
4161- int old_quest;
4162-
4163- /* Set the quest number temporary */
4164- old_quest = p_ptr->inside_quest;
4165- p_ptr->inside_quest = num;
4166-
4167- /* Get the quest */
4168- init_flags = INIT_ASSIGN;
4169-
4170- process_dungeon_file("q_info.txt", 0, 0, 0, 0);
4171-
4172- /* Reset the old quest number */
4173- p_ptr->inside_quest = old_quest;
4174-
4175- /* No info from "silent" quests */
4176- if (quest[num].flags & QUEST_FLAG_SILENT) continue;
4177- }
4178-
4179- total++;
4180-
4181- if (!is_fixed_quest_idx(num) && quest[num].r_idx)
4182- {
4183- /* Print the quest info */
4184-
4185- if (quest[num].complev == 0)
4186- {
4187- fprintf(fff,
4188-#ifdef JP
4189- " %s (%d階) - 不戦勝\n",
4190-#else
4191- " %s (Dungeon level: %d) - (Cancelled)\n",
4192-#endif
4193- r_name+r_info[quest[num].r_idx].name,
4194- quest[num].level);
4195- }
4196- else
4197- {
4198- fprintf(fff,
4199-#ifdef JP
4200- " %s (%d階) - レベル%d\n",
4201-#else
4202- " %s (Dungeon level: %d) - level %d\n",
4203-#endif
4204- r_name+r_info[quest[num].r_idx].name,
4205- quest[num].level,
4206- quest[num].complev);
4207- }
4208- }
4209- else
4210- {
4211- /* Print the quest info */
4212-#ifdef JP
4213- fprintf(fff, " %s (危険度:%d階相当) - レベル%d\n",
4214-#else
4215- fprintf(fff, " %s (Danger level: %d) - level %d\n",
4216-#endif
4217-
4218- quest[num].name, quest[num].level, quest[num].complev);
4219- }
4220- }
4221- }
4222-#ifdef JP
4223- if (!total) fprintf(fff, " なし\n");
4224-#else
4225- if (!total) fprintf(fff, " Nothing.\n");
4226-#endif
4227-
4228-#ifdef JP
4229- fprintf(fff, "\n《失敗したクエスト》\n");
4230-#else
4231- fprintf(fff, "\n< Failed Quest >\n");
4232-#endif
4233- total = 0;
4234- for (i = 1; i < max_quests; i++)
4235- {
4236- int num = quest_num[i];
4237-
4238- if ((quest[num].status == QUEST_STATUS_FAILED_DONE) || (quest[num].status == QUEST_STATUS_FAILED))
4239- {
4240- if (is_fixed_quest_idx(num))
4241- {
4242- int old_quest;
4243-
4244- /* Set the quest number temporary */
4245- old_quest = p_ptr->inside_quest;
4246- p_ptr->inside_quest = num;
4247-
4248- /* Get the quest text */
4249- init_flags = INIT_ASSIGN;
4250-
4251- process_dungeon_file("q_info.txt", 0, 0, 0, 0);
4252-
4253- /* Reset the old quest number */
4254- p_ptr->inside_quest = old_quest;
4255-
4256- /* No info from "silent" quests */
4257- if (quest[num].flags & QUEST_FLAG_SILENT) continue;
4258- }
4259-
4260- total++;
4261-
4262- if (!is_fixed_quest_idx(num) && quest[num].r_idx)
4263- {
4264- /* Print the quest info */
4265-#ifdef JP
4266- fprintf(fff, " %s (%d階) - レベル%d\n",
4267-#else
4268- fprintf(fff, " %s (Dungeon level: %d) - level %d\n",
4269-#endif
4270-
4271- r_name+r_info[quest[num].r_idx].name, quest[num].level, quest[num].complev);
4272- }
4273- else
4274- {
4275- /* Print the quest info */
4276-#ifdef JP
4277- fprintf(fff, " %s (危険度:%d階相当) - レベル%d\n",
4278-#else
4279- fprintf(fff, " %s (Danger level: %d) - level %d\n",
4280-#endif
4281-
4282- quest[num].name, quest[num].level, quest[num].complev);
4283- }
4284- }
4285- }
4286-
4287-#ifdef JP
4288- if (!total) fprintf(fff, " なし\n");
4289-#else
4290- if (!total) fprintf(fff, " Nothing.\n");
4291-#endif
4292- fprintf(fff, "\n");
4115+ fputc('\n', fff);
4116+ do_cmd_knowledge_quests_completed(fff, quest_num);
4117+ fputc('\n', fff);
4118+ do_cmd_knowledge_quests_failed(fff, quest_num);
42934119
42944120 /* Free Memory */
42954121 C_KILL(quest_num, max_quests, int);
Show on old repository browser