OSDN Git Service

[Refactor] #37353 コメント整理。 / Refactor comments.
[hengband/hengband.git] / src / init1.c
index 793193d..672f163 100644 (file)
@@ -963,8 +963,8 @@ static cptr d_info_flags1[] =
        "CAVE",
        "CAVERN",
        "ARCADE",
-       "XXX",
-       "XXX",
+       "LAKE_ACID",
+       "LAKE_POISONOUS",
        "XXX",
        "FORGET",
        "LAKE_WATER",
@@ -980,8 +980,8 @@ static cptr d_info_flags1[] =
        "NO_MELEE",
        "CHAMELEON",
        "DARKNESS",
-       "XXX",
-       "XXX"
+       "ACID_RIVER",
+       "POISONOUS_RIVER"
 };
 
 
@@ -1177,8 +1177,7 @@ byte color_char_to_attr(char c)
  * @param parse_info_txt_line パース関数
  * @return エラーコード
  */
-errr init_info_txt(FILE *fp, char *buf, header *head,
-                  parse_info_txt_func parse_info_txt_line)
+errr init_info_txt(FILE *fp, char *buf, header *head, parse_info_txt_func parse_info_txt_line)
 {
        errr err;
 
@@ -1318,7 +1317,6 @@ errr parse_v_info(char *buf, header *head)
                v_ptr->wid = (POSITION)wid;
        }
 
-       /* Oops */
        else    return (6);
 
        /* Success */
@@ -1403,7 +1401,6 @@ errr parse_s_info(char *buf, header *head)
        }
 
 
-       /* Oops */
        else return (6);
 
        /* Success */
@@ -1535,7 +1532,6 @@ errr parse_m_info(char *buf, header *head)
        }
 
 
-       /* Oops */
        else return (6);
 
        /* Success */
@@ -1590,7 +1586,6 @@ static errr grab_one_feat_flag(feature_type *f_ptr, cptr what)
                }
        }
 
-       /* Oops */
        msg_format(_("未知の地形フラグ '%s'。", "Unknown feature flag '%s'."), what);
 
        /* Error */
@@ -1620,7 +1615,6 @@ static errr grab_one_feat_action(feature_type *f_ptr, cptr what, int count)
                }
        }
 
-       /* Oops */
        msg_format(_("未知の地形アクション '%s'。", "Unknown feature action '%s'."), what);
 
        /* Error */
@@ -1822,7 +1816,7 @@ errr parse_f_info(char *buf, header *head)
                                while (*t == ' ' || *t == '|') t++;
                        }
 
-                       /* XXX XXX XXX Hack -- Read feature subtype */
+                       /* Hack -- Read feature subtype */
                        if (1 == sscanf(s, "SUBTYPE_%d", &i))
                        {
                                /* Extract a "subtype" */
@@ -1831,11 +1825,10 @@ errr parse_f_info(char *buf, header *head)
                                /* Start at next entry */
                                s = t;
 
-                               /* Continue */
                                continue;
                        }
 
-                       /* XXX XXX XXX Hack -- Read feature power */
+                       /* Hack -- Read feature power */
                        if (1 == sscanf(s, "POWER_%d", &i))
                        {
                                /* Extract a "power" */
@@ -1843,8 +1836,6 @@ errr parse_f_info(char *buf, header *head)
 
                                /* Start at next entry */
                                s = t;
-
-                               /* Continue */
                                continue;
                        }
 
@@ -1908,7 +1899,6 @@ errr parse_f_info(char *buf, header *head)
                }
        }
 
-       /* Oops */
        else return (6);
 
        /* Success */
@@ -2026,7 +2016,6 @@ static errr grab_one_kind_flag(object_kind *k_ptr, cptr what)
        if (grab_one_flag(&k_ptr->gen_flags, k_info_gen_flags, what) == 0)
                return 0;
 
