OSDN Git Service

[Fix] #37285 ティボルトのUNIQUE属性付加忘れを修正。
[hengband/hengband.git] / src / files.c
index dbc63d9..49b6dd0 100644 (file)
@@ -25,6 +25,8 @@
 #include "shoot.h"
 #include "player-move.h"
 #include "patron.h"
+#include "monster.h"
+#include "monster-status.h"
 
 
 /*
@@ -1928,8 +1930,6 @@ static concptr likert(int x, int y)
        static char dummy[20] = "", dummy2[20] = "";
        memset(dummy, 0, strlen(dummy));
        memset(dummy2, 0, strlen(dummy2));
-
-       /* Paranoia */
        if (y <= 0) y = 1;
 
        if(show_actual_value)
@@ -2793,7 +2793,7 @@ static void tim_player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
  * @param mode オプション
  * @return なし
  */
-static void display_player_equippy(TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode)
+void display_player_equippy(TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode)
 {
        int i, max_i;
 
@@ -2829,15 +2829,6 @@ static void display_player_equippy(TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode)
 
 
 /*!
- * @brief プレイヤーの装備一覧シンボルを固定位置に表示する
- * @return なし
- */
-void print_equippy(void)
-{
-       display_player_equippy(ROW_EQUIPPY, COL_EQUIPPY, 0);
-}
-
-/*!
  * @brief プレイヤーの装備による免疫フラグを返す
  * @param flgs フラグを保管する配列
  * @return なし
@@ -4189,7 +4180,7 @@ static void dump_aux_pet(FILE *fff)
        {
                monster_type *m_ptr = &current_floor_ptr->m_list[i];
 
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
                if (!is_pet(m_ptr)) continue;
                pet_settings = TRUE;
                if (!m_ptr->nickname && (p_ptr->riding != i)) continue;
@@ -4452,9 +4443,7 @@ static void dump_aux_quest(FILE *fff)
 
        /* Sort by compete level */
        for (i = 1; i < max_q_idx; i++) quest_num[i] = i;
-       ang_sort_comp = ang_sort_comp_quest_num;
-       ang_sort_swap = ang_sort_swap_quest_num;
-       ang_sort(quest_num, &dummy, max_q_idx);
+       ang_sort(quest_num, &dummy, max_q_idx, ang_sort_comp_quest_num, ang_sort_swap_quest_num);
 
        /* Dump Quest Information */
        fputc('\n', fff);
@@ -4714,13 +4703,8 @@ static void dump_aux_monsters(FILE *fff)
                fprintf(fff, "You have defeated %ld %s including %ld unique monster%s in total.\n", norm_total, norm_total == 1 ? "enemy" : "enemies", uniq_total, (uniq_total == 1 ? "" : "s"));
 #endif
 
-
-               /* Select the sort method */
-               ang_sort_comp = ang_sort_comp_hook;
-               ang_sort_swap = ang_sort_swap_hook;
-
                /* Sort the array by dungeon depth of monsters */
-               ang_sort(who, &why, uniq_total);
+               ang_sort(who, &why, uniq_total, ang_sort_comp_hook, ang_sort_swap_hook);
                fprintf(fff, _("\n《上位%ld体のユニーク・モンスター》\n", "\n< Unique monsters top %ld >\n"), MIN(uniq_total, 10));
 
                /* Print top 10 */
@@ -5975,88 +5959,6 @@ void get_name(void)
 
 
 /*!
- * @brief 自殺するコマンドのメインルーチン
- * Hack -- commit suicide
- * @return なし
- * @details
- */
-void do_cmd_suicide(void)
-{
-       int i;
-
-       /* Flush input */
-       flush();
-
-       /* Verify Retirement */
-       if (p_ptr->total_winner)
-       {
-               /* Verify */
-               if (!get_check_strict(_("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY)) return;
-       }
-
-       /* Verify Suicide */
-       else
-       {
-               /* Verify */
-               if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? "))) return;
-       }
-
-
-       if (!p_ptr->noscore)
-       {
-               /* Special Verification for suicide */
-               prt(_("確認のため '@' を押して下さい。", "Please verify SUICIDE by typing the '@' sign: "), 0, 0);
-
-               flush();
-               i = inkey();
-               prt("", 0, 0);
-               if (i != '@') return;
-
-               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
-       }
-
-       /* Initialize "last message" buffer */
-       if (p_ptr->last_message) string_free(p_ptr->last_message);
-       p_ptr->last_message = NULL;
-
-       /* Hack -- Note *winning* message */
-       if (p_ptr->total_winner && last_words)
-       {
-               char buf[1024] = "";
-               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WINNER);
-               do
-               {
-                       while (!get_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof buf)) ;
-               }
-               while (!get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
-
-               if (buf[0])
-               {
-                       p_ptr->last_message = string_make(buf);
-                       msg_print(p_ptr->last_message);
-               }
-       }
-
-       /* Stop playing */
-       p_ptr->playing = FALSE;
-
-       /* Kill the player */
-       p_ptr->is_dead = TRUE;
-       p_ptr->leaving = TRUE;
-
-       if (!p_ptr->total_winner)
-       {
-               do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ダンジョンの探索に絶望して自殺した。", "give up all hope to commit suicide."));
-               do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "--------   Game  Over   --------"));
-               do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
-       }
-
-       /* Cause of death */
-       (void)strcpy(p_ptr->died_from, _("途中終了", "Quitting"));
-}
-
-
-/*!
  * @brief セーブするコマンドのメインルーチン
  * Save the game
  * @param is_autosave オートセーブ中の処理ならばTRUE
@@ -6304,7 +6206,7 @@ bool (*tombstone_aux)(void) = NULL;
  * Display a "tomb-stone"
  * @return なし
  */
-static void print_tomb(void)
+void print_tomb(void)
 {
        bool done = FALSE;
 
@@ -6514,7 +6416,7 @@ static void print_tomb(void)
  * Display some character info
  * @return なし
  */
-static void show_info(void)
+void show_info(void)
 {
        int             i, j, k, l;
        object_type *o_ptr;
@@ -6666,7 +6568,7 @@ static void show_info(void)
  * Display some character info
  * @return なし
  */
-static bool check_score(void)
+bool check_score(void)
 {
        Term_clear();
 
@@ -6726,125 +6628,6 @@ static bool check_score(void)
        return TRUE;
 }
 
-/*!
- * @brief ゲーム終了処理 /
- * Close up the current game (player may or may not be dead)
- * @return なし
- * @details
- * <pre>
- * This function is called only from "main.c" and "signals.c".
- * </pre>
- */
-void close_game(void)
-{
-       char buf[1024];
-       bool do_send = TRUE;
-
-/*     concptr p = "[i:キャラクタの情報, f:ファイル書き出し, t:スコア, x:*鑑定*, ESC:ゲーム終了]"; */
-       handle_stuff();
-
-       /* Flush the messages */
-       msg_print(NULL);
-
-       /* Flush the input */
-       flush();
-
-
-       /* No suspending now */
-       signals_ignore_tstp();
-
-
-       /* Hack -- Character is now "icky" */
-       character_icky = TRUE;
-
-
-       /* Build the filename */
-       path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
-
-       /* Grab permissions */
-       safe_setuid_grab();
-
-       /* Open the high score file, for reading/writing */
-       highscore_fd = fd_open(buf, O_RDWR);
-
-       /* Drop permissions */
-       safe_setuid_drop();
-
-       /* Handle death */
-       if (p_ptr->is_dead)
-       {
-               /* Handle retirement */
-               if (p_ptr->total_winner) kingly();
-
-               /* Save memories */
-               if (!cheat_save || get_check(_("死んだデータをセーブしますか? ", "Save death? ")))
-               {
-                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
-               }
-               else do_send = FALSE;
-
-               /* You are dead */
-               print_tomb();
-
-               flush();
-
-               /* Show more info */
-               show_info();
-               Term_clear();
-
-               if (check_score())
-               {
-                       if ((!send_world_score(do_send)))
-                       {
-                               if (get_check_strict(_("後でスコアを登録するために待機しますか?", "Stand by for later score registration? "),
-                                                               (CHECK_NO_ESCAPE | CHECK_NO_HISTORY)))
-                               {
-                                       p_ptr->wait_report_score = TRUE;
-                                       p_ptr->is_dead = FALSE;
-                                       if (!save_player()) msg_print(_("セーブ失敗!", "death save failed!"));
-                               }
-                       }
-                       if (!p_ptr->wait_report_score)
-                               (void)top_twenty();
-               }
-               else if (highscore_fd >= 0)
-               {
-                       display_scores_aux(0, 10, -1, NULL);
-               }
-#if 0
-               /* Dump bones file */
-               make_bones();
-#endif
-       }
-
-       /* Still alive */
-       else
-       {
-               /* Save the game */
-               do_cmd_save_game(FALSE);
-
-               /* Prompt for scores */
-               prt(_("リターンキーか ESC キーを押して下さい。", "Press Return (or Escape)."), 0, 40);
-               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_EXIT);
-
-               /* Predict score (or ESCAPE) */
-               if (inkey() != ESCAPE) predict_score();
-       }
-
-
-       /* Shut the high score file */
-       (void)fd_close(highscore_fd);
-
-       /* Forget the high score fd */
-       highscore_fd = -1;
-
-       /* Kill all temporal files */
-       clear_saved_floor_files();
-
-       /* Allow suspending now */
-       signals_handle_tstp();
-}
-
 
 /*!
  * @brief 異常発生時のゲーム緊急終了処理 /