OSDN Git Service

[Refactor] #37353 後で同名の構造体を作り、feat_*と命名を一致させるため floor_type を feat_ground_type に改名...
[hengband/hengband.git] / src / floor-save.c
index 290077d..9997eff 100644 (file)
  */
 
 #include "angband.h"
+#include "floor.h"
 #include "generate.h"
 #include "grid.h"
+#include "monster.h"
+#include "quest.h"
 
 
-static s16b new_floor_id;       /*!<次のフロアのID / floor_id of the destination */
+static FLOOR_IDX new_floor_id;  /*!<次のフロアのID / floor_id of the destination */
 static u32b change_floor_mode;  /*!<フロア移行処理に関するフラグ / Mode flags for changing floor */
 static u32b latest_visit_mark;  /*!<フロアを渡った回数?(確認中) / Max number of visit_mark */
 
@@ -61,19 +64,12 @@ void init_saved_floors(bool force)
                {
                        if (!force)
                        {
-#ifdef JP
-                               msg_print("エラー:古いテンポラリ・ファイルが残っています。");
-                               msg_print("変愚蛮怒を二重に起動していないか確認してください。");
-                               msg_print("過去に変愚蛮怒がクラッシュした場合は一時ファイルを");
-                               msg_print("強制的に削除して実行を続けられます。");
-                               if (!get_check("強制的に削除してもよろしいですか?")) quit("実行中止");
-#else
-                               msg_print("Error: There are old temporal files.");
-                               msg_print("Make sure you are not running two game processes simultaneously.");
-                               msg_print("If the temporal files are garbages of old crashed process, ");
-                               msg_print("you can delete it safely.");
-                               if (!get_check("Do you delete old temporal files? ")) quit("Aborted.");
-#endif
+                               msg_print(_("エラー:古いテンポラリ・ファイルが残っています。", "Error: There are old temporal files."));
+                               msg_print(_("変愚蛮怒を二重に起動していないか確認してください。", "Make sure you are not running two game processes simultaneously."));
+                               msg_print(_("過去に変愚蛮怒がクラッシュした場合は一時ファイルを", "If the temporal files are garbages of old crashed process, "));
+                               msg_print(_("強制的に削除して実行を続けられます。", "you can delete it safely."));
+                               if (!get_check(_("強制的に削除してもよろしいですか?", "Do you delete old temporal files? ")))
+                                       quit(_("実行中止", "Aborted."));
                                force = TRUE;
                        }
                }
@@ -236,10 +232,10 @@ static void kill_saved_floor(saved_floor_type *sf_ptr)
  * @details
  * If number of saved floors are already MAX_SAVED_FLOORS, kill the oldest one.
  */
-s16b get_new_floor_id(void)
+FLOOR_IDX get_new_floor_id(void)
 {
        saved_floor_type *sf_ptr = NULL;
-       s16b i;
+       FLOOR_IDX i;
 
        /* Look for empty space */
        for (i = 0; i < MAX_SAVED_FLOORS; i++)
@@ -446,7 +442,7 @@ static void preserve_pet(void)
                for (i = m_max - 1; i >=1; i--)
                {
                        monster_type *m_ptr = &m_list[i];
-                       char m_name[80];
+                       GAME_TEXT m_name[MAX_NLEN];
 
                        if (!m_ptr->r_idx) continue;
                        if (!is_pet(m_ptr)) continue;
@@ -471,14 +467,11 @@ static void preserve_pet(void)
 
                        if (is_seen(m_ptr))
                        {
-                               char m_name[80];
-
-                               /* Acquire the monster name */
+                               GAME_TEXT m_name[MAX_NLEN];
                                monster_desc(m_name, m_ptr, 0);
                                msg_format(_("%sは消え去った!", "%^s disappears!"), m_name);
                        }
 
-                       /* Delete the monster */
                        delete_monster_idx(i);
                }
        }
@@ -540,7 +533,7 @@ static void place_pet(void)
                        int j;
                        POSITION d;
 