-       /* Oops */
        msg_format(_("未知のアイテム・フラグ '%s'。", "Unknown object flag '%s'."), what);
 
        /* Error */
@@ -2059,7 +2048,6 @@ static byte grab_one_activation_flag(cptr what)
                 return ((byte) i);
         }
 
-       /* Oops */
        msg_format(_("未知の発動・フラグ '%s'。", "Unknown activation flag '%s'."), what);
 
        /* Error */
@@ -2255,7 +2243,7 @@ errr parse_k_info(char *buf, header *head)
        else if (buf[0] == 'A')
        {
 
-               /* XXX XXX XXX Simply read each number following a colon */
+               /* Simply read each number following a colon */
                for (i = 0, s = buf+1; s && (s[0] == ':') && s[1]; ++i)
                {
                                /* Default chance */
@@ -2336,7 +2324,6 @@ errr parse_k_info(char *buf, header *head)
        }
 
 
-       /* Oops */
        else return (6);
 
 
@@ -2368,7 +2355,6 @@ static errr grab_one_artifact_flag(artifact_type *a_ptr, cptr what)
        if (grab_one_flag(&a_ptr->gen_flags, k_info_gen_flags, what) == 0)
                return 0;
 
-       /* Oops */
        msg_format(_("未知の伝説のアイテム・フラグ '%s'。", "Unknown artifact flag '%s'."), what);
 
        /* Error */
@@ -2565,7 +2551,6 @@ errr parse_a_info(char *buf, header *head)
        }
 
 
-       /* Oops */
        else return (6);
 
 
@@ -2598,7 +2583,6 @@ static bool grab_one_ego_item_flag(ego_item_type *e_ptr, cptr what)
        if (grab_one_flag(&e_ptr->gen_flags, k_info_gen_flags, what) == 0)
                return 0;
 
-       /* Oops */
        msg_format(_("未知の名のあるアイテム・フラグ '%s'。", "Unknown ego-item flag '%s'."), what);
 
        /* Error */
@@ -2616,27 +2600,24 @@ static bool grab_one_ego_item_flag(ego_item_type *e_ptr, cptr what)
 errr parse_e_info(char *buf, header *head)
 {
        int i;
-
        char *s, *t;
 
        /* Current entry */
        static ego_item_type *e_ptr = NULL;
 
-
        /* Just before the first record */
        error_idx = -1;
 
        /* Just before the first line */
        error_line = -1;
 
-
        /* Process 'N' for "New/Number/Name" */
        if (buf[0] == 'N')
        {
                /* Find the colon before the name */
                s = my_strchr(buf+2, ':');
 
-                       /* Verify that colon */
+               /* Verify that colon */
                if (!s) return (1);
 
                /* Nuke the colon, advance to the name */
@@ -2785,7 +2766,6 @@ errr parse_e_info(char *buf, header *head)
                }
        }
 
-       /* Oops */
        else return (6);
 
        /* Success */
@@ -2823,7 +2803,6 @@ static errr grab_one_basic_flag(monster_race *r_ptr, cptr what)
        if (grab_one_flag(&r_ptr->flagsr, r_info_flagsr, what) == 0)
                return 0;
 
-       /* Oops */
        msg_format(_("未知のモンスター・フラグ '%s'。", "Unknown monster flag '%s'."), what);
 
        /* Failure */
@@ -2849,7 +2828,6 @@ static errr grab_one_spell_flag(monster_race *r_ptr, cptr what)
        if (grab_one_flag(&r_ptr->a_ability_flags2, r_a_ability_flags2, what) == 0)
                return 0;
 
-       /* Oops */
        msg_format(_("未知のモンスター・フラグ '%s'。", "Unknown monster flag '%s'."), what);
 
        /* Failure */
