変愚蛮怒のメインリポジトリです
Revision | aa1f6cd12c92d5effb6e72fcd2a080561c32381d (tree) |
---|---|
Time | 2003-06-05 23:52:37 |
Author | nothere <nothere@0568...> |
Commiter | nothere |
クエスト情報を'Q'で表示する部分とダンプにクエスト情報を表示する部分
で共通な部分を関数にまとめた. また, 達成した/失敗したクエストはダンプ
と同様に, 'Q'でも達成時/失敗時レベルでソートして表記するように変更.
@@ -8615,12 +8615,10 @@ static void do_cmd_knowledge_stat(void) | ||
8615 | 8615 | |
8616 | 8616 | |
8617 | 8617 | /* |
8618 | - * Print quest status of all active quests | |
8618 | + * Print all active quests | |
8619 | 8619 | */ |
8620 | -static void do_cmd_knowledge_quests(void) | |
8620 | +static void do_cmd_knowledge_quests_current(FILE *fff) | |
8621 | 8621 | { |
8622 | - FILE *fff; | |
8623 | - char file_name[1024]; | |
8624 | 8622 | char tmp_str[120]; |
8625 | 8623 | char rand_tmp_str[120] = "\0"; |
8626 | 8624 | char name[80]; |
@@ -8629,18 +8627,6 @@ static void do_cmd_knowledge_quests(void) | ||
8629 | 8627 | int rand_level = 100; |
8630 | 8628 | int total = 0; |
8631 | 8629 | |
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 | - | |
8644 | 8630 | #ifdef JP |
8645 | 8631 | fprintf(fff, "《遂行中のクエスト》\n"); |
8646 | 8632 | #else |
@@ -8649,21 +8635,16 @@ static void do_cmd_knowledge_quests(void) | ||
8649 | 8635 | |
8650 | 8636 | for (i = 1; i < max_quests; i++) |
8651 | 8637 | { |
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)) | |
8653 | 8639 | { |
8654 | - int old_quest; | |
8640 | + /* Set the quest number temporary */ | |
8641 | + int old_quest = p_ptr->inside_quest; | |
8655 | 8642 | int j; |
8656 | 8643 | |
8657 | 8644 | /* 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'; | |
8663 | 8646 | quest_text_line = 0; |
8664 | 8647 | |
8665 | - /* Set the quest number temporary */ | |
8666 | - old_quest = p_ptr->inside_quest; | |
8667 | 8648 | p_ptr->inside_quest = i; |
8668 | 8649 | |
8669 | 8650 | /* Get the quest text */ |
@@ -8685,17 +8666,21 @@ static void do_cmd_knowledge_quests(void) | ||
8685 | 8666 | |
8686 | 8667 | if (quest[i].status == QUEST_STATUS_TAKEN) |
8687 | 8668 | { |
8688 | - if (quest[i].type == QUEST_TYPE_KILL_LEVEL || quest[i].type == QUEST_TYPE_KILL_ANY_LEVEL) | |
8669 | + switch (quest[i].type) | |
8689 | 8670 | { |
8671 | + case QUEST_TYPE_KILL_LEVEL: | |
8672 | + case QUEST_TYPE_KILL_ANY_LEVEL: | |
8690 | 8673 | r_ptr = &r_info[quest[i].r_idx]; |
8691 | 8674 | strcpy(name, r_name + r_ptr->name); |
8692 | 8675 | if (quest[i].max_num > 1) |
8693 | 8676 | { |
8694 | 8677 | #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); | |
8696 | 8680 | #else |
8697 | 8681 | 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); | |
8699 | 8684 | #endif |
8700 | 8685 | } |
8701 | 8686 | else |
@@ -8704,44 +8689,51 @@ static void do_cmd_knowledge_quests(void) | ||
8704 | 8689 | #else |
8705 | 8690 | sprintf(note," - kill %s.",name); |
8706 | 8691 | #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: | |
8718 | 8695 | strcpy(name, a_name + a_info[quest[i].k_idx].name); |
8719 | 8696 | #ifdef JP |
8720 | 8697 | sprintf(note," - %sを見つけ出す。", name); |
8721 | 8698 | #else |
8722 | 8699 | sprintf(note," - Find out %s.", name); |
8723 | 8700 | #endif |
8724 | - } | |
8725 | - else if (quest[i].type == QUEST_TYPE_FIND_EXIT) | |
8701 | + break; | |
8702 | + | |
8703 | + case QUEST_TYPE_FIND_EXIT: | |
8726 | 8704 | #ifdef JP |
8727 | 8705 | sprintf(note," - 探索する。"); |
8728 | 8706 | #else |
8729 | 8707 | sprintf(note," - Search."); |
8730 | 8708 | #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: | |
8732 | 8722 | #ifdef JP |
8733 | 8723 | sprintf(note," - 全てのモンスターを倒す。"); |
8734 | 8724 | #else |
8735 | 8725 | sprintf(note," - Kill all monsters."); |
8736 | 8726 | #endif |
8727 | + break; | |
8728 | + } | |
8737 | 8729 | } |
8738 | 8730 | |
8739 | 8731 | /* Print the quest info */ |
8740 | 8732 | #ifdef JP |
8741 | - sprintf(tmp_str, "%s (危険度:%d階相当)%s\n", | |
8733 | + sprintf(tmp_str, " %s (危険度:%d階相当)%s\n", | |
8742 | 8734 | quest[i].name, quest[i].level, note); |
8743 | 8735 | #else |
8744 | - sprintf(tmp_str, "%s (Danger level: %d)%s\n", | |
8736 | + sprintf(tmp_str, " %s (Danger level: %d)%s\n", | |
8745 | 8737 | quest[i].name, quest[i].level, note); |
8746 | 8738 | #endif |
8747 | 8739 |
@@ -8750,11 +8742,10 @@ static void do_cmd_knowledge_quests(void) | ||
8750 | 8742 | if (quest[i].status == QUEST_STATUS_COMPLETED) |
8751 | 8743 | { |
8752 | 8744 | #ifdef JP |
8753 | - sprintf(tmp_str, " クエスト達成 - まだ報酬を受けとってない。\n"); | |
8745 | + sprintf(tmp_str, " クエスト達成 - まだ報酬を受けとってない。\n"); | |
8754 | 8746 | #else |
8755 | - sprintf(tmp_str, " Quest Completed - Unrewarded\n"); | |
8747 | + sprintf(tmp_str, " Quest Completed - Unrewarded\n"); | |
8756 | 8748 | #endif |
8757 | - | |
8758 | 8749 | fprintf(fff, tmp_str); |
8759 | 8750 | } |
8760 | 8751 | else |
@@ -8763,13 +8754,12 @@ static void do_cmd_knowledge_quests(void) | ||
8763 | 8754 | |
8764 | 8755 | while (quest_text[j][0] && j < 10) |
8765 | 8756 | { |
8766 | - fprintf(fff, " %s\n", quest_text[j]); | |
8757 | + fprintf(fff, " %s\n", quest_text[j]); | |
8767 | 8758 | j++; |
8768 | 8759 | } |
8769 | 8760 | } |
8770 | 8761 | } |
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 */ | |
8773 | 8763 | { |
8774 | 8764 | /* New random */ |
8775 | 8765 | rand_level = quest[i].level; |
@@ -8783,13 +8773,13 @@ static void do_cmd_knowledge_quests(void) | ||
8783 | 8773 | if (quest[i].max_num > 1) |
8784 | 8774 | { |
8785 | 8775 | #ifdef JP |
8786 | - sprintf(rand_tmp_str,"%s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n", | |
8776 | + sprintf(rand_tmp_str," %s (%d 階) - %d 体の%sを倒す。(あと %d 体)\n", | |
8787 | 8777 | 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); | |
8789 | 8779 | #else |
8790 | 8780 | plural_aux(name); |
8791 | 8781 | |
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", | |
8793 | 8783 | quest[i].name, quest[i].level, |
8794 | 8784 | quest[i].max_num, name, quest[i].cur_num); |
8795 | 8785 | #endif |
@@ -8797,10 +8787,10 @@ static void do_cmd_knowledge_quests(void) | ||
8797 | 8787 | else |
8798 | 8788 | { |
8799 | 8789 | #ifdef JP |
8800 | - sprintf(rand_tmp_str,"%s (%d 階) - %sを倒す。\n", | |
8790 | + sprintf(rand_tmp_str," %s (%d 階) - %sを倒す。\n", | |
8801 | 8791 | quest[i].name, quest[i].level, name); |
8802 | 8792 | #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", | |
8804 | 8794 | quest[i].name, quest[i].level, name); |
8805 | 8795 | #endif |
8806 | 8796 | } |
@@ -8813,28 +8803,39 @@ static void do_cmd_knowledge_quests(void) | ||
8813 | 8803 | if (rand_tmp_str[0]) fprintf(fff, rand_tmp_str); |
8814 | 8804 | |
8815 | 8805 | #ifdef JP |
8816 | - if (!total) fprintf(fff, "なし\n"); | |
8806 | + if (!total) fprintf(fff, " なし\n"); | |
8817 | 8807 | #else |
8818 | - if (!total) fprintf(fff, "Nothing.\n"); | |
8808 | + if (!total) fprintf(fff, " Nothing.\n"); | |
8819 | 8809 | #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; | |
8820 | 8821 | |
8821 | 8822 | #ifdef JP |
8822 | - fprintf(fff, "\n《達成したクエスト》\n"); | |
8823 | + fprintf(fff, "《達成したクエスト》\n"); | |
8823 | 8824 | #else |
8824 | - fprintf(fff, "\n< Completed Quest >\n"); | |
8825 | + fprintf(fff, "< Completed Quest >\n"); | |
8825 | 8826 | #endif |
8826 | - total = 0; | |
8827 | 8827 | for (i = 1; i < max_quests; i++) |
8828 | 8828 | { |
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) | |
8830 | 8832 | { |
8831 | - if (is_fixed_quest_idx(i)) | |
8833 | + if (is_fixed_quest_idx(q_idx)) | |
8832 | 8834 | { |
8833 | - int old_quest; | |
8834 | - | |
8835 | 8835 | /* 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; | |
8838 | 8839 | |
8839 | 8840 | /* Get the quest */ |
8840 | 8841 | init_flags = INIT_ASSIGN; |
@@ -8845,48 +8846,48 @@ static void do_cmd_knowledge_quests(void) | ||
8845 | 8846 | p_ptr->inside_quest = old_quest; |
8846 | 8847 | |
8847 | 8848 | /* No info from "silent" quests */ |
8848 | - if (quest[i].flags & QUEST_FLAG_SILENT) continue; | |
8849 | + if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue; | |
8849 | 8850 | } |
8850 | 8851 | |
8851 | 8852 | total++; |
8852 | 8853 | |
8853 | - if (!is_fixed_quest_idx(i) && quest[i].r_idx) | |
8854 | + if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx) | |
8854 | 8855 | { |
8855 | 8856 | /* Print the quest info */ |
8856 | 8857 | |
8857 | - if (quest[i].complev == 0) | |
8858 | + if (quest[q_idx].complev == 0) | |
8858 | 8859 | { |
8859 | - sprintf(tmp_str, | |
8860 | + sprintf(tmp_str, | |
8860 | 8861 | #ifdef JP |
8861 | - "%s (%d階) - 不戦勝\n", | |
8862 | + " %s (%d階) - 不戦勝\n", | |
8862 | 8863 | #else |
8863 | - "%s (Dungeon level: %d) - (Cancelled)\n", | |
8864 | + " %s (Dungeon level: %d) - (Cancelled)\n", | |
8864 | 8865 | #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); | |
8867 | 8868 | } |
8868 | 8869 | else |
8869 | 8870 | { |
8870 | - sprintf(tmp_str, | |
8871 | + sprintf(tmp_str, | |
8871 | 8872 | #ifdef JP |
8872 | - "%s (%d階) - レベル%d\n", | |
8873 | + " %s (%d階) - レベル%d\n", | |
8873 | 8874 | #else |
8874 | - "%s (Dungeon level: %d) - level %d\n", | |
8875 | + " %s (Dungeon level: %d) - level %d\n", | |
8875 | 8876 | #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); | |
8879 | 8880 | } |
8880 | 8881 | } |
8881 | 8882 | else |
8882 | 8883 | { |
8883 | 8884 | /* Print the quest info */ |
8884 | 8885 | #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); | |
8887 | 8888 | #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); | |
8890 | 8891 | #endif |
8891 | 8892 | } |
8892 | 8893 |
@@ -8894,28 +8895,39 @@ static void do_cmd_knowledge_quests(void) | ||
8894 | 8895 | } |
8895 | 8896 | } |
8896 | 8897 | #ifdef JP |
8897 | - if (!total) fprintf(fff, "なし\n"); | |
8898 | + if (!total) fprintf(fff, " なし\n"); | |
8898 | 8899 | #else |
8899 | - if (!total) fprintf(fff, "Nothing.\n"); | |
8900 | + if (!total) fprintf(fff, " Nothing.\n"); | |
8900 | 8901 | #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; | |
8901 | 8913 | |
8902 | 8914 | #ifdef JP |
8903 | - fprintf(fff, "\n《失敗したクエスト》\n"); | |
8915 | + fprintf(fff, "《失敗したクエスト》\n"); | |
8904 | 8916 | #else |
8905 | - fprintf(fff, "\n< Failed Quest >\n"); | |
8917 | + fprintf(fff, "< Failed Quest >\n"); | |
8906 | 8918 | #endif |
8907 | - total = 0; | |
8908 | 8919 | for (i = 1; i < max_quests; i++) |
8909 | 8920 | { |
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)) | |
8911 | 8924 | { |
8912 | - if (is_fixed_quest_idx(i)) | |
8925 | + if (is_fixed_quest_idx(q_idx)) | |
8913 | 8926 | { |
8914 | - int old_quest; | |
8915 | - | |
8916 | 8927 | /* 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; | |
8919 | 8931 | |
8920 | 8932 | /* Get the quest text */ |
8921 | 8933 | init_flags = INIT_ASSIGN; |
@@ -8926,49 +8938,58 @@ static void do_cmd_knowledge_quests(void) | ||
8926 | 8938 | p_ptr->inside_quest = old_quest; |
8927 | 8939 | |
8928 | 8940 | /* No info from "silent" quests */ |
8929 | - if (quest[i].flags & QUEST_FLAG_SILENT) continue; | |
8941 | + if (quest[q_idx].flags & QUEST_FLAG_SILENT) continue; | |
8930 | 8942 | } |
8931 | 8943 | |
8932 | 8944 | total++; |
8933 | 8945 | |
8934 | - if (!is_fixed_quest_idx(i) && quest[i].r_idx) | |
8946 | + if (!is_fixed_quest_idx(q_idx) && quest[q_idx].r_idx) | |
8935 | 8947 | { |
8936 | 8948 | /* Print the quest info */ |
8937 | 8949 | #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); | |
8940 | 8952 | #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); | |
8943 | 8955 | #endif |
8944 | 8956 | } |
8945 | 8957 | else |
8946 | 8958 | { |
8947 | 8959 | /* Print the quest info */ |
8948 | 8960 | #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); | |
8951 | 8963 | #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); | |
8954 | 8966 | #endif |
8955 | 8967 | } |
8956 | 8968 | fprintf(fff, tmp_str); |
8957 | 8969 | } |
8958 | 8970 | } |
8959 | 8971 | #ifdef JP |
8960 | - if (!total) fprintf(fff, "なし\n"); | |
8972 | + if (!total) fprintf(fff, " なし\n"); | |
8961 | 8973 | #else |
8962 | - if (!total) fprintf(fff, "Nothing.\n"); | |
8974 | + if (!total) fprintf(fff, " Nothing.\n"); | |
8963 | 8975 | #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; | |
8964 | 8987 | |
8965 | - if (p_ptr->wizard) { | |
8966 | 8988 | #ifdef JP |
8967 | - fprintf(fff, "\n《残りのランダムクエスト》\n"); | |
8989 | + fprintf(fff, "《残りのランダムクエスト》\n"); | |
8968 | 8990 | #else |
8969 | - fprintf(fff, "\n< Remaining Random Quest >\n"); | |
8991 | + fprintf(fff, "< Remaining Random Quest >\n"); | |
8970 | 8992 | #endif |
8971 | - total = 0; | |
8972 | 8993 | for (i = 1; i < max_quests; i++) |
8973 | 8994 | { |
8974 | 8995 | /* No info from "silent" quests */ |
@@ -8980,21 +9001,94 @@ static void do_cmd_knowledge_quests(void) | ||
8980 | 9001 | |
8981 | 9002 | /* Print the quest info */ |
8982 | 9003 | #ifdef JP |
8983 | - sprintf(tmp_str, "%s (%d階, %s)\n", | |
9004 | + sprintf(tmp_str, " %s (%d階, %s)\n", | |
8984 | 9005 | quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name); |
8985 | 9006 | #else |
8986 | - sprintf(tmp_str, "%s (%d, %s)\n", | |
9007 | + sprintf(tmp_str, " %s (%d, %s)\n", | |
8987 | 9008 | quest[i].name, quest[i].level, r_name+r_info[quest[i].r_idx].name); |
8988 | 9009 | #endif |
8989 | 9010 | fprintf(fff, tmp_str); |
8990 | 9011 | } |
8991 | 9012 | } |
8992 | 9013 | #ifdef JP |
8993 | - if (!total) fprintf(fff, "なし\n"); | |
9014 | + if (!total) fprintf(fff, " なし\n"); | |
8994 | 9015 | #else |
8995 | - if (!total) fprintf(fff, "Nothing.\n"); | |
9016 | + if (!total) fprintf(fff, " Nothing.\n"); | |
8996 | 9017 | #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 | + } | |
8998 | 9092 | |
8999 | 9093 | /* Close the file */ |
9000 | 9094 | my_fclose(fff); |
@@ -9006,11 +9100,12 @@ static void do_cmd_knowledge_quests(void) | ||
9006 | 9100 | show_file(TRUE, file_name, "Quest status", 0, 0); |
9007 | 9101 | #endif |
9008 | 9102 | |
9009 | - | |
9010 | 9103 | /* Remove the file */ |
9011 | 9104 | fd_kill(file_name); |
9012 | -} | |
9013 | 9105 | |
9106 | + /* Free Memory */ | |
9107 | + C_KILL(quest_num, max_quests, int); | |
9108 | +} | |
9014 | 9109 | |
9015 | 9110 | |
9016 | 9111 | /* |
@@ -669,6 +669,10 @@ extern void do_cmd_feeling(void); | ||
669 | 669 | extern void do_cmd_load_screen(void); |
670 | 670 | extern void do_cmd_save_screen_html_aux(char *filename, int message); |
671 | 671 | 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); | |
672 | 676 | extern void do_cmd_knowledge(void); |
673 | 677 | extern void plural_aux(char * Name); |
674 | 678 | extern void do_cmd_checkquest(void); |
@@ -3922,33 +3922,6 @@ void display_player(int mode) | ||
3922 | 3922 | } |
3923 | 3923 | } |
3924 | 3924 | |
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 | -} | |
3952 | 3925 | |
3953 | 3926 | errr make_character_dump(FILE *fff) |
3954 | 3927 | { |
@@ -3959,7 +3932,6 @@ errr make_character_dump(FILE *fff) | ||
3959 | 3932 | store_type *st_ptr; |
3960 | 3933 | char o_name[MAX_NLEN]; |
3961 | 3934 | char buf[1024]; |
3962 | - int total; | |
3963 | 3935 | int *quest_num; |
3964 | 3936 | int dummy; |
3965 | 3937 |
@@ -4130,166 +4102,20 @@ errr make_character_dump(FILE *fff) | ||
4130 | 4102 | fprintf(fff, "\n [Quest information]\n"); |
4131 | 4103 | #endif |
4132 | 4104 | |
4133 | -#ifdef JP | |
4134 | - fprintf(fff, "\n《達成したクエスト》\n"); | |
4135 | -#else | |
4136 | - fprintf(fff, "\n< Completed Quest >\n"); | |
4137 | -#endif | |
4138 | - | |
4139 | 4105 | /* Allocate Memory */ |
4140 | 4106 | C_MAKE(quest_num, max_quests, int); |
4141 | 4107 | |
4142 | 4108 | /* 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; | |
4147 | 4110 | ang_sort_comp = ang_sort_comp_quest_num; |
4148 | 4111 | ang_sort_swap = ang_sort_swap_quest_num; |
4149 | 4112 | ang_sort(quest_num, &dummy, max_quests); |
4150 | 4113 | |
4151 | 4114 | /* 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); | |
4293 | 4119 | |
4294 | 4120 | /* Free Memory */ |
4295 | 4121 | C_KILL(quest_num, max_quests, int); |