OSDN Git Service

[Refactor] #37353 cnv_stat() と modify_stat_value() を player-status.c/h へ移動。
[hengband/hengband.git] / src / init1.c
index f370b7d..043b22e 100644 (file)
@@ -51,6 +51,7 @@
 #include "monster.h"
 #include "artifact.h"
 #include "cmd-activate.h"
+#include "wild.h"
 
 
 
@@ -1140,7 +1141,7 @@ static bool add_tag(STR_OFFSET *offset, header *head, concptr buf)
  * @param c シンボル文字
  * @return カラーID
  */
-byte color_char_to_attr(char c)
+TERM_COLOR color_char_to_attr(SYMBOL_CODE c)
 {
        switch (c)
        {
@@ -1735,8 +1736,6 @@ errr parse_f_info(char *buf, header *head)
                int j;
                byte s_attr;
                char char_tmp[F_LIT_MAX];
-
-               /* Paranoia */
                if (buf[1] != ':') return (1);
                if (!buf[2]) return (1);
                if (buf[3] != ':') return (1);
@@ -1747,8 +1746,6 @@ errr parse_f_info(char *buf, header *head)
 
                /* Extract the color */
                s_attr = color_char_to_attr(buf[4]);
-
-               /* Paranoia */
                if (s_attr > 127) return (1);
 
                /* Save the standard values */
@@ -2189,8 +2186,6 @@ errr parse_k_info(char *buf, header *head)
        {
                char sym;
                byte tmp;
-
-               /* Paranoia */
                if (buf[1] != ':') return (1);
                if (!buf[2]) return (1);
                if (buf[3] != ':') return (1);
@@ -2201,8 +2196,6 @@ errr parse_k_info(char *buf, header *head)
 
                /* Extract the attr */
                tmp = color_char_to_attr(buf[4]);
-
-               /* Paranoia */
                if (tmp > 127) return (1);
 
                /* Save the values */
@@ -2938,8 +2931,6 @@ errr parse_r_info(char *buf, header *head)
        {
                char sym;
                byte tmp;
-
-               /* Paranoia */
                if (buf[1] != ':') return (1);
                if (!buf[2]) return (1);
                if (buf[3] != ':') return (1);
@@ -2950,8 +2941,6 @@ errr parse_r_info(char *buf, header *head)
 
                /* Extract the attr */
                tmp = color_char_to_attr(buf[4]);
-
-               /* Paranoia */
                if (tmp > 127) return (1);
 
                /* Save the values */
@@ -3900,13 +3889,13 @@ static errr parse_line_building(char *buf)
  */
 static void drop_here(object_type *j_ptr, POSITION y, POSITION x)
 {
-       grid_type *c_ptr = &cave[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
        object_type *o_ptr;
 
        OBJECT_IDX o_idx = o_pop();
 
        /* Access new object */
-       o_ptr = &o_list[o_idx];
+       o_ptr = &current_floor_ptr->o_list[o_idx];
 
        /* Structure copy */
        object_copy(o_ptr, j_ptr);
@@ -3919,10 +3908,9 @@ static void drop_here(object_type *j_ptr, POSITION y, POSITION x)
        o_ptr->held_m_idx = 0;
 
        /* Build a stack */
-       o_ptr->next_o_idx = c_ptr->o_idx;
+       o_ptr->next_o_idx = g_ptr->o_idx;
 
-       /* Place the object */
-       c_ptr->o_idx = o_idx;
+       g_ptr->o_idx = o_idx;
 }
 
 
@@ -3969,7 +3957,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                return parse_line_feature(buf);
        }
 
-       /* Process "D:<dungeon>" -- info for the cave grids */
+       /* Process "D:<dungeon>" -- info for the current_floor_ptr->grid_array grids */
        else if (buf[0] == 'D')
        {
                object_type object_type_body;
@@ -3984,7 +3972,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
 
                for (*x = xmin, i = 0; ((*x < xmax) && (i < len)); (*x)++, s++, i++)
                {
-                       grid_type *c_ptr = &cave[*y][*x];
+                       grid_type *g_ptr = &current_floor_ptr->grid_array[*y][*x];
 
                        int idx = s[0];
 
@@ -3994,22 +3982,22 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        ARTIFACT_IDX artifact_index = letter[idx].artifact;
 
                        /* Lay down a floor */
-                       c_ptr->feat = conv_dungeon_feat(letter[idx].feature);
+                       g_ptr->feat = conv_dungeon_feat(letter[idx].feature);
 
                        /* Only the features */
                        if (init_flags & INIT_ONLY_FEATURES) continue;
 
                        /* Cave info */
-                       c_ptr->info = letter[idx].cave_info;
+                       g_ptr->info = letter[idx].cave_info;
 
                        /* Create a monster */
                        if (random & RANDOM_MONSTER)
                        {
-                               monster_level = base_level + monster_index;
+                               current_floor_ptr->monster_level = current_floor_ptr->base_level + monster_index;
 
                                place_monster(*y, *x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
 
-                               monster_level = base_level;
+                               current_floor_ptr->monster_level = current_floor_ptr->base_level;
                        }
                        else if (monster_index)
                        {
@@ -4046,7 +4034,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                if (clone)
                                {
                                        /* clone */
-                                       m_list[hack_m_idx_ii].smart |= SM_CLONED;
+                                       current_floor_ptr->m_list[hack_m_idx_ii].smart |= SM_CLONED;
 
                                        /* Make alive again for real unique monster */
                                        r_info[monster_index].cur_num = old_cur_num;
@@ -4057,7 +4045,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        /* Object (and possible trap) */
                        if ((random & RANDOM_OBJECT) && (random & RANDOM_TRAP))
                        {
-                               object_level = base_level + object_index;
+                               current_floor_ptr->object_level = current_floor_ptr->base_level + object_index;
 
                                /*
                                 * Random trap and random treasure defined
@@ -4072,11 +4060,11 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                        place_trap(*y, *x);
                                }
 
-                               object_level = base_level;
+                               current_floor_ptr->object_level = current_floor_ptr->base_level;
                        }
                        else if (random & RANDOM_OBJECT)
                        {
-                               object_level = base_level + object_index;
+                               current_floor_ptr->object_level = current_floor_ptr->base_level + object_index;
 
                                /* Create an out of deep object */
                                if (randint0(100) < 75)
@@ -4086,7 +4074,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                else
                                        place_object(*y, *x, AM_GOOD | AM_GREAT);
 
-                               object_level = base_level;
+                               current_floor_ptr->object_level = current_floor_ptr->base_level;
                        }
                        /* Random trap */
                        else if (random & RANDOM_TRAP)
@@ -4096,8 +4084,8 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        /* Hidden trap (or door) */
                        else if (letter[idx].trap)
                        {
-                               c_ptr->mimic = c_ptr->feat;
-                               c_ptr->feat = conv_dungeon_feat(letter[idx].trap);
+                               g_ptr->mimic = g_ptr->feat;
+                               g_ptr->feat = conv_dungeon_feat(letter[idx].trap);
                        }
                        else if (object_index)
                        {
@@ -4112,7 +4100,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                }
 
                                /* Apply magic (no messages, no artifacts) */
-                               apply_magic(o_ptr, base_level, AM_NO_FIXED_ART | AM_GOOD);
+                               apply_magic(o_ptr, current_floor_ptr->base_level, AM_NO_FIXED_ART | AM_GOOD);
 
                                drop_here(o_ptr, *y, *x);
                        }
@@ -4138,7 +4126,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        }
 
                        /* Terrain special */
-                       c_ptr->special = letter[idx].special;
+                       g_ptr->special = letter[idx].special;
                }
 
                (*y)++;
@@ -4272,15 +4260,15 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                /* Hack - Set the dungeon size */
                                panels_y = (*y / SCREEN_HGT);
                                if (*y % SCREEN_HGT) panels_y++;
-                               cur_hgt = panels_y * SCREEN_HGT;
+                               current_floor_ptr->height = panels_y * SCREEN_HGT;
 
                                panels_x = (*x / SCREEN_WID);
                                if (*x % SCREEN_WID) panels_x++;
-                               cur_wid = panels_x * SCREEN_WID;
+                               current_floor_ptr->width = panels_x * SCREEN_WID;
 
                                /* Assume illegal panel */
-                               panel_row_min = cur_hgt;
-                               panel_col_min = cur_wid;
+                               panel_row_min = current_floor_ptr->height;
+                               panel_col_min = current_floor_ptr->width;
 
                                /* Place player in a quest level */
                                if (p_ptr->inside_quest)
@@ -4376,13 +4364,13 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        /* Maximum o_idx */
                        else if (zz[0][0] == 'O')
                        {
-                               max_o_idx = (IDX)atoi(zz[1]);
+                               current_floor_ptr->max_o_idx = (IDX)atoi(zz[1]);
                        }
 
                        /* Maximum m_idx */
                        else if (zz[0][0] == 'M')
                        {
-                               max_m_idx = (IDX)atoi(zz[1]);
+                               current_floor_ptr->max_m_idx = (IDX)atoi(zz[1]);
                        }
 
                        /* Wilderness size */
@@ -4390,10 +4378,10 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        {
                                /* Maximum wild_x_size */
                                if (zz[0][1] == 'X')
-                                       max_wild_x = atoi(zz[1]);
+                                       current_world_ptr->max_wild_x = atoi(zz[1]);
                                /* Maximum wild_y_size */
                                if (zz[0][1] == 'Y')
-                                       max_wild_y = atoi(zz[1]);
+                                       current_world_ptr->max_wild_y = atoi(zz[1]);
                        }
 
                        return (0);