-                       for (d = 1; d < 6; d++)
+                       for (d = 1; d < A_MAX; d++)
                        {
                                for (j = 1000; j > 0; j--)
                                {
@@ -582,9 +575,7 @@ static void place_pet(void)
                                /* Must repair monsters */
                                repair_monsters = TRUE;
                        }
-
-                       /* Update the monster */
-                       update_mon(m_idx, TRUE);
+                       update_monster(m_idx, TRUE);
                        lite_spot(cy, cx);
 
                        /* Pre-calculated in precalc_cur_num_of_pet() */
@@ -604,7 +595,7 @@ static void place_pet(void)
                {
                        monster_type *m_ptr = &party_mon[i];
                        monster_race *r_ptr = real_r_ptr(m_ptr);
-                       char m_name[80];
+                       GAME_TEXT m_name[MAX_NLEN];
 
                        monster_desc(m_name, m_ptr, 0);
                        msg_format(_("%sとはぐれてしまった。", "You have lost sight of %s."), m_name);
@@ -682,8 +673,8 @@ static void get_out_monster(void)
 {
        int tries = 0;
        POSITION dis = 1;
-       int oy = p_ptr->y;
-       int ox = p_ptr->x;
+       POSITION oy = p_ptr->y;
+       POSITION ox = p_ptr->x;
        MONSTER_IDX m_idx = cave[oy][ox].m_idx;
 
        /* Nothing to do if no monster */
@@ -695,8 +686,8 @@ static void get_out_monster(void)
                monster_type *m_ptr;
 
                /* Pick a (possibly illegal) location */
-               int ny = rand_spread(oy, dis);
-               int nx = rand_spread(ox, dis);
+               POSITION ny = rand_spread(oy, dis);
+               POSITION nx = rand_spread(ox, dis);
 
                tries++;
 
@@ -736,7 +727,7 @@ static void get_out_monster(void)
                m_ptr->fy = ny;
                m_ptr->fx = nx; 
 
-               /* No need to do update_mon() */
+               /* No need to do update_monster() */
 
                /* Success */
                return;
@@ -857,7 +848,7 @@ void leave_floor(void)
        cave_type *c_ptr = NULL;
        feature_type *f_ptr;
        saved_floor_type *sf_ptr;
-       int quest_r_idx = 0;
+       MONRACE_IDX quest_r_idx = 0;
        DUNGEON_IDX i;
 
        /* Preserve pets and prepare to take these to next floor */
@@ -880,7 +871,6 @@ void leave_floor(void)
            p_ptr->floor_id = get_new_floor_id();
        }
 
-
        /* Search the quest monster index */
        for (i = 0; i < max_q_idx; i++)
        {
@@ -1063,13 +1053,8 @@ void leave_floor(void)
                /* Record the last visit turn of current floor */
                sf_ptr->last_visit = turn;
 
-               /* Forget the lite */
                forget_lite();
-
-               /* Forget the view */
                forget_view();
-
-               /* Forget the view */
                clear_mon_lite();
 
                /* Save current floor */
@@ -1155,7 +1140,7 @@ void change_floor(void)
                                                if (change_floor_mode & (CFM_DOWN | CFM_UP))
                                                {
                                                        /* Reset to floor */
-                                                       c_ptr->feat = floor_type[randint0(100)];
+                                                       c_ptr->feat = feat_ground_type[randint0(100)];
                                                }
 
                                                c_ptr->special = 0;
@@ -1201,11 +1186,11 @@ void change_floor(void)
                /* Maintain monsters and artifacts */
                if (loaded)
                {
-                       IDX i;
-                       s32b tmp_last_visit = sf_ptr->last_visit;
-                       s32b absence_ticks;
+                       MONSTER_IDX i;
+                       GAME_TURN tmp_last_visit = sf_ptr->last_visit;
+                       GAME_TURN absence_ticks;
                        int alloc_chance = d_info[dungeon_type].max_m_alloc_chance;
-                       int alloc_times;
+                       GAME_TURN alloc_times;
 
                        while (tmp_last_visit > turn) tmp_last_visit -= TURNS_PER_TICK * TOWN_DAWN;
                        absence_ticks = (turn - tmp_last_visit) / TURNS_PER_TICK;
@@ -1356,8 +1341,7 @@ void change_floor(void)
                }
 
                /* You see stairs blocked */
-               else if ((change_floor_mode & CFM_NO_RETURN) &&
-                        (change_floor_mode & (CFM_DOWN | CFM_UP)))
+               else if ((change_floor_mode & CFM_NO_RETURN) && (change_floor_mode & (CFM_DOWN | CFM_UP)))
                {
                        if (!p_ptr->blind)
                        {
@@ -1424,7 +1408,7 @@ void stair_creation(void)
 
        bool up = TRUE;
        bool down = TRUE;
-       s16b dest_floor_id = 0;
+       FLOOR_IDX dest_floor_id = 0;
 
 
        /* Forbid up staircases on Ironman mode */
@@ -1499,7 +1483,7 @@ void stair_creation(void)
 
                                /* Remove old stairs */
                                c_ptr->special = 0;
-                               cave_set_feat(y, x, floor_type[randint0(100)]);
+                               cave_set_feat(y, x, feat_ground_type[randint0(100)]);
                        }
                }
        }