OSDN Git Service

[Refactor] #37353 後で同名の構造体を作り、feat_*と命名を一致させるため floor_type を feat_ground_type に改名...
[hengband/hengband.git] / src / cave.c
index a15f0f6..ba2162a 100644 (file)
@@ -574,7 +574,6 @@ bool player_can_see_bold(POSITION y, POSITION x)
        /* Blind players see nothing */
        if (p_ptr->blind) return FALSE;
 
-       /* Access the cave grid */
        c_ptr = &cave[y][x];
 
        /* Note that "torch-lite" yields "illumination" */
@@ -956,7 +955,7 @@ void map_info(POSITION y, POSITION x, TERM_COLOR *ap, char *cp, TERM_COLOR *tap,
        feature_type *f_ptr = &f_info[feat];
 
        TERM_COLOR a;
-       byte c;
+       SYMBOL_CODE c;
 
        /* Boring grids (floors, etc) */
        if (!have_flag(f_ptr->flags, FF_REMEMBER))
@@ -1361,13 +1360,8 @@ void map_info(POSITION y, POSITION x, TERM_COLOR *ap, char *cp, TERM_COLOR *tap,
        if (player_bold(y, x))
        {
                monster_race *r_ptr = &r_info[0];
-
-               /* Get the "player" attr */
                *ap = r_ptr->x_attr;
-
-               /* Get the "player" char */
                *cp = r_ptr->x_char;
-
                feat_priority = 31;
        }
 }
@@ -1401,7 +1395,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_LEN y, TERM_LEN x)
+void print_rel(SYMBOL_CODE c, TERM_COLOR a, TERM_LEN y, TERM_LEN x)
 {
        /* Only do "legal" locations */
        if (panel_contains(y, x))
@@ -1410,7 +1404,7 @@ void print_rel(char c, byte a, TERM_LEN y, TERM_LEN x)
                if (!use_graphics)
                {
                        if (world_monster) a = TERM_DARK;
-                       else if (IS_INVULN() || world_player) a = TERM_WHITE;
+                       else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
                        else if (p_ptr->wraith_form) a = TERM_L_DARK;
                }
 
@@ -1511,14 +1505,12 @@ void note_spot(POSITION y, POSITION x)
                        if (view_torch_grids &&
                            ((c_ptr->info & (CAVE_LITE | CAVE_MNLT)) || p_ptr->see_nocto))
                        {
-                               /* Memorize */
                                c_ptr->info |= (CAVE_MARK);
                        }
 
                        /* Option -- memorize all perma-lit floors */
                        else if (view_perma_grids && ((c_ptr->info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW))
                        {
-                               /* Memorize */
                                c_ptr->info |= (CAVE_MARK);
                        }
                }
@@ -1526,28 +1518,24 @@ void note_spot(POSITION y, POSITION x)
                /* Memorize normal grids */
                else if (have_flag(f_ptr->flags, FF_LOS))
                {
-                       /* Memorize */
                        c_ptr->info |= (CAVE_MARK);
                }
 
                /* Memorize torch-lit walls */
                else if (c_ptr->info & (CAVE_LITE | CAVE_MNLT))
                {
-                       /* Memorize */
                        c_ptr->info |= (CAVE_MARK);
                }
 
                /* Memorize walls seen by noctovision of Ninja */
                else if (p_ptr->see_nocto)
                {
-                       /* Memorize */
                        c_ptr->info |= (CAVE_MARK);
                }
 
                /* Memorize certain non-torch-lit wall grids */
                else if (check_local_illumination(y, x))
                {
-                       /* Memorize */
                        c_ptr->info |= (CAVE_MARK);
                }
        }