@@ -2867,7 +2845,6 @@ static errr grab_one_spell_flag(monster_race *r_ptr, cptr what)
 errr parse_r_info(char *buf, header *head)
 {
        int i;
-
        char *s, *t;
 
        /* Current entry */
@@ -3023,7 +3000,7 @@ errr parse_r_info(char *buf, header *head)
        {
                int id, ds, dd;
                /* Find the next empty blow slot (if any) */
-               for (i = 0; i < 6; i++) if (r_ptr->reinforce_id[i] == 0) break;
+               for (i = 0; i < A_MAX; i++) if (r_ptr->reinforce_id[i] == 0) break;
 
                /* Oops, no more slots */
                if (i == 6) return (1);
@@ -3133,7 +3110,7 @@ errr parse_r_info(char *buf, header *head)
                                while ((*t == ' ') || (*t == '|')) t++;
                        }
 
-                               /* XXX XXX XXX Hack -- Read spell frequency */
+                               /* Hack -- Read spell frequency */
                        if (1 == sscanf(s, "1_IN_%d", &i))
                        {
                                /* Extract a "frequency" */
@@ -3141,8 +3118,6 @@ errr parse_r_info(char *buf, header *head)
 
                                        /* Start at next entry */
                                s = t;
-
-                               /* Continue */
                                continue;
                        }
 
@@ -3179,7 +3154,6 @@ errr parse_r_info(char *buf, header *head)
                r_ptr->arena_ratio = (PERCENTAGE)val;
        }
 
-       /* Oops */
        else return (6);
 
 
@@ -3200,7 +3174,6 @@ static errr grab_one_dungeon_flag(dungeon_info_type *d_ptr, cptr what)
        if (grab_one_flag(&d_ptr->flags1, d_info_flags1, what) == 0)
                return 0;
 
-       /* Oops */
        msg_format(_("未知のダンジョン・フラグ '%s'。", "Unknown dungeon type flag '%s'."), what);
 
        /* Failure */
@@ -3237,7 +3210,6 @@ static errr grab_one_basic_monster_flag(dungeon_info_type *d_ptr, cptr what)
        if (grab_one_flag(&d_ptr->mflagsr, r_info_flagsr, what) == 0)
                return 0;
 
-       /* Oops */
        msg_format(_("未知のモンスター・フラグ '%s'。", "Unknown monster flag '%s'."), what);
        /* Failure */
        return (1);
@@ -3262,7 +3234,6 @@ static errr grab_one_spell_monster_flag(dungeon_info_type *d_ptr, cptr what)
        if (grab_one_flag(&d_ptr->m_a_ability_flags2, r_a_ability_flags2, what) == 0)
                return 0;
 
-       /* Oops */
        msg_format(_("未知のモンスター・フラグ '%s'。", "Unknown monster flag '%s'."), what);
 
        /* Failure */
