OSDN Git Service

[Refactor] #38862 Moved quest.c/h to dungeon/
[hengband/hengband.git] / src / cmd / cmd-dump.c
index 66dab9a..6568747 100644 (file)
  * </pre>
  */
 
-#include "angband.h"
-#include "cmd/cmd-draw.h"
+#include "system/angband.h"
 #include "cmd/cmd-dump.h"
-#include "cmd/cmd-inventory.h"
-#include "cmd/cmd-visuals.h"
 #include "cmd/dump-util.h"
-#include "gameterm.h"
-#include "core.h" // 暫定。後で消す.
+#include "term/gameterm.h"
+#include "system/angband-version.h"
+#include "io/dump-remover.h"
 #include "io/read-pref-file.h"
 #include "io/interpret-pref-file.h"
 
-#include "knowledge/knowledge-autopick.h"
-#include "knowledge/knowledge-experiences.h"
-#include "knowledge/knowledge-features.h"
-#include "knowledge/knowledge-items.h"
-#include "knowledge/knowledge-monsters.h"
-#include "knowledge/knowledge-quests.h"
-#include "knowledge/knowledge-self.h"
-#include "knowledge/knowledge-uniques.h"
-
-#include "world.h"
+#include "world/world.h"
 #include "view/display-player.h" // 暫定。後で消す.
-#include "player-personality.h"
-#include "mutation.h"
-#include "quest.h"
-#include "market/store.h"
-#include "artifact.h"
-#include "floor-town.h"
+#include "player/player-personality.h"
+#include "dungeon/quest.h"
+#include "object/artifact.h"
+#include "floor/floor-town.h"
 #include "cmd/feeling-table.h"
-#include "market/store-util.h"
-#include "english.h"
-
-#include "chuukei.h"
-
-/*!
- * @brief prefファイルを選択して処理する /
- * Ask for a "user pref line" and process it
- * @brief prf出力内容を消去する /
- * Remove old lines automatically generated before.
- * @param orig_file 消去を行うファイル名
- */
-static void remove_auto_dump(concptr orig_file, concptr auto_dump_mark)
-{
-       char buf[1024];
-       bool between_mark = FALSE;
-       bool changed = FALSE;
-       int line_num = 0;
-       long header_location = 0;
-       char header_mark_str[80];
-       char footer_mark_str[80];
-
-       sprintf(header_mark_str, auto_dump_header, auto_dump_mark);
-       sprintf(footer_mark_str, auto_dump_footer, auto_dump_mark);
-       size_t mark_len = strlen(footer_mark_str);
-
-       FILE *orig_fff;
-       orig_fff = my_fopen(orig_file, "r");
-       if (!orig_fff) return;
-
-       FILE *tmp_fff = NULL;
-       char tmp_file[FILE_NAME_SIZE];
-       if (!open_temporary_file(&tmp_fff, tmp_file)) return;
-
-       while (TRUE)
-       {
-               if (my_fgets(orig_fff, buf, sizeof(buf)))
-               {
-                       if (between_mark)
-                       {
-                               fseek(orig_fff, header_location, SEEK_SET);
-                               between_mark = FALSE;
-                               continue;
-                       }
-                       else
-                       {
-                               break;
-                       }
-               }
+#include "locale/english.h"
 
-               if (!between_mark)
-               {
-                       if (!strcmp(buf, header_mark_str))
-                       {
-                               header_location = ftell(orig_fff);
-                               line_num = 0;
-                               between_mark = TRUE;
-                               changed = TRUE;
-                       }
-                       else
-                       {
-                               fprintf(tmp_fff, "%s\n", buf);
-                       }
-
-                       continue;
-               }
-
-               if (!strncmp(buf, footer_mark_str, mark_len))
-               {
-                       int tmp;
-                       if (!sscanf(buf + mark_len, " (%d)", &tmp)
-                               || tmp != line_num)
-                       {
-                               fseek(orig_fff, header_location, SEEK_SET);
-                       }
-
-                       between_mark = FALSE;
-                       continue;
-               }
-
-               line_num++;
-       }
-
-       my_fclose(orig_fff);
-       my_fclose(tmp_fff);
-
-       if (changed)
-       {
-               tmp_fff = my_fopen(tmp_file, "r");
-               orig_fff = my_fopen(orig_file, "w");
-               while (!my_fgets(tmp_fff, buf, sizeof(buf)))
-                       fprintf(orig_fff, "%s\n", buf);
-
-               my_fclose(orig_fff);
-               my_fclose(tmp_fff);
-       }
-
-       fd_kill(tmp_file);
-}
-
-
-#ifdef JP
-#else
-/*!
- * @brief Return suffix of ordinal number
- * @param num number
- * @return pointer of suffix string.
- */
-concptr get_ordinal_number_suffix(int num)
-{
-       num = ABS(num) % 100;
-       switch (num % 10)
-       {
-       case 1:
-               return (num == 11) ? "th" : "st";
-       case 2:
-               return (num == 12) ? "th" : "nd";
-       case 3:
-               return (num == 13) ? "th" : "rd";
-       default:
-               return "th";
-       }
-}
-#endif
+#include "io/chuukei.h"
 
 /*!
  * @brief 画面を再描画するコマンドのメインルーチン
@@ -205,7 +71,7 @@ void do_cmd_pref(player_type *creature_ptr)
 /*
  * Interact with "colors"
  */
