OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / cave.c
index 3a30d0b..b3d518c 100644 (file)
@@ -661,7 +661,7 @@ static char image_object_hack[] = "?/|\\\"!$()_-=[]{},~";
  * @param cp 本来のシンボル
  * @return なし
  */
-static void image_monster(byte *ap, char *cp)
+static void image_monster(TERM_COLOR *ap, char *cp)
 {
        /* Random symbol from set above */
        if (use_graphics)
@@ -689,7 +689,7 @@ static void image_monster(byte *ap, char *cp)
  * @param cp 本来のシンボル
  * @return なし
  */
-static void image_object(byte *ap, char *cp)
+static void image_object(TERM_COLOR *ap, char *cp)
 {
        if (use_graphics)
        {
@@ -716,7 +716,7 @@ static void image_object(byte *ap, char *cp)
  * @param cp 本来のシンボル
  * @return なし
  */
-static void image_random(byte *ap, char *cp)
+static void image_random(TERM_COLOR *ap, char *cp)
 {
        /* Normally, assume monsters */
        if (randint0(100) < 75)
@@ -795,9 +795,9 @@ static byte lighting_colours[16][2] =
  * @brief 調査中
  * @todo コメントを付加すること
  */
-void apply_default_feat_lighting(byte f_attr[F_LIT_MAX], byte f_char[F_LIT_MAX])
+void apply_default_feat_lighting(TERM_COLOR f_attr[F_LIT_MAX], byte f_char[F_LIT_MAX])
 {
-       byte s_attr = f_attr[F_LIT_STANDARD];
+       TERM_COLOR s_attr = f_attr[F_LIT_STANDARD];
        byte s_char = f_char[F_LIT_STANDARD];
        int i;
 
@@ -942,20 +942,20 @@ void apply_default_feat_lighting(byte f_attr[F_LIT_MAX], byte f_char[F_LIT_MAX])
  * "x_ptr->xxx", is quicker than "x_info[x].xxx", if this is incorrect\n
  * then a whole lot of code should be changed...  XXX XXX\n
  */
-void map_info(POSITION y, POSITION x, byte *ap, char *cp, byte *tap, char *tcp)
+void map_info(POSITION y, POSITION x, TERM_COLOR *ap, char *cp, TERM_COLOR *tap, char *tcp)
 {
        /* Get the cave */
        cave_type *c_ptr = &cave[y][x];
 
-       s16b this_o_idx, next_o_idx = 0;
+       OBJECT_IDX this_o_idx, next_o_idx = 0;
 
        /* Feature code (applying "mimic" field) */
-       s16b feat = get_feat_mimic(c_ptr);
+       FEAT_IDX feat = get_feat_mimic(c_ptr);
 
        /* Access floor */
        feature_type *f_ptr = &f_info[feat];
 
-       byte a;
+       TERM_COLOR a;
        byte c;
 
        /* Boring grids (floors, etc) */
@@ -1236,7 +1236,6 @@ void map_info(POSITION y, POSITION x, byte *ap, char *cp, byte *tap, char *tcp)
                        /* Hack -- hallucination */
                        if (p_ptr->image) image_object(ap, cp);
 
-                       /* Done */
                        break;
                }
        }
@@ -1404,7 +1403,7 @@ void move_cursor_relative(int row, int col)
 /*
  * Place an attr/char pair at the given map coordinate, if legal.
  */
-void print_rel(char c, byte a, TERM_POSITION y, TERM_POSITION x)
+void print_rel(char c, byte a, TERM_LEN y, TERM_LEN x)
 {
        /* Only do "legal" locations */
        if (panel_contains(y, x))
@@ -1562,11 +1561,11 @@ void note_spot(POSITION y, POSITION x)
 
 void display_dungeon(void)
 {
-       TERM_POSITION x, y;
-       byte a;
+       TERM_LEN x, y;
+       TERM_COLOR a;
        char c;
 
-       byte ta = 0;
+       TERM_COLOR ta = 0;
        char tc = '\0';
 
        for (x = p_ptr->x - Term->wid / 2 + 1; x <= p_ptr->x + Term->wid / 2; x++)
@@ -1621,10 +1620,10 @@ void lite_spot(POSITION y, POSITION x)
        /* Redraw if on screen */
        if (panel_contains(y, x) && in_bounds2(y, x))
        {
-               byte a;
+               TERM_COLOR a;
                char c;
 
-               byte ta;
+               TERM_COLOR ta;
                char tc;
 
                /* Examine the grid */
@@ -1664,7 +1663,6 @@ void prt_map(void)
 
        int wid, hgt;
 
-       /* Get size */
        Term_get_size(&wid, &hgt);
 
        /* Remove map offset */
@@ -1703,10 +1701,10 @@ void prt_map(void)
                /* Scan the columns of row "y" */
                for (x = xmin; x <= xmax; x++)
                {
-                       byte a;
+                       TERM_COLOR a;
                        char c;
 
-                       byte ta;
+                       TERM_COLOR ta;
                        char tc;
 
                        /* Determine what is there */
@@ -1766,10 +1764,10 @@ void prt_path(POSITION y, POSITION x)
 
                if (panel_contains(ny, nx))
                {
-                       byte a = default_color;
+                       TERM_COLOR a = default_color;
                        char c;
 
-                       byte ta;
+                       TERM_COLOR ta;
                        char tc;
 
                        if (c_ptr->m_idx && m_list[c_ptr->m_idx].ml)
@@ -1837,7 +1835,7 @@ static void display_shortened_item_name(object_type *o_ptr, int y)
        char buf[MAX_NLEN];
        char *c = buf;
        int len = 0;
-       byte attr;
+       TERM_COLOR attr;
 
        object_desc(buf, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NAME_ONLY));
        attr = tval_to_attr[o_ptr->tval % 128];
@@ -1908,16 +1906,16 @@ void display_map(int *cy, int *cx)
 {
        int i, j, x, y;
 
-       byte ta;
+       TERM_COLOR ta;
        char tc;
 
        byte tp;
 
-       byte **bigma;
+       TERM_COLOR **bigma;
        char **bigmc;
        byte **bigmp;
 
-       byte **ma;
+       TERM_COLOR **ma;
        char **mc;
        byte **mp;
 
@@ -1930,7 +1928,6 @@ void display_map(int *cy, int *cx)
        int **match_autopick_yx;
        object_type ***object_autopick_yx;
 
-       /* Get size */
        Term_get_size(&wid, &hgt);
        hgt -= 2;
        wid -= 14;
@@ -1944,7 +1941,7 @@ void display_map(int *cy, int *cx)
        view_granite_lite = FALSE;
 
        /* Allocate the maps */
-       C_MAKE(ma, (hgt + 2), byte_ptr);
+       C_MAKE(ma, (hgt + 2), TERM_COLOR *);
        C_MAKE(mc, (hgt + 2), char_ptr);
        C_MAKE(mp, (hgt + 2), byte_ptr);
        C_MAKE(match_autopick_yx, (hgt + 2), sint_ptr);
@@ -1954,7 +1951,7 @@ void display_map(int *cy, int *cx)
        for (y = 0; y < (hgt + 2); y++)
        {
                /* Allocate one row each array */
-               C_MAKE(ma[y], (wid + 2), byte);
+               C_MAKE(ma[y], (wid + 2), TERM_COLOR);
                C_MAKE(mc[y], (wid + 2), char);
                C_MAKE(mp[y], (wid + 2), byte);
                C_MAKE(match_autopick_yx[y], (wid + 2), int);
@@ -1975,7 +1972,7 @@ void display_map(int *cy, int *cx)
        }
 
        /* Allocate the maps */
-       C_MAKE(bigma, (cur_hgt + 2), byte_ptr);
+       C_MAKE(bigma, (cur_hgt + 2), TERM_COLOR *);
        C_MAKE(bigmc, (cur_hgt + 2), char_ptr);
        C_MAKE(bigmp, (cur_hgt + 2), byte_ptr);
 
@@ -1983,7 +1980,7 @@ void display_map(int *cy, int *cx)
        for (y = 0; y < (cur_hgt + 2); y++)
        {
                /* Allocate one row each array */
-               C_MAKE(bigma[y], (cur_wid + 2), byte);
+               C_MAKE(bigma[y], (cur_wid + 2), TERM_COLOR);
                C_MAKE(bigmc[y], (cur_wid + 2), char);
                C_MAKE(bigmp[y], (cur_wid + 2), byte);
 
@@ -2003,7 +2000,6 @@ void display_map(int *cy, int *cx)
        {
                for (j = 0; j < cur_hgt; ++j)
                {
-                       /* Location */
                        x = i / xrat + 1;
                        y = j / yrat + 1;
 
@@ -2037,7 +2033,6 @@ void display_map(int *cy, int *cx)
        {
                for (i = 0; i < cur_wid; ++i)
                {
-                       /* Location */
                        x = i / xrat + 1;
                        y = j / yrat + 1;
 
@@ -2157,7 +2152,7 @@ void display_map(int *cy, int *cx)
        for (y = 0; y < (hgt + 2); y++)
        {
                /* Free one row each array */
-               C_KILL(ma[y], (wid + 2), byte);
+               C_KILL(ma[y], (wid + 2), TERM_COLOR);
                C_KILL(mc[y], (wid + 2), char);
                C_KILL(mp[y], (wid + 2), byte);
                C_KILL(match_autopick_yx[y], (wid + 2), int);
@@ -2165,7 +2160,7 @@ void display_map(int *cy, int *cx)
        }
 
        /* Free each line map */
-       C_KILL(ma, (hgt + 2), byte_ptr);
+       C_KILL(ma, (hgt + 2), TERM_COLOR *);
        C_KILL(mc, (hgt + 2), char_ptr);
        C_KILL(mp, (hgt + 2), byte_ptr);
        C_KILL(match_autopick_yx, (hgt + 2), sint_ptr);
@@ -2175,13 +2170,13 @@ void display_map(int *cy, int *cx)
        for (y = 0; y < (cur_hgt + 2); y++)
        {
                /* Free one row each array */
-               C_KILL(bigma[y], (cur_wid + 2), byte);
+               C_KILL(bigma[y], (cur_wid + 2), TERM_COLOR);
                C_KILL(bigmc[y], (cur_wid + 2), char);
                C_KILL(bigmp[y], (cur_wid + 2), byte);
        }
 
        /* Free each line map */
-       C_KILL(bigma, (cur_hgt + 2), byte_ptr);
+       C_KILL(bigma, (cur_hgt + 2), TERM_COLOR *);
        C_KILL(bigmc, (cur_hgt + 2), char_ptr);
        C_KILL(bigmp, (cur_hgt + 2), byte_ptr);
 }
@@ -2190,7 +2185,7 @@ void display_map(int *cy, int *cx)
 /*
  * Display a "small-scale" map of the dungeon for the player
  *
- * Currently, the "player" is displayed on the map.  XXX XXX XXX
+ * Currently, the "player" is displayed on the map.  
  */
 void do_cmd_view_map(void)
 {
@@ -2203,7 +2198,6 @@ void do_cmd_view_map(void)
        /* Note */
        prt(_("お待ち下さい...", "Please wait..."), 0, 0);
 
-       /* Flush */
        Term_fresh();
 
        /* Clear the screen */
@@ -2544,8 +2538,6 @@ void forget_lite(void)
 
 
 /*
- * XXX XXX XXX
- *
  * This macro allows us to efficiently add a grid to the "lite" array,
  * note that we are never called for illegal grids, or for grids which
  * have already been placed into the "lite" array, and we are never
@@ -3337,8 +3329,6 @@ void forget_view(void)
        {
                POSITION y = view_y[i];
                POSITION x = view_x[i];
-
-               /* Access the grid */
                c_ptr = &cave[y][x];
 
                /* Forget that the grid is viewable */
@@ -3419,8 +3409,6 @@ static bool update_view_aux(POSITION y, POSITION x, POSITION y1, POSITION x1, PO
        /* Totally blocked by "unviewable neighbors" */
        if (!v1 && !v2) return (TRUE);
 
-
-       /* Access the grid */
        c_ptr = &cave[y][x];
 
 
@@ -3620,8 +3608,6 @@ void update_view(void)
        {
                y = view_y[n];
                x = view_x[n];
-
-               /* Access the grid */
                c_ptr = &cave[y][x];
 
                /* Mark the grid as not in "view" */
@@ -3644,8 +3630,6 @@ void update_view(void)
        /* Now start on the player */
        y = p_ptr->y;
        x = p_ptr->x;
-
-       /* Access the grid */
        c_ptr = &cave[y][x];
 
        /* Assume the player grid is easily viewable */
@@ -3993,8 +3977,6 @@ void update_view(void)
        {
                y = view_y[n];
                x = view_x[n];
-
-               /* Access the grid */
                c_ptr = &cave[y][x];
 
                /* Clear the "CAVE_XTRA" flag */
@@ -4012,8 +3994,6 @@ void update_view(void)
        {
                y = temp_y[n];
                x = temp_x[n];
-
-               /* Access the grid */
                c_ptr = &cave[y][x];
 
                /* No longer in the array */
@@ -4048,8 +4028,6 @@ void delayed_visual_update(void)
        {
                y = redraw_y[i];
                x = redraw_x[i];
-
-               /* Access the grid */
                c_ptr = &cave[y][x];
 
                /* Update only needed grids (prevent multiple updating) */
@@ -4229,8 +4207,8 @@ static int scent_when = 0;
  */
 void update_smell(void)
 {
-       int i, j;
-       int y, x;
+       POSITION i, j;
+       POSITION y, x;
 
        /* Create a table that controls the spread of scent */
        const int scent_adjust[5][5] = 
@@ -4297,10 +4275,11 @@ void update_smell(void)
  */
 void map_area(POSITION range)
 {
-       int             i, x, y;
-       cave_type       *c_ptr;
-       s16b            feat;
-       feature_type    *f_ptr;
+       int i;
+       POSITION x, y;
+       cave_type *c_ptr;
+       FEAT_IDX feat;
+       feature_type *f_ptr;
 
        if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
 
@@ -4353,7 +4332,6 @@ void map_area(POSITION range)
        /* Redraw map */
        p_ptr->redraw |= (PR_MAP);
 
-       /* Window stuff */
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 }
 
@@ -4377,8 +4355,9 @@ void map_area(POSITION range)
  */
 void wiz_lite(bool ninja)
 {
-       int i, y, x;
-       s16b feat;
+       OBJECT_IDX i;
+       POSITION y, x;
+       FEAT_IDX feat;
        feature_type *f_ptr;
 
        /* Memorize objects */
@@ -4460,7 +4439,6 @@ void wiz_lite(bool ninja)
        /* Redraw map */
        p_ptr->redraw |= (PR_MAP);
 
-       /* Window stuff */
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
        if (p_ptr->special_defense & NINJA_S_STEALTH)
@@ -4475,8 +4453,8 @@ void wiz_lite(bool ninja)
  */
 void wiz_dark(void)
 {
-       int i, y, x;
-
+       OBJECT_IDX i;
+       POSITION y, x;
 
        /* Forget every grid */
        for (y = 1; y < cur_hgt - 1; y++)
@@ -4535,18 +4513,13 @@ void wiz_dark(void)
        /* Redraw map */
        p_ptr->redraw |= (PR_MAP);
 
-       /* Window stuff */
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 }
 
-
-
-
-
 /*
  * Change the "feat" flag for a grid, and notice/redraw the grid
  */
-void cave_set_feat(POSITION y, POSITION x, IDX feat)
+void cave_set_feat(POSITION y, POSITION x, FEAT_IDX feat)
 {
        cave_type *c_ptr = &cave[y][x];
        feature_type *f_ptr = &f_info[feat];
@@ -4563,7 +4536,8 @@ void cave_set_feat(POSITION y, POSITION x, IDX feat)
                /* Hack -- glow the GLOW terrain */
                if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
                {
-                       int i, yy, xx;
+                       DIRECTION i;
+                       POSITION yy, xx;
 
                        for (i = 0; i < 9; i++)
                        {
@@ -4603,7 +4577,6 @@ void cave_set_feat(POSITION y, POSITION x, IDX feat)
        /* Update the monster */
        if (c_ptr->m_idx) update_mon(c_ptr->m_idx, FALSE);
 
-       /* Notice */
        note_spot(y, x);
 
        /* Redraw */
@@ -4626,7 +4599,8 @@ void cave_set_feat(POSITION y, POSITION x, IDX feat)
        /* Hack -- glow the GLOW terrain */
        if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
        {
-               int i, yy, xx;
+               DIRECTION i;
+               POSITION yy, xx;
                cave_type *cc_ptr;
 
                for (i = 0; i < 9; i++)
@@ -4642,7 +4616,6 @@ void cave_set_feat(POSITION y, POSITION x, IDX feat)
                                /* Update the monster */
                                if (cc_ptr->m_idx) update_mon(cc_ptr->m_idx, FALSE);
 
-                               /* Notice */
                                note_spot(yy, xx);
 
                                /* Redraw */
@@ -4660,7 +4633,7 @@ void cave_set_feat(POSITION y, POSITION x, IDX feat)
 }
 
 
-IDX conv_dungeon_feat(IDX newfeat)
+FEAT_IDX conv_dungeon_feat(FEAT_IDX newfeat)
 {
        feature_type *f_ptr = &f_info[newfeat];
 
@@ -4694,7 +4667,7 @@ IDX conv_dungeon_feat(IDX newfeat)
  * Take a feature, determine what that feature becomes
  * through applying the given action.
  */
-IDX feat_state(IDX feat, int action)
+FEAT_IDX feat_state(FEAT_IDX feat, int action)
 {
        feature_type *f_ptr = &f_info[feat];
        int i;
@@ -4789,7 +4762,6 @@ void remove_mirror(POSITION y, POSITION x)
                update_local_illumination(y, x);
        }
 
-       /* Notice */
        note_spot(y, x);
 
        /* Redraw */
@@ -4992,7 +4964,6 @@ void monster_race_track(MONRACE_IDX r_idx)
        /* Save this monster ID */
        p_ptr->monster_race_idx = r_idx;
 
-       /* Window stuff */
        p_ptr->window |= (PW_MONSTER);
 }
 
@@ -5001,12 +4972,11 @@ void monster_race_track(MONRACE_IDX r_idx)
 /*
  * Hack -- track the given object kind
  */
-void object_kind_track(IDX k_idx)
+void object_kind_track(KIND_OBJECT_IDX k_idx)
 {
        /* Save this monster ID */
        p_ptr->object_kind_idx = k_idx;
 
-       /* Window stuff */
        p_ptr->window |= (PW_OBJECT);
 }
 
@@ -5021,7 +4991,7 @@ void object_kind_track(IDX k_idx)
  *
  * All disturbance cancels repeated commands, resting, and running.
  */
-void disturb(int stop_search, int stop_travel)
+void disturb(bool stop_search, bool stop_travel)
 {
 #ifndef TRAVEL
        /* Unused */
@@ -5088,7 +5058,8 @@ void disturb(int stop_search, int stop_travel)
  */
 void glow_deep_lava_and_bldg(void)
 {
-       int y, x, i, yy, xx;
+       POSITION y, x, yy, xx;
+       DIRECTION i;
        cave_type *c_ptr;
 
        /* Not in the darkness dungeon */