@@ -3279,13 +3250,11 @@ static errr grab_one_spell_monster_flag(dungeon_info_type *d_ptr, cptr what)
 errr parse_d_info(char *buf, header *head)
 {
        int i;
-
        char *s, *t;
 
        /* Current entry */
        static dungeon_info_type *d_ptr = NULL;
 
-
        /* Process 'N' for "New/Number/Name" */
        if (buf[0] == 'N')
        {
@@ -3459,7 +3428,7 @@ errr parse_d_info(char *buf, header *head)
                                while (*t == ' ' || *t == '|') t++;
                        }
 
-                       /* XXX XXX XXX Hack -- Read Final Artifact */
+                       /* Hack -- Read Final Artifact */
                        if (1 == sscanf(s, "FINAL_ARTIFACT_%d", &artif))
                        {
                                /* Extract a "Final Artifact" */
@@ -3467,12 +3436,10 @@ errr parse_d_info(char *buf, header *head)
 
                                /* Start at next entry */
                                s = t;
-
-                               /* Continue */
                                continue;
                        }
 
-                       /* XXX XXX XXX Hack -- Read Final Object */
+                       /* Hack -- Read Final Object */
                        if (1 == sscanf(s, "FINAL_OBJECT_%d", &artif))
                        {
                                /* Extract a "Final Artifact" */
@@ -3480,12 +3447,10 @@ errr parse_d_info(char *buf, header *head)
 
                                /* Start at next entry */
                                s = t;
-
-                               /* Continue */
                                continue;
                        }
 
-                       /* XXX XXX XXX Hack -- Read Artifact Guardian */
+                       /* Hack -- Read Artifact Guardian */
                        if (1 == sscanf(s, "FINAL_GUARDIAN_%d", &monst))
                        {
                                /* Extract a "Artifact Guardian" */
@@ -3493,12 +3458,10 @@ errr parse_d_info(char *buf, header *head)
 
                                /* Start at next entry */
                                s = t;
-
-                               /* Continue */
                                continue;
                        }
 
-                       /* XXX XXX XXX Hack -- Read Special Percentage */
+                       /* Hack -- Read Special Percentage */
                        if (1 == sscanf(s, "MONSTER_DIV_%d", &monst))
                        {
                                /* Extract a "Special %" */
@@ -3506,8 +3469,6 @@ errr parse_d_info(char *buf, header *head)
 
                                /* Start at next entry */
                                s = t;
-
-                               /* Continue */
                                continue;
                        }
 
@@ -3546,8 +3507,6 @@ errr parse_d_info(char *buf, header *head)
 
                                /* Start at next entry */
                                s = t;
-
-                               /* Continue */
                                continue;
                        }
 
@@ -3575,13 +3534,11 @@ errr parse_d_info(char *buf, header *head)
                                while ((*t == ' ') || (*t == '|')) t++;
                        }
 
-                               /* XXX XXX XXX Hack -- Read spell frequency */
+                               /* Hack -- Read spell frequency */
                        if (1 == sscanf(s, "1_IN_%d", &i))
                        {
                                /* Start at next entry */
                                s = t;
-
-                                       /* Continue */
                                continue;
                        }
 
@@ -3593,7 +3550,6 @@ errr parse_d_info(char *buf, header *head)
                }
        }
 
-       /* Oops */
        else return (6);
 
        /* Success */
@@ -3632,7 +3588,7 @@ struct dungeon_grid
        IDX trap;                       /* Trap */
        BIT_FLAGS cave_info;            /* Flags for CAVE_MARK, CAVE_GLOW, CAVE_ICKY, CAVE_ROOM */
        s16b special; /* Reserved for special terrain info */
-       int             random;                 /* Number of the random effect */
+       int random;                     /* Number of the random effect */
 };
 
 
@@ -3650,7 +3606,6 @@ static errr parse_line_feature(char *buf)
        int num;
        char *zz[9];
 
-
        if (init_flags & INIT_ONLY_BUILDINGS) return (0);
 
        /* Tokenize the line */
@@ -3957,7 +3912,6 @@ static void drop_here(object_type *j_ptr, POSITION y, POSITION x)
        cave_type *c_ptr = &cave[y][x];
        object_type *o_ptr;
 
-       /* Get new object */
        OBJECT_IDX o_idx = o_pop();
 
        /* Access new object */
@@ -3966,7 +3920,6 @@ static void drop_here(object_type *j_ptr, POSITION y, POSITION x)
        /* Structure copy */
        object_copy(o_ptr, j_ptr);
 
-
        /* Locate */
        o_ptr->iy = y;
        o_ptr->ix = x;
