OSDN Git Service

[Refactor] #37353 型の置換(QUEST_IDX) / Type replacement.
[hengband/hengband.git] / src / save.c
index cddf0fa..704e51f 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include "angband.h"
+#include "sort.h"
 
 
 
@@ -101,7 +102,7 @@ static void wr_s32b(s32b v)
  * @param str 書き込む文字列
  * @return なし
  */
-static void wr_string(cptr str)
+static void wr_string(concptr str)
 {
        while (*str)
        {
@@ -259,7 +260,7 @@ static void wr_monster(monster_type *m_ptr)
        if (flags & SAVE_MON_SUB_ALIGN) wr_byte(m_ptr->sub_align);
        if (flags & SAVE_MON_CSLEEP) wr_s16b(m_ptr->mtimed[MTIMED_CSLEEP]);
 
-       wr_byte(m_ptr->mspeed);
+       wr_byte((byte)m_ptr->mspeed);
        wr_s16b(m_ptr->energy_need);
 
        if (flags & SAVE_MON_FAST)
@@ -556,9 +557,9 @@ static void save_quick_start(void)
        int i;
 
        wr_byte(previous_char.psex);
-       wr_byte(previous_char.prace);
-       wr_byte(previous_char.pclass);
-       wr_byte(previous_char.pseikaku);
+       wr_byte((byte_hack)previous_char.prace);
+       wr_byte((byte_hack)previous_char.pclass);
+       wr_byte((byte_hack)previous_char.pseikaku);
        wr_byte((byte_hack)previous_char.realm1);
        wr_byte((byte_hack)previous_char.realm2);
 
@@ -568,8 +569,8 @@ static void save_quick_start(void)
        wr_s16b(previous_char.sc);
        wr_s32b(previous_char.au);
 
-       for (i = 0; i < 6; i++) wr_s16b(previous_char.stat_max[i]);
-       for (i = 0; i < 6; i++) wr_s16b(previous_char.stat_max_max[i]);
+       for (i = 0; i < A_MAX; i++) wr_s16b(previous_char.stat_max[i]);
+       for (i = 0; i < A_MAX; i++) wr_s16b(previous_char.stat_max_max[i]);
 
        for (i = 0; i < PY_MAX_LEVEL; i++) wr_s16b((s16b)previous_char.player_hp[i]);
 
@@ -599,9 +600,7 @@ static void wr_extra(void)
        byte tmp8u;
 
        wr_string(p_ptr->name);
-
        wr_string(p_ptr->died_from);
-
        wr_string(p_ptr->last_message ? p_ptr->last_message : "");
 
        save_quick_start();
@@ -612,10 +611,10 @@ static void wr_extra(void)
        }
 
        /* Race/Class/Gender/Spells */
-       wr_byte(p_ptr->prace);
-       wr_byte(p_ptr->pclass);
-       wr_byte(p_ptr->pseikaku);
-       wr_byte(p_ptr->psex);
+       wr_byte((byte_hack)p_ptr->prace);
+       wr_byte((byte_hack)p_ptr->pclass);
+       wr_byte((byte_hack)p_ptr->pseikaku);
+       wr_byte((byte_hack)p_ptr->psex);
        wr_byte((byte_hack)p_ptr->realm1);
        wr_byte((byte_hack)p_ptr->realm2);
        wr_byte(0);
@@ -628,9 +627,9 @@ static void wr_extra(void)
        wr_s16b(p_ptr->wt);
 
        /* Dump the stats (maximum and current) */
-       for (i = 0; i < 6; ++i) wr_s16b(p_ptr->stat_max[i]);
-       for (i = 0; i < 6; ++i) wr_s16b(p_ptr->stat_max_max[i]);
-       for (i = 0; i < 6; ++i) wr_s16b(p_ptr->stat_cur[i]);
+       for (i = 0; i < A_MAX; ++i) wr_s16b(p_ptr->stat_max[i]);
+       for (i = 0; i < A_MAX; ++i) wr_s16b(p_ptr->stat_max_max[i]);
+       for (i = 0; i < A_MAX; ++i) wr_s16b(p_ptr->stat_cur[i]);
 
        /* Ignore the transient stats */
        for (i = 0; i < 12; ++i) wr_s16b(0);
@@ -649,7 +648,7 @@ static void wr_extra(void)
        for (i = 0; i < 108; i++) wr_s32b(p_ptr->magic_num1[i]);
        for (i = 0; i < 108; i++) wr_byte(p_ptr->magic_num2[i]);
 
-       wr_byte(p_ptr->start_race);
+       wr_byte((byte_hack)p_ptr->start_race);
        wr_s32b(p_ptr->old_race1);
        wr_s32b(p_ptr->old_race2);
        wr_s16b(p_ptr->old_realm);
@@ -1151,20 +1150,14 @@ static bool wr_dungeon(void)
        saved_floor_type *cur_sf_ptr;
        int i;
 
-       /* Forget the lite */
        forget_lite();
-
-       /* Forget the view */
        forget_view();
-
-       /* Forget the view */
        clear_mon_lite();
 
        /* Update lite/view */
        p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
        p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW);
 
-
        /*** Meta info ***/
 
        /* Number of floor_id used from birth */
@@ -1772,7 +1765,7 @@ bool load_player(void)
        struct stat     statbuf;
 #endif
 
-       cptr    what = "generic";
+       concptr    what = "generic";
 
 
        /* Paranoia */
@@ -1932,13 +1925,8 @@ bool load_player(void)
                        }
                        else
                        {
-#ifdef JP
-                               msg_format("バージョン %d.%d.%d 用のセーブ・ファイルを変換しました。",
-                                   (z_major > 9) ? z_major-10 : z_major , z_minor, z_patch);
-#else
-                               msg_format("Converted a %d.%d.%d savefile.",
+                               msg_format(_("バージョン %d.%d.%d 用のセーブ・ファイルを変換しました。", "Converted a %d.%d.%d savefile."),
                                    (z_major > 9) ? z_major-10 : z_major , z_minor, z_patch);
-#endif
                        }
                        msg_print(NULL);
                }
@@ -1951,7 +1939,6 @@ bool load_player(void)
                        {
                                /* A character was loaded */
                                character_loaded = TRUE;
-
                                return (TRUE);
                        }
 
@@ -1998,8 +1985,7 @@ bool load_player(void)
 
 #endif
 
-       msg_format(_("エラー(%s)がバージョン%d.%d.%d 用セーブファイル読み込み中に発生。",
-               "Error (%s) reading %d.%d.%d savefile."),
+       msg_format(_("エラー(%s)がバージョン%d.%d.%d 用セーブファイル読み込み中に発生。", "Error (%s) reading %d.%d.%d savefile."),
                what, (z_major>9) ? z_major - 10 : z_major, z_minor, z_patch);
 
        msg_print(NULL);