-void do_cmd_colors(player_type *creature_ptr)
+void do_cmd_colors(player_type *creature_ptr, void(*process_autopick_file_command)(char*))
 {
        int i;
        char tmp[160];
@@ -231,7 +97,7 @@ void do_cmd_colors(player_type *creature_ptr)
                        sprintf(tmp, "%s.prf", creature_ptr->base_name);
                        if (!askfor(tmp, 70)) continue;
 
-                       (void)process_pref_file(creature_ptr, tmp);
+                       (void)process_pref_file(creature_ptr, tmp, process_autopick_file_command);
                        Term_xtra(TERM_XTRA_REACT, 0);
                        Term_redraw();
                }
@@ -393,146 +259,6 @@ void do_cmd_feeling(player_type *creature_ptr)
 
 
 /*
- * Interact with "knowledge"
- */
-void do_cmd_knowledge(player_type *creature_ptr)
-{
-       int i, p = 0;
-       bool need_redraw = FALSE;
-       FILE_TYPE(FILE_TYPE_TEXT);
-       screen_save();
-       while (TRUE)
-       {
-               Term_clear();
-               prt(format(_("%d/2 ページ", "page %d/2"), (p + 1)), 2, 65);
-               prt(_("現在の知識を確認する", "Display current knowledge"), 3, 0);
-               if (p == 0)
-               {
-                       prt(_("(1) 既知の伝説のアイテム                 の一覧", "(1) Display known artifacts"), 6, 5);
-                       prt(_("(2) 既知のアイテム                       の一覧", "(2) Display known objects"), 7, 5);
-                       prt(_("(3) 既知の生きているユニーク・モンスター の一覧", "(3) Display remaining uniques"), 8, 5);
-                       prt(_("(4) 既知のモンスター                     の一覧", "(4) Display known monster"), 9, 5);
-                       prt(_("(5) 倒した敵の数                         の一覧", "(5) Display kill count"), 10, 5);
-                       if (!vanilla_town) prt(_("(6) 賞金首                               の一覧", "(6) Display wanted monsters"), 11, 5);
-                       prt(_("(7) 現在のペット                         の一覧", "(7) Display current pets"), 12, 5);
-                       prt(_("(8) 我が家のアイテム                     の一覧", "(8) Display home inventory"), 13, 5);
-                       prt(_("(9) *鑑定*済み装備の耐性                 の一覧", "(9) Display *identified* equip."), 14, 5);
-                       prt(_("(0) 地形の表示文字/タイル                の一覧", "(0) Display terrain symbols."), 15, 5);
-               }
-               else
-               {
-                       prt(_("(a) 自分に関する情報                     の一覧", "(a) Display about yourself"), 6, 5);
-                       prt(_("(b) 突然変異                             の一覧", "(b) Display mutations"), 7, 5);
-                       prt(_("(c) 武器の経験値                         の一覧", "(c) Display weapon proficiency"), 8, 5);
-                       prt(_("(d) 魔法の経験値                         の一覧", "(d) Display spell proficiency"), 9, 5);
-                       prt(_("(e) 技能の経験値                         の一覧", "(e) Display misc. proficiency"), 10, 5);
-                       prt(_("(f) プレイヤーの徳                       の一覧", "(f) Display virtues"), 11, 5);
-                       prt(_("(g) 入ったダンジョン                     の一覧", "(g) Display dungeons"), 12, 5);
-                       prt(_("(h) 実行中のクエスト                     の一覧", "(h) Display current quests"), 13, 5);
-                       prt(_("(i) 現在の自動拾い/破壊設定              の一覧", "(i) Display auto pick/destroy"), 14, 5);
-               }
-
-               prt(_("-続く-", "-more-"), 17, 8);
-               prt(_("ESC) 抜ける", "ESC) Exit menu"), 21, 1);
-               prt(_("SPACE) 次ページ", "SPACE) Next page"), 21, 30);
-               prt(_("コマンド:", "Command: "), 20, 0);
-               i = inkey();
-
-               if (i == ESCAPE) break;
-               switch (i)
-               {
-               case ' ': /* Page change */
-               case '-':
-                       p = 1 - p;
-                       break;
-               case '1': /* Artifacts */
-                       do_cmd_knowledge_artifacts(creature_ptr);
-                       break;
-               case '2': /* Objects */
-                       do_cmd_knowledge_objects(creature_ptr, &need_redraw, FALSE, -1);
-                       break;
-               case '3': /* Uniques */
-                       do_cmd_knowledge_uniques(creature_ptr);
-                       break;
-               case '4': /* Monsters */
-                       do_cmd_knowledge_monsters(creature_ptr, &need_redraw, FALSE, -1);
-                       break;
-               case '5': /* Kill count  */
-                       do_cmd_knowledge_kill_count(creature_ptr);
-                       break;
-               case '6': /* wanted */
-                       if (!vanilla_town) do_cmd_knowledge_bounty(creature_ptr);
-                       break;
-               case '7': /* Pets */
-                       do_cmd_knowledge_pets(creature_ptr);
-                       break;
-               case '8': /* Home */
-                       do_cmd_knowledge_home(creature_ptr);
-                       break;
-               case '9': /* Resist list */
-                       do_cmd_knowledge_inventory(creature_ptr);
-                       break;
-               case '0': /* Feature list */
-               {
-                       IDX lighting_level = F_LIT_STANDARD;
-                       do_cmd_knowledge_features(&need_redraw, FALSE, -1, &lighting_level);
-               }
-               break;
-               /* Next page */
-               case 'a': /* Max stat */
-                       do_cmd_knowledge_stat(creature_ptr);
-                       break;
-               case 'b': /* Mutations */
-                       do_cmd_knowledge_mutations(creature_ptr);
-                       break;
-               case 'c': /* weapon-exp */
-                       do_cmd_knowledge_weapon_exp(creature_ptr);
-                       break;
-               case 'd': /* spell-exp */
-                       do_cmd_knowledge_spell_exp(creature_ptr);
-                       break;
-               case 'e': /* skill-exp */
-                       do_cmd_knowledge_skill_exp(creature_ptr);
-                       break;
-               case 'f': /* Virtues */
-                       do_cmd_knowledge_virtues(creature_ptr);
-                       break;
-               case 'g': /* Dungeon */
-                       do_cmd_knowledge_dungeon(creature_ptr);
-                       break;
-               case 'h': /* Quests */
-                       do_cmd_knowledge_quests(creature_ptr);
-                       break;
-               case 'i': /* Autopick */
-                       do_cmd_knowledge_autopick(creature_ptr);
-                       break;
-               default: /* Unknown option */
-                       bell();
-               }
-
-               msg_erase();
-       }
-
-       screen_load();
-       if (need_redraw) do_cmd_redraw(creature_ptr);
-}
-
-
-/*
- * Check on the status of an active quest
- * @param creature_ptr プレーヤーへの参照ポインタ
- * @return なし
- */
-void do_cmd_checkquest(player_type *creature_ptr)
-{
-       FILE_TYPE(FILE_TYPE_TEXT);
-       screen_save();
-       do_cmd_knowledge_quests(creature_ptr);
-       screen_load();
-}
-
-
-/*
  * Display the time and date
  * @param creature_ptr プレーヤーへの参照ポインタ
  * @return なし