OSDN Git Service

[Refactor] #37353 cnv_stat() と modify_stat_value() を player-status.c/h へ移動。
[hengband/hengband.git] / src / init1.c
index 98720fb..043b22e 100644 (file)
 
 #include "angband.h"
 #include "trap.h"
+#include "monster.h"
+#include "artifact.h"
+#include "cmd-activate.h"
+#include "wild.h"
 
 
 
@@ -62,7 +66,7 @@
  * モンスターの打撃手段トークンの定義 /
  * Monster Blow Methods
  */
-static cptr r_info_blow_method[] =
+static concptr r_info_blow_method[] =
 {
        "",
        "HIT",
@@ -98,7 +102,7 @@ static cptr r_info_blow_method[] =
  * モンスターの打撃属性トークンの定義 /
  * Monster Blow Effects
  */
-static cptr r_info_blow_effect[] =
+static concptr r_info_blow_effect[] =
 {
        "",
        "HURT",
@@ -143,7 +147,7 @@ static cptr r_info_blow_effect[] =
  * 地形属性トークンの定義 /
  * Feature info flags
  */
-static cptr f_info_flags[] =
+static concptr f_info_flags[] =
 {
        "LOS",
        "PROJECT",
@@ -268,7 +272,7 @@ static cptr f_info_flags[] =
  * モンスター特性トークンの定義1 /
  * Monster race flags
  */
-static cptr r_info_flags1[] =
+static concptr r_info_flags1[] =
 {
        "UNIQUE",
        "QUESTOR",
@@ -308,7 +312,7 @@ static cptr r_info_flags1[] =
  * モンスター特性トークンの定義2 /
  * Monster race flags
  */
-static cptr r_info_flags2[] =
+static concptr r_info_flags2[] =
 {
        "STUPID",
        "SMART",
@@ -348,7 +352,7 @@ static cptr r_info_flags2[] =
  * モンスター特性トークンの定義3 /
  * Monster race flags
  */
-static cptr r_info_flags3[] =
+static concptr r_info_flags3[] =
 {
        "ORC",
        "TROLL",
@@ -388,7 +392,7 @@ static cptr r_info_flags3[] =
  * モンスター特性トークンの定義4 /
  * Monster race flags
  */
-static cptr r_info_flags4[] =
+static concptr r_info_flags4[] =
 {
        "SHRIEK",
        "XXX1",
@@ -428,7 +432,7 @@ static cptr r_info_flags4[] =
  * モンスター特性トークン(発動型能力1) /
  * Monster race flags
  */
-static cptr r_a_ability_flags1[] =
+static concptr r_a_ability_flags1[] =
 {
        "BA_ACID",
        "BA_ELEC",
@@ -468,7 +472,7 @@ static cptr r_a_ability_flags1[] =
  * モンスター特性トークン(発動型能力2) /
  * Monster race flags
  */
-static cptr r_a_ability_flags2[] =
+static concptr r_a_ability_flags2[] =
 {
        "HASTE",
        "HAND_DOOM",
@@ -509,7 +513,7 @@ static cptr r_a_ability_flags2[] =
  * モンスター特性トークン(発動型能力3) /
  * Monster race flags
  */
-static cptr r_a_ability_flags3[] =
+static concptr r_a_ability_flags3[] =
 {
        "XXXA3X00",
        "XXXA3X01",
@@ -551,7 +555,7 @@ static cptr r_a_ability_flags3[] =
  * モンスター特性トークン(発動型能力4) /
  * Monster race flags
  */
-static cptr r_a_ability_flags4[] =
+static concptr r_a_ability_flags4[] =
 {
        "XXXA4X00",
        "XXXA4X01",
@@ -593,7 +597,7 @@ static cptr r_a_ability_flags4[] =
  * モンスター特性トークンの定義7 /
  * Monster race flags
  */
-static cptr r_info_flags7[] =
+static concptr r_info_flags7[] =
 {
        "AQUATIC",
        "CAN_SWIM",
@@ -633,7 +637,7 @@ static cptr r_info_flags7[] =
  * モンスター特性トークンの定義8 /
  * Monster race flags
  */
-static cptr r_info_flags8[] =
+static concptr r_info_flags8[] =
 {
        "WILD_ONLY",
        "WILD_TOWN",
@@ -674,7 +678,7 @@ static cptr r_info_flags8[] =
  * モンスター特性トークンの定義9 /
  * Monster race flags
  */
-static cptr r_info_flags9[] =
+static concptr r_info_flags9[] =
 {
        "DROP_CORPSE",
        "DROP_SKELETON",
@@ -716,7 +720,7 @@ static cptr r_info_flags9[] =
  * モンスター特性トークンの定義R(耐性) /
  * Monster race flags
  */
-static cptr r_info_flagsr[] =
+static concptr r_info_flagsr[] =
 {
        "IM_ACID",
        "IM_ELEC",
@@ -757,7 +761,7 @@ static cptr r_info_flagsr[] =
  * オブジェクト基本特性トークンの定義 /
  * Object flags
  */
-static cptr k_info_flags[] =
+static concptr k_info_flags[] =
 {
        "STR",
        "INT",
@@ -908,7 +912,7 @@ static cptr k_info_flags[] =
  * オブジェクト生成特性トークンの定義 /
  * Object flags
  */
-static cptr k_info_gen_flags[] =
+static concptr k_info_gen_flags[] =
 {
        "INSTA_ART",
        "QUESTITEM",
@@ -948,7 +952,7 @@ static cptr k_info_gen_flags[] =
  * ダンジョン特性トークンの定義 /
  * Dungeon flags
  */
-static cptr d_info_flags1[] =
+static concptr d_info_flags1[] =
 {
        "WINNER",
        "MAZE",
@@ -997,7 +1001,7 @@ static cptr d_info_flags1[] =
  * Returns FALSE when there isn't enough space available to store
  * the text.
  */
-static bool add_text(u32b *offset, header *head, cptr buf, bool normal_text)
+static bool add_text(u32b *offset, header *head, concptr buf, bool normal_text)
 {
        /* Hack -- Verify space */
        if (head->text_size + strlen(buf) + 8 > FAKE_TEXT_SIZE)
@@ -1059,7 +1063,7 @@ static bool add_text(u32b *offset, header *head, cptr buf, bool normal_text)
  * Returns FALSE when there isn't enough space available to store
  * the text.
  */
-static bool add_name(u32b *offset, header *head, cptr buf)
+static bool add_name(u32b *offset, header *head, concptr buf)
 {
        /* Hack -- Verify space */
        if (head->name_size + strlen(buf) + 8 > FAKE_NAME_SIZE)
@@ -1094,7 +1098,7 @@ static bool add_name(u32b *offset, header *head, cptr buf)
  * Returns FALSE when there isn't enough space available to store
  * the text.
  */
-static bool add_tag(STR_OFFSET *offset, header *head, cptr buf)
+static bool add_tag(STR_OFFSET *offset, header *head, concptr buf)
 {
        u32b i;
 
@@ -1137,7 +1141,7 @@ static bool add_tag(STR_OFFSET *offset, header *head, cptr buf)
  * @param c シンボル文字
  * @return カラーID
  */
-byte color_char_to_attr(char c)
+TERM_COLOR color_char_to_attr(SYMBOL_CODE c)
 {
        switch (c)
        {
@@ -1547,7 +1551,7 @@ errr parse_m_info(char *buf, header *head)
  * @param what 参照元の文字列ポインタ
  * @return エラーコード
  */
-static errr grab_one_flag(u32b *flags, cptr names[], cptr what)
+static errr grab_one_flag(u32b *flags, concptr names[], concptr what)
 {
        int i;
 
@@ -1572,7 +1576,7 @@ static errr grab_one_flag(u32b *flags, cptr names[], cptr what)
  * @param what 参照元の文字列ポインタ
  * @return エラーコード
  */
-static errr grab_one_feat_flag(feature_type *f_ptr, cptr what)
+static errr grab_one_feat_flag(feature_type *f_ptr, concptr what)
 {
        int i;
 
@@ -1601,7 +1605,7 @@ static errr grab_one_feat_flag(feature_type *f_ptr, cptr what)
  * @param count ステートの保存先ID
  * @return エラーコード
  */
-static errr grab_one_feat_action(feature_type *f_ptr, cptr what, int count)
+static errr grab_one_feat_action(feature_type *f_ptr, concptr what, int count)
 {
        FF_FLAGS_IDX i;
 
@@ -1732,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);
@@ -1744,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 */
@@ -1912,7 +1912,7 @@ errr parse_f_info(char *buf, header *head)
  * @param str タグ文字列
  * @return 地形ID
  */
-s16b f_tag_to_index(cptr str)
+s16b f_tag_to_index(concptr str)
 {
        u16b i;
 
@@ -1999,7 +1999,7 @@ void retouch_f_info(header *head)
  * @param what 参照元の文字列ポインタ
  * @return エラーコード
  */
-static errr grab_one_kind_flag(object_kind *k_ptr, cptr what)
+static errr grab_one_kind_flag(object_kind *k_ptr, concptr what)
 {
        int i;
 
@@ -2028,7 +2028,7 @@ static errr grab_one_kind_flag(object_kind *k_ptr, cptr what)
  * @param what 参照元の文字列ポインタ
  * @return 発動能力ID
  */
-static byte grab_one_activation_flag(cptr what)
+static byte grab_one_activation_flag(concptr what)
 {
        int i;
 
@@ -2186,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);
@@ -2198,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 */
@@ -2338,7 +2334,7 @@ errr parse_k_info(char *buf, header *head)
  * @param what 参照元の文字列ポインタ
  * @return エラーがあった場合1、エラーがない場合0を返す
  */
-static errr grab_one_artifact_flag(artifact_type *a_ptr, cptr what)
+static errr grab_one_artifact_flag(artifact_type *a_ptr, concptr what)
 {
        int i;
 
@@ -2566,7 +2562,7 @@ errr parse_a_info(char *buf, header *head)
  * @param what 参照元の文字列ポインタ
  * @return エラーがあった場合1、エラーがない場合0を返す
  */
-static bool grab_one_ego_item_flag(ego_item_type *e_ptr, cptr what)
+static bool grab_one_ego_item_flag(ego_item_type *e_ptr, concptr what)
 {
        int i;
 
@@ -2780,7 +2776,7 @@ errr parse_e_info(char *buf, header *head)
  * @param what 参照元の文字列ポインタ
  * @return エラーコード
  */
-static errr grab_one_basic_flag(monster_race *r_ptr, cptr what)
+static errr grab_one_basic_flag(monster_race *r_ptr, concptr what)
 {
        if (grab_one_flag(&r_ptr->flags1, r_info_flags1, what) == 0)
                return 0;
@@ -2817,7 +2813,7 @@ static errr grab_one_basic_flag(monster_race *r_ptr, cptr what)
  * @param what 参照元の文字列ポインタ
  * @return エラーコード
  */
-static errr grab_one_spell_flag(monster_race *r_ptr, cptr what)
+static errr grab_one_spell_flag(monster_race *r_ptr, concptr what)
 {
        if (grab_one_flag(&r_ptr->flags4, r_info_flags4, what) == 0)
                return 0;
@@ -2935,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);
@@ -2947,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 */
@@ -3169,7 +3161,7 @@ errr parse_r_info(char *buf, header *head)
  * @param what 参照元の文字列ポインタ
  * @return エラーコード
  */
-static errr grab_one_dungeon_flag(dungeon_info_type *d_ptr, cptr what)
+static errr grab_one_dungeon_flag(dungeon_type *d_ptr, concptr what)
 {
        if (grab_one_flag(&d_ptr->flags1, d_info_flags1, what) == 0)
                return 0;
@@ -3187,7 +3179,7 @@ static errr grab_one_dungeon_flag(dungeon_info_type *d_ptr, cptr what)
  * @param what 参照元の文字列ポインタ
  * @return エラーコード
  */
-static errr grab_one_basic_monster_flag(dungeon_info_type *d_ptr, cptr what)
+static errr grab_one_basic_monster_flag(dungeon_type *d_ptr, concptr what)
 {
        if (grab_one_flag(&d_ptr->mflags1, r_info_flags1, what) == 0)
                return 0;
@@ -3223,7 +3215,7 @@ static errr grab_one_basic_monster_flag(dungeon_info_type *d_ptr, cptr what)
  * @param what 参照元の文字列ポインタ
  * @return エラーコード
  */
-static errr grab_one_spell_monster_flag(dungeon_info_type *d_ptr, cptr what)
+static errr grab_one_spell_monster_flag(dungeon_type *d_ptr, concptr what)
 {
        if (grab_one_flag(&d_ptr->mflags4, r_info_flags4, what) == 0)
                return 0;
@@ -3253,7 +3245,7 @@ errr parse_d_info(char *buf, header *head)
        char *s, *t;
 
        /* Current entry */
-       static dungeon_info_type *d_ptr = NULL;
+       static dungeon_type *d_ptr = NULL;
 
        /* Process 'N' for "New/Number/Name" */
        if (buf[0] == 'N')
@@ -3752,7 +3744,7 @@ static errr parse_line_feature(char *buf)
 static errr parse_line_building(char *buf)
 {
        int i;
-       char *zz[37];
+       char *zz[1000];
        int index;
        char *s;
 
@@ -3838,49 +3830,37 @@ static errr parse_line_building(char *buf)
                /* Building Classes */
                case 'C':
                {
-                       if (tokenize(s + 2, MAX_CLASS, zz, 0) == MAX_CLASS)
-                       {
-                               for (i = 0; i < MAX_CLASS; i++)
-                               {
-                                       building[index].member_class[i] = (CLASS_IDX)atoi(zz[i]);
-                               }
-
-                               break;
+                       int n;
+                       n = tokenize(s + 2, MAX_CLASS, zz, 0);
+                       for (i = 0; i < MAX_CLASS; i++)
+                       {       
+                               building[index].member_class[i] = ((i < n) ? (CLASS_IDX)atoi(zz[i]) : 1);
                        }
-
-                       return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
+                       break;
                }
 
                /* Building Races */
                case 'R':
                {
-                       if (tokenize(s+2, MAX_RACES, zz, 0) == MAX_RACES)
+                       int n;
+                       n = tokenize(s + 2, MAX_RACES, zz, 0);
+                       for (i = 0; i < MAX_RACES; i++)
                        {
-                               for (i = 0; i < MAX_RACES; i++)
-                               {
-                                       building[index].member_race[i] = (RACE_IDX)atoi(zz[i]);
-                               }
-
-                               break;
+                               building[index].member_race[i] = ((i < n) ? (RACE_IDX)atoi(zz[i]) : 1);
                        }
-
-                       return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
+                       break;
                }
 
                /* Building Realms */
                case 'M':
                {
-                       if (tokenize(s+2, MAX_MAGIC, zz, 0) == MAX_MAGIC)
+                       int n;
+                       n = tokenize(s + 2, MAX_MAGIC, zz, 0);
+                       for (i = 0; i < MAX_MAGIC; i++)
                        {
-                               for (i = 0; i < MAX_MAGIC; i++)
-                               {
-                                       building[index].member_realm[i+1] = (REALM_IDX)atoi(zz[i]);
-                               }
-
-                               break;
+                               building[index].member_realm[i+1] = ((i < n) ? (REALM_IDX)atoi(zz[i]) : 1);
                        }
-
-                       return (PARSE_ERROR_TOO_FEW_ARGUMENTS);
+                       break;
                }
 
                case 'Z':
@@ -3909,14 +3889,13 @@ static errr parse_line_building(char *buf)
  */
 static void drop_here(object_type *j_ptr, POSITION y, POSITION x)
 {
-       cave_type *c_ptr = &cave[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
        object_type *o_ptr;
 
-       /* Get new object */
        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);
@@ -3929,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;
 }
 
 
@@ -3979,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;
@@ -3994,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++)
                {
-                       cave_type *c_ptr = &cave[*y][*x];
+                       grid_type *g_ptr = &current_floor_ptr->grid_array[*y][*x];
 
                        int idx = s[0];
 
@@ -4004,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)
                        {
@@ -4056,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;
@@ -4067,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
@@ -4082,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)
@@ -4096,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)
@@ -4106,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)
                        {
@@ -4122,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);
                        }
@@ -4148,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)++;
@@ -4282,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)
@@ -4332,13 +4310,13 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        /* Maximum towns */
                        if (zz[0][0] == 'T')
                        {
-                               max_towns = (IDX)atoi(zz[1]);
+                               max_towns = (TOWN_IDX)atoi(zz[1]);
                        }
 
                        /* Maximum quests */
                        else if (zz[0][0] == 'Q')
                        {
-                               max_q_idx = (IDX)atoi(zz[1]);
+                               max_q_idx = (QUEST_IDX)atoi(zz[1]);
                        }
 
                        /* Maximum r_idx */
@@ -4386,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 */
@@ -4400,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);
@@ -4417,7 +4395,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
 
 
 static char tmp[8];
-static cptr variant = "ZANGBAND";
+static concptr variant = "ZANGBAND";
 
 
 /*!
@@ -4427,9 +4405,9 @@ static cptr variant = "ZANGBAND";
  * @param fp
  * @return エラーコード
  */
-static cptr process_dungeon_file_expr(char **sp, char *fp)
+static concptr process_dungeon_file_expr(char **sp, char *fp)
 {
-       cptr v;
+       concptr v;
 
        char *b;
        char *s;
@@ -4454,8 +4432,8 @@ static cptr process_dungeon_file_expr(char **sp, char *fp)
        /* Analyze */
        if (*s == b1)
        {
-               cptr p;
-               cptr t;
+               concptr p;
+               concptr t;
 
                /* Skip b1 */
                s++;
@@ -4730,8 +4708,6 @@ static cptr process_dungeon_file_expr(char **sp, char *fp)
 
        /* Save */
        (*fp) = f;
-
-       /* Save */
        (*sp) = s;
        return (v);
 }
@@ -4747,7 +4723,7 @@ static cptr process_dungeon_file_expr(char **sp, char *fp)
  * @param xmax 詳細不明
  * @return エラーコード
  */
-errr process_dungeon_file(cptr name, int ymin, int xmin, int ymax, int xmax)
+errr process_dungeon_file(concptr name, int ymin, int xmin, int ymax, int xmax)
 {
        FILE *fp;
        char buf[1024];
@@ -4788,7 +4764,7 @@ errr process_dungeon_file(cptr name, int ymin, int xmin, int ymax, int xmax)
                if ((buf[0] == '?') && (buf[1] == ':'))
                {
                        char f;
-                       cptr v;
+                       concptr v;
                        char *s;
 
                        /* Start */
@@ -4814,7 +4790,7 @@ errr process_dungeon_file(cptr name, int ymin, int xmin, int ymax, int xmax)
        /* Errors */
        if (err)
        {
-               cptr oops;
+               concptr oops;
 
                /* Error string */
                oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
@@ -4837,10 +4813,10 @@ void write_r_info_txt(void)
        int i, j, z, fc, bc;
        int dlen;
 
-       cptr flags[32 * 10];
+       concptr flags[32 * 10];
 
        u32b f_ptr[10];
-       cptr *n_ptr[10];
+       concptr *n_ptr[10];
 
        monster_race *r_ptr;
 
@@ -4848,7 +4824,7 @@ void write_r_info_txt(void)
 
        FILE *fff = fopen("output.txt", "wt");
 
-       cptr desc;
+       concptr desc;
 
        BIT_FLAGS mode = -1;
 
@@ -4934,8 +4910,6 @@ void write_r_info_txt(void)
                                                                                                          r_info_blow_effect[b_ptr->effect],
                                                                                                          b_ptr->d_dice, b_ptr->d_side);
                }
-
-               /* Extract the flags */
                for (fc = 0, j = 0; j < 32 * 3; j++)
                {
                        /* Check this flag */