@@ -3997,10 +3950,8 @@ static void drop_here(object_type *j_ptr, POSITION y, POSITION x)
 static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, int xmax, int *y, int *x)
 {
        int i;
-
        char *zz[33];
 
-
        /* Skip "empty" lines */
        if (!buf[0]) return (0);
 
@@ -4042,15 +3993,14 @@ 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++)
                {
-                       /* Access the grid */
                        cave_type *c_ptr = &cave[*y][*x];
 
                        int idx = s[0];
 
-                       IDX object_index = letter[idx].object;
-                       IDX monster_index = letter[idx].monster;
+                       OBJECT_IDX object_index = letter[idx].object;
+                       MONSTER_IDX monster_index = letter[idx].monster;
                        int random = letter[idx].random;
-                       IDX artifact_index = letter[idx].artifact;
+                       ARTIFACT_IDX artifact_index = letter[idx].artifact;
 
                        /* Lay down a floor */
                        c_ptr->feat = conv_dungeon_feat(letter[idx].feature);
@@ -4160,10 +4110,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                        }
                        else if (object_index)
                        {
-                               /* Get local object */
                                object_type *o_ptr = &object_type_body;
-
-                               /* Create the item */
                                object_prep(o_ptr, object_index);
 
                                if (o_ptr->tval == TV_GOLD)
@@ -4189,8 +4136,6 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                        object_type *q_ptr = &forge;
 
                                        object_prep(q_ptr, k_idx);
-
-                                       /* Drop it in the dungeon */
                                        drop_here(q_ptr, *y, *x);
                                }
                                else
@@ -4349,7 +4294,7 @@ static errr process_dungeon_file_aux(char *buf, int ymin, int xmin, int ymax, in
                                /* Place player in a quest level */
                                if (p_ptr->inside_quest)
                                {
-                                       int py, px;
+                                       POSITION py, px;
 
                                        /* Delete the monster (if any) */
                                        delete_monster(p_ptr->y, p_ptr->x);
@@ -4508,8 +4453,8 @@ static cptr process_dungeon_file_expr(char **sp, char *fp)
        /* Analyze */
        if (*s == b1)
        {
-               const char *p;
-               const char *t;
+               cptr p;
+               cptr t;
 
                /* Skip b1 */
                s++;
@@ -4517,7 +4462,6 @@ static cptr process_dungeon_file_expr(char **sp, char *fp)
                /* First */
                t = process_dungeon_file_expr(&s, &f);
 
-               /* Oops */
                if (!*t)
                {
                        /* Nothing */
@@ -4605,7 +4549,6 @@ static cptr process_dungeon_file_expr(char **sp, char *fp)
                        }
                }
 
-               /* Oops */
                else
                {
                        while (*s && (f != b2))
@@ -4789,8 +4732,6 @@ static cptr process_dungeon_file_expr(char **sp, char *fp)
 
        /* Save */
        (*sp) = s;
-
-       /* Result */
        return (v);
 }
 
@@ -4857,8 +4798,6 @@ errr process_dungeon_file(cptr name, int ymin, int xmin, int ymax, int xmax)
 
                        /* Set flag */
                        bypass = (streq(v, "0") ? TRUE : FALSE);
-
-                       /* Continue */
                        continue;
                }
 
@@ -4868,7 +4807,6 @@ errr process_dungeon_file(cptr name, int ymin, int xmin, int ymax, int xmax)
                /* Process the line */
                err = process_dungeon_file_aux(buf, ymin, xmin, ymax, xmax, &y, &x);
 
-               /* Oops */
                if (err) break;
        }
 
@@ -4880,18 +4818,13 @@ errr process_dungeon_file(cptr name, int ymin, int xmin, int ymax, int xmax)
                /* Error string */
                oops = (((err > 0) && (err < PARSE_ERROR_MAX)) ? err_str[err] : "unknown");
 
-               /* Oops */
                msg_format("Error %d (%s) at line %d of '%s'.", err, oops, num, name);
                msg_format(_("'%s'を解析中。", "Parsing '%s'."), buf);
 
                msg_print(NULL);
        }
 
-
-       /* Close the file */
        my_fclose(fp);
-
-       /* Result */
        return (err);
 }
 
@@ -5000,8 +4933,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 */
@@ -5111,7 +5042,6 @@ void write_r_info_txt(void)
                fprintf(fff, "\n");
        }
 
-       /* Done */
        fclose(fff);
 }