@@ -1561,10 +1549,10 @@ void display_dungeon(void)
 {
        TERM_LEN x, y;
        TERM_COLOR a;
-       char c;
+       SYMBOL_CODE c;
 
        TERM_COLOR ta = 0;
-       char tc = '\0';
+       SYMBOL_CODE tc = '\0';
 
        for (x = p_ptr->x - Term->wid / 2 + 1; x <= p_ptr->x + Term->wid / 2; x++)
        {
@@ -1580,7 +1568,7 @@ void display_dungeon(void)
                                if (!use_graphics)
                                {
                                        if (world_monster) a = TERM_DARK;
-                                       else if (IS_INVULN() || world_player) a = TERM_WHITE;
+                                       else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
                                        else if (p_ptr->wraith_form) a = TERM_L_DARK;
                                }
 
@@ -1619,10 +1607,10 @@ void lite_spot(POSITION y, POSITION x)
        if (panel_contains(y, x) && in_bounds2(y, x))
        {
                TERM_COLOR a;
-               char c;
+               SYMBOL_CODE c;
 
                TERM_COLOR ta;
-               char tc;
+               SYMBOL_CODE tc;
 
                /* Examine the grid */
                map_info(y, x, &a, &c, &ta, &tc);
@@ -1631,7 +1619,7 @@ void lite_spot(POSITION y, POSITION x)
                if (!use_graphics)
                {
                        if (world_monster) a = TERM_DARK;
-                       else if (IS_INVULN() || world_player) a = TERM_WHITE;
+                       else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
                        else if (p_ptr->wraith_form) a = TERM_L_DARK;
                }
 
@@ -1712,7 +1700,7 @@ void prt_map(void)
                        if (!use_graphics)
                        {
                                if (world_monster) a = TERM_DARK;
-                               else if (IS_INVULN() || world_player) a = TERM_WHITE;
+                               else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
                                else if (p_ptr->wraith_form) a = TERM_L_DARK;
                        }
 
@@ -1781,7 +1769,7 @@ void prt_path(POSITION y, POSITION x)
                        if (!use_graphics)
                        {
                                if (world_monster) a = TERM_DARK;
-                               else if (IS_INVULN() || world_player) a = TERM_WHITE;
+                               else if (IS_INVULN() || p_ptr->timewalk) a = TERM_WHITE;
                                else if (p_ptr->wraith_form) a = TERM_L_DARK;
                        }
 
@@ -1902,23 +1890,23 @@ void display_map(int *cy, int *cx)
        int i, j, x, y;
 
        TERM_COLOR ta;
-       char tc;
+       SYMBOL_CODE tc;
 
        byte tp;
 
        TERM_COLOR **bigma;
-       char **bigmc;
+       SYMBOL_CODE **bigmc;
        byte **bigmp;
 
        TERM_COLOR **ma;
-       char **mc;
+       SYMBOL_CODE **mc;
        byte **mp;
 
        /* Save lighting effects */
        bool old_view_special_lite = view_special_lite;
        bool old_view_granite_lite = view_granite_lite;
 
-       int hgt, wid, yrat, xrat;
+       TERM_LEN hgt, wid, yrat, xrat;
 
        int **match_autopick_yx;
        object_type ***object_autopick_yx;
@@ -2093,7 +2081,7 @@ void display_map(int *cy, int *cx)
                        if (!use_graphics)
                        {
                                if (world_monster) ta = TERM_DARK;
-                               else if (IS_INVULN() || world_player) ta = TERM_WHITE;
+                               else if (IS_INVULN() || p_ptr->timewalk) ta = TERM_WHITE;
                                else if (p_ptr->wraith_form) ta = TERM_L_DARK;
                        }
 
@@ -2148,7 +2136,7 @@ void display_map(int *cy, int *cx)
        {
                /* Free one row each array */
                C_KILL(ma[y], (wid + 2), TERM_COLOR);
-               C_KILL(mc[y], (wid + 2), char);
+               C_KILL(mc[y], (wid + 2), SYMBOL_CODE);
                C_KILL(mp[y], (wid + 2), byte);
                C_KILL(match_autopick_yx[y], (wid + 2), int);
                C_KILL(object_autopick_yx[y], (wid + 2), object_type *);
@@ -2166,7 +2154,7 @@ void display_map(int *cy, int *cx)
        {
                /* Free one row each array */
                C_KILL(bigma[y], (cur_wid + 2), TERM_COLOR);
-               C_KILL(bigmc[y], (cur_wid + 2), char);
+               C_KILL(bigmc[y], (cur_wid + 2), SYMBOL_CODE);
                C_KILL(bigmp[y], (cur_wid + 2), byte);
        }
 
@@ -2188,7 +2176,6 @@ void do_cmd_view_map(void)
 
        screen_save();
 
-       /* Note */
        prt(_("お待ち下さい...", "Please wait..."), 0, 0);
 
        Term_fresh();
@@ -4611,7 +4598,7 @@ FEAT_IDX conv_dungeon_feat(FEAT_IDX newfeat)
                switch (f_ptr->subtype)
                {
                case CONVERT_TYPE_FLOOR:
-                       return floor_type[randint0(100)];
+                       return feat_ground_type[randint0(100)];
                case CONVERT_TYPE_WALL:
                        return fill_type[randint0(100)];
                case CONVERT_TYPE_INNER:
@@ -5135,3 +5122,14 @@ bool cave_player_teleportable_bold(POSITION y, POSITION x, BIT_FLAGS mode)
 
        return TRUE;
 }
+
+/*!
+ * @brief 地形は開くものであって、かつ開かれているかを返す /
+ * Attempt to open the given chest at the given location
+ * @param feat 地形ID
+ * @return 開いた地形である場合TRUEを返す /  Return TRUE if the given feature is an open door
+ */
+bool is_open(FEAT_IDX feat)
+{
+       return have_flag(f_info[feat].flags, FF_CLOSE) && (feat != feat_state(feat, FF_CLOSE));
+}