OSDN Git Service

[Fix] #38796 マーフォーク用の rgold_adj を追加。 / Add to rgold_adj for Merfolk.
[hengband/hengband.git] / src / floor-save.c
index 90ce4b9..e010275 100644 (file)
  */
 
 #include "angband.h"
+#include "floor.h"
 #include "generate.h"
 #include "grid.h"
+#include "monster.h"
+#include "quest.h"
 
 
 static FLOOR_IDX new_floor_id;  /*!<次のフロアのID / floor_id of the destination */
@@ -875,7 +878,7 @@ void leave_floor(void)
                    ((quest[i].type == QUEST_TYPE_KILL_LEVEL) ||
                    (quest[i].type == QUEST_TYPE_RANDOM)) &&
                    (quest[i].level == dun_level) &&
-                   (dungeon_type == quest[i].dungeon) &&
+                   (p_ptr->dungeon_idx == quest[i].dungeon) &&
                    !(quest[i].flags & QUEST_FLAG_PRESET))
                {
                        quest_r_idx = quest[i].r_idx;
@@ -967,11 +970,11 @@ void leave_floor(void)
                if (change_floor_mode & CFM_DOWN)
                {
                        if (!dun_level)
-                               move_num = d_info[dungeon_type].mindepth;
+                               move_num = d_info[p_ptr->dungeon_idx].mindepth;
                }
                else if (change_floor_mode & CFM_UP)
                {
-                       if (dun_level + move_num < d_info[dungeon_type].mindepth)
+                       if (dun_level + move_num < d_info[p_ptr->dungeon_idx].mindepth)
                                move_num = -dun_level;
                }
 
@@ -979,16 +982,16 @@ void leave_floor(void)
        }
 
        /* Leaving the dungeon to town */
-       if (!dun_level && dungeon_type)
+       if (!dun_level && p_ptr->dungeon_idx)
        {
                p_ptr->leaving_dungeon = TRUE;
                if (!vanilla_town && !lite_town)
                {
-                       p_ptr->wilderness_y = d_info[dungeon_type].dy;
-                       p_ptr->wilderness_x = d_info[dungeon_type].dx;
+                       p_ptr->wilderness_y = d_info[p_ptr->dungeon_idx].dy;
+                       p_ptr->wilderness_x = d_info[p_ptr->dungeon_idx].dx;
                }
-               p_ptr->recall_dungeon = dungeon_type;
-               dungeon_type = 0;
+               p_ptr->recall_dungeon = p_ptr->dungeon_idx;
+               p_ptr->dungeon_idx = 0;
 
                /* Reach to the surface -- Clear all saved floors */
                change_floor_mode &= ~CFM_SAVE_FLOORS;
@@ -1137,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;
@@ -1183,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;
-                       int alloc_chance = d_info[dungeon_type].max_m_alloc_chance;
-                       int alloc_times;
+                       MONSTER_IDX i;
+                       GAME_TURN tmp_last_visit = sf_ptr->last_visit;
+                       GAME_TURN absence_ticks;
+                       int alloc_chance = d_info[p_ptr->dungeon_idx].max_m_alloc_chance;
+                       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;
@@ -1338,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)
                        {
@@ -1406,14 +1408,14 @@ 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 */
        if (ironman_downward) up = FALSE;
 
        /* Forbid down staircases on quest level */
-       if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth)) down = FALSE;
+       if (quest_number(dun_level) || (dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) down = FALSE;
 
        /* No effect out of standard dungeon floor */
        if (!dun_level || (!up && !down) ||
@@ -1481,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)]);
                        }
                }
        }