summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cave.cc41
-rw-r--r--src/cmd1.cc23
-rw-r--r--src/cmd2.cc11
-rw-r--r--src/defines.h21
-rw-r--r--src/dungeon.cc10
-rw-r--r--src/feature_flag.hpp12
-rw-r--r--src/feature_flag_list.hpp25
-rw-r--r--src/feature_flag_set.hpp7
-rw-r--r--src/feature_type.hpp4
-rw-r--r--src/gen_evol.cc15
-rw-r--r--src/generate.cc35
-rw-r--r--src/init1.cc56
-rw-r--r--src/melee2.cc15
-rw-r--r--src/object2.cc3
-rw-r--r--src/powers.cc3
-rw-r--r--src/q_dragons.cc13
-rw-r--r--src/q_evil.cc8
-rw-r--r--src/q_fireprof.cc5
-rw-r--r--src/q_god.cc5
-rw-r--r--src/q_haunted.cc16
-rw-r--r--src/q_wolves.cc15
-rw-r--r--src/spells1.cc35
-rw-r--r--src/spells2.cc23
-rw-r--r--src/spells3.cc5
-rw-r--r--src/traps.cc13
-rw-r--r--src/wild.cc5
-rw-r--r--src/xtra2.cc5
27 files changed, 218 insertions, 211 deletions
diff --git a/src/cave.cc b/src/cave.cc
index 97f022c1..52855a8b 100644
--- a/src/cave.cc
+++ b/src/cave.cc
@@ -2,6 +2,7 @@
#include "cave_type.hpp"
#include "dungeon_flag.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "hook_enter_dungeon_in.hpp"
#include "monster2.hpp"
@@ -91,7 +92,7 @@ static bool_ is_wall(cave_type *c_ptr)
if (feat == FEAT_SMALL_TREES) return TRUE;
/* Normal cases: use the WALL flag in f_info.txt */
- return (f_info[feat].flags1 & FF1_WALL) ? TRUE : FALSE;
+ return (f_info[feat].flags & FF_WALL) ? TRUE : FALSE;
}
@@ -918,7 +919,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
* Cave macros cannot be used safely here, because of
* c_ptr->mimic XXX XXX
*/
- if ((f_ptr->flags1 & (FF1_FLOOR | FF1_REMEMBER)) == FF1_FLOOR)
+ if ((f_ptr->flags & (FF_FLOOR | FF_REMEMBER)) == FF_FLOOR)
{
c = f_info[FEAT_TRAP].x_char;
}
@@ -948,7 +949,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
}
/* Multi-hued attr */
- else if (f_ptr->flags1 & FF1_ATTR_MULTI)
+ else if (f_ptr->flags & FF_ATTR_MULTI)
{
a = f_ptr->shimmer[rand_int(7)];
}
@@ -971,7 +972,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
/* view_special_lite: lighting effects for boring features */
if (view_special_lite &&
- ((f_ptr->flags1 & (FF1_FLOOR | FF1_REMEMBER)) == FF1_FLOOR))
+ ((f_ptr->flags & (FF_FLOOR | FF_REMEMBER)) == FF_FLOOR))
{
if (!p_ptr->wild_mode && !(info & (CAVE_TRDT)))
{
@@ -1011,7 +1012,7 @@ static void map_info(int y, int x, byte *ap, char *cp)
/* view_granite_lite: lighting effects for walls and doors */
else if (view_granite_lite &&
- (f_ptr->flags1 & (FF1_NO_VISION | FF1_DOOR)))
+ (f_ptr->flags & (FF_NO_VISION | FF_DOOR)))
{
if (!p_ptr->wild_mode && !(info & (CAVE_TRDT)))
{
@@ -1352,7 +1353,7 @@ void map_info_default(int y, int x, byte *ap, char *cp)
* Cave macros cannot be used safely here, because of
* c_ptr->mimic XXX XXX
*/
- if ((f_ptr->flags1 & (FF1_FLOOR | FF1_REMEMBER)) == FF1_FLOOR)
+ if ((f_ptr->flags & (FF_FLOOR | FF_REMEMBER)) == FF_FLOOR)
{
c = f_info[FEAT_TRAP].d_char;
}
@@ -1382,7 +1383,7 @@ void map_info_default(int y, int x, byte *ap, char *cp)
}
/* Multi-hued attr */
- else if (f_ptr->flags1 & FF1_ATTR_MULTI)
+ else if (f_ptr->flags & FF_ATTR_MULTI)
{
a = f_ptr->shimmer[rand_int(7)];
}
@@ -1405,7 +1406,7 @@ void map_info_default(int y, int x, byte *ap, char *cp)
/* view_special_lite: lighting effects for boring features */
if (view_special_lite &&
- ((f_ptr->flags1 & (FF1_FLOOR | FF1_REMEMBER)) == FF1_FLOOR))
+ ((f_ptr->flags & (FF_FLOOR | FF_REMEMBER)) == FF_FLOOR))
{
if (!p_ptr->wild_mode && !(info & (CAVE_TRDT)))
{
@@ -1445,7 +1446,7 @@ void map_info_default(int y, int x, byte *ap, char *cp)
/* view_granite_lite: lighting effects for walls and doors */
else if (view_granite_lite &&
- (f_ptr->flags1 & (FF1_NO_VISION | FF1_DOOR)))
+ (f_ptr->flags & (FF_NO_VISION | FF_DOOR)))
{
if (!p_ptr->wild_mode && !(info & (CAVE_TRDT)))
{
@@ -3691,7 +3692,7 @@ void update_mon_lite(void)
*
* We don't have four sides for a wall grid, so...
*/
- if (invis && (f_info[c_ptr->feat].flags1 & FF1_NO_VISION)) continue;
+ if (invis && (f_info[c_ptr->feat].flags & FF_NO_VISION)) continue;
/* Give monster light to the location */
c_ptr->info |= (CAVE_MLIT | CAVE_SEEN);
@@ -4548,7 +4549,7 @@ bool cave_floor_bold(int y, int x)
*/
bool cave_floor_grid(cave_type const *c)
{
- return (f_info[c->feat].flags1 & FF1_FLOOR) && (c->feat != FEAT_MON_TRAP);
+ return (f_info[c->feat].flags & FF_FLOOR) && (c->feat != FEAT_MON_TRAP);
}
@@ -4568,8 +4569,8 @@ bool cave_plain_floor_bold(int y, int x)
bool cave_plain_floor_grid(cave_type const *c)
{
return
- (f_info[c->feat].flags1 & FF1_FLOOR) &&
- !(f_info[c->feat].flags1 & FF1_REMEMBER);
+ (f_info[c->feat].flags & FF_FLOOR) &&
+ !(f_info[c->feat].flags & FF_REMEMBER);
}
@@ -4593,7 +4594,7 @@ bool cave_sight_bold(int y, int x)
bool cave_sight_grid(cave_type const *c)
{
- return !(f_info[c->feat].flags1 & FF1_NO_VISION);
+ return !(f_info[c->feat].flags & FF_NO_VISION);
}
@@ -4608,10 +4609,10 @@ bool cave_sight_grid(cave_type const *c)
bool cave_clean_bold(int y, int x)
{
return
- (f_info[cave[y][x].feat].flags1 & FF1_FLOOR) &&
+ (f_info[cave[y][x].feat].flags & FF_FLOOR) &&
(cave[y][x].feat != FEAT_MON_TRAP) &&
(cave[y][x].o_idxs.empty()) &&
- !(f_info[cave[y][x].feat].flags1 & FF1_PERMANENT);
+ !(f_info[cave[y][x].feat].flags & FF_PERMANENT);
}
/*
@@ -4640,9 +4641,9 @@ bool cave_empty_bold(int y, int x)
bool cave_naked_bold(int y, int x)
{
return
- (f_info[cave[y][x].feat].flags1 & FF1_FLOOR) &&
+ (f_info[cave[y][x].feat].flags & FF_FLOOR) &&
(cave[y][x].feat != FEAT_MON_TRAP) &&
- !(f_info[cave[y][x].feat].flags1 & FF1_PERMANENT) &&
+ !(f_info[cave[y][x].feat].flags & FF_PERMANENT) &&
(cave[y][x].o_idxs.empty()) &&
(cave[y][x].m_idx == 0);
}
@@ -4650,7 +4651,7 @@ bool cave_naked_bold(int y, int x)
bool cave_naked_bold2(int y, int x)
{
return
- (f_info[cave[y][x].feat].flags1 & FF1_FLOOR) &&
+ (f_info[cave[y][x].feat].flags & FF_FLOOR) &&
(cave[y][x].feat != FEAT_MON_TRAP) &&
(cave[y][x].o_idxs.empty()) &&
(cave[y][x].m_idx == 0);
@@ -4667,7 +4668,7 @@ bool cave_perma_bold(int y, int x)
bool cave_perma_grid(cave_type const *c)
{
- return f_info[c->feat].flags1 & FF1_PERMANENT;
+ return bool(f_info[c->feat].flags & FF_PERMANENT);
}
/*
diff --git a/src/cmd1.cc b/src/cmd1.cc
index bb0aa5f3..55b1954e 100644
--- a/src/cmd1.cc
+++ b/src/cmd1.cc
@@ -13,6 +13,7 @@
#include "cmd4.hpp"
#include "cmd5.hpp"
#include "dungeon_info_type.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "files.hpp"
#include "gods.hpp"
@@ -2601,23 +2602,23 @@ bool_ player_can_enter(byte feature)
return (TRUE);
}
- if ((p_ptr->climb) && (f_info[feature].flags1 & FF1_CAN_CLIMB))
+ if ((p_ptr->climb) && (f_info[feature].flags & FF_CAN_CLIMB))
return (TRUE);
if ((p_ptr->fly) &&
- ((f_info[feature].flags1 & FF1_CAN_FLY) ||
- (f_info[feature].flags1 & FF1_CAN_LEVITATE)))
+ ((f_info[feature].flags & FF_CAN_FLY) ||
+ (f_info[feature].flags & FF_CAN_LEVITATE)))
return (TRUE);
- else if (only_wall && (f_info[feature].flags1 & FF1_FLOOR))
+ else if (only_wall && (f_info[feature].flags & FF_FLOOR))
return (FALSE);
else if ((p_ptr->ffall) &&
- (f_info[feature].flags1 & FF1_CAN_LEVITATE))
+ (f_info[feature].flags & FF_CAN_LEVITATE))
return (TRUE);
else if ((pass_wall || only_wall) &&
- (f_info[feature].flags1 & FF1_CAN_PASS))
+ (f_info[feature].flags & FF_CAN_PASS))
return (TRUE);
- else if (f_info[feature].flags1 & FF1_NO_WALK)
+ else if (f_info[feature].flags & FF_NO_WALK)
return (FALSE);
- else if ((f_info[feature].flags1 & FF1_WEB) &&
+ else if ((f_info[feature].flags & FF_WEB) &&
((!(r_info[p_ptr->body_monster].flags & RF_SPIDER)) && (p_ptr->mimic_form != resolve_mimic_name("Spider"))))
return (FALSE);
@@ -3232,7 +3233,7 @@ void move_player_aux(int dir, int do_pickup, int run, bool_ disarm)
/* Discover invisible traps */
else if ((c_ptr->t_idx != 0) &&
- !(f_info[cave[y][x].feat].flags1 & FF1_DOOR))
+ !(f_info[cave[y][x].feat].flags & FF_DOOR))
{
/* Disturb */
disturb(0);
@@ -3318,7 +3319,7 @@ static int see_obstacle_grid(cave_type *c_ptr)
/* "Safe" floor grids aren't obstacles */
- if (f_info[c_ptr->feat].flags1 & FF1_CAN_RUN) return (FALSE);
+ if (f_info[c_ptr->feat].flags & FF_CAN_RUN) return (FALSE);
/* Must be known to the player */
if (!(c_ptr->info & (CAVE_MARK))) return (FALSE);
@@ -3771,7 +3772,7 @@ static bool_ run_test(void)
}
/* Check the "don't notice running" flag */
- if (f_info[c_ptr->feat].flags1 & FF1_DONT_NOTICE_RUNNING)
+ if (f_info[c_ptr->feat].flags & FF_DONT_NOTICE_RUNNING)
{
notice = FALSE;
}
diff --git a/src/cmd2.cc b/src/cmd2.cc
index c57518bb..f4e85847 100644
--- a/src/cmd2.cc
+++ b/src/cmd2.cc
@@ -14,6 +14,7 @@
#include "cmd1.hpp"
#include "dungeon_info_type.hpp"
#include "dungeon_flag.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "files.hpp"
#include "gods.hpp"
@@ -1410,7 +1411,7 @@ static bool_ do_cmd_tunnel_test(int y, int x)
}
/* Must be tunnelable */
- if (!(f_info[cave[y][x].feat].flags1 & FF1_TUNNELABLE))
+ if (!(f_info[cave[y][x].feat].flags & FF_TUNNELABLE))
{
/* Message */
msg_print(f_info[cave[y][x].feat].tunnel);
@@ -1502,7 +1503,7 @@ static bool_ do_cmd_tunnel_aux(int y, int x, int dir)
sound(SOUND_DIG);
/* Titanium */
- if (f_ptr->flags1 & FF1_PERMANENT)
+ if (f_ptr->flags & FF_PERMANENT)
{
msg_print(f_ptr->tunnel);
}
@@ -1976,7 +1977,7 @@ static bool_ do_cmd_disarm_aux(int y, int x, int dir, int do_pickup)
c_ptr->t_idx = 0;
/* Move the player onto the trap */
- if (!(f_info[c_ptr->feat].flags1 & FF1_DOOR))
+ if (!(f_info[c_ptr->feat].flags & FF_DOOR))
move_player_aux(dir, do_pickup, 0, TRUE);
/* Remove trap attr from grid */
@@ -2004,7 +2005,7 @@ static bool_ do_cmd_disarm_aux(int y, int x, int dir, int do_pickup)
msg_format("You set off the %s!", name);
/* Move the player onto the trap */
- if (!(f_info[c_ptr->feat].flags1 & FF1_DOOR))
+ if (!(f_info[c_ptr->feat].flags & FF_DOOR))
move_player_aux(dir, do_pickup, 0, FALSE);
}
@@ -2398,7 +2399,7 @@ void do_cmd_alter(void)
}
/* Tunnel through walls */
- else if (f_info[c_ptr->feat].flags1 & FF1_TUNNELABLE)
+ else if (f_info[c_ptr->feat].flags & FF_TUNNELABLE)
{
/* Tunnel */
more = do_cmd_tunnel_aux(y, x, dir);
diff --git a/src/defines.h b/src/defines.h
index 1d078609..7243eb9c 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -2306,27 +2306,6 @@
#define ETR4_R_IMMUNITY 0x40000000L /* Item gives a random immunity */
#define ETR4_LIMIT_BLOWS 0x80000000L /* switch the "limit blows" feature */
-/*** Features flags -- DG ***/
-#define FF1_NO_WALK 0x00000001L
-#define FF1_NO_VISION 0x00000002L
-#define FF1_CAN_LEVITATE 0x00000004L
-#define FF1_CAN_PASS 0x00000008L
-#define FF1_FLOOR 0x00000010L
-#define FF1_WALL 0x00000020L
-#define FF1_PERMANENT 0x00000040L
-#define FF1_CAN_FLY 0x00000080L
-#define FF1_REMEMBER 0x00000100L
-#define FF1_NOTICE 0x00000200L
-#define FF1_DONT_NOTICE_RUNNING 0x00000400L
-#define FF1_CAN_RUN 0x00000800L
-#define FF1_DOOR 0x00001000L
-#define FF1_SUPPORT_LIGHT 0x00002000L
-#define FF1_CAN_CLIMB 0x00004000L
-#define FF1_TUNNELABLE 0x00008000L
-#define FF1_WEB 0x00010000L
-#define FF1_ATTR_MULTI 0x00020000L
-#define FF1_SUPPORT_GROWTH 0x00040000L
-
/*** Town flags ***/
#define TOWN_REAL 0x01 /* Town is really present */
#define TOWN_KNOWN 0x02 /* Town is found by the player */
diff --git a/src/dungeon.cc b/src/dungeon.cc
index d70ffcde..bbb60aa5 100644
--- a/src/dungeon.cc
+++ b/src/dungeon.cc
@@ -22,6 +22,7 @@
#include "corrupt.hpp"
#include "dungeon_flag.hpp"
#include "dungeon_info_type.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "files.h"
#include "files.hpp"
@@ -1489,11 +1490,11 @@ static void process_world(void)
/* Do nothing */
}
/* Player can climb over mountains */
- else if ((p_ptr->climb) && (f_info[feature].flags1 & FF1_CAN_CLIMB))
+ else if ((p_ptr->climb) && (f_info[feature].flags & FF_CAN_CLIMB))
{
/* Do nothing */
}
- else if (race_flags1_p(PR1_SEMI_WRAITH) && (!p_ptr->wraith_form) && (f_info[cave[p_ptr->py][p_ptr->px].feat].flags1 & FF1_CAN_PASS))
+ else if (race_flags1_p(PR1_SEMI_WRAITH) && (!p_ptr->wraith_form) && (f_info[cave[p_ptr->py][p_ptr->px].feat].flags & FF_CAN_PASS))
{
int amt = 1 + ((p_ptr->lev) / 5);
@@ -4563,7 +4564,10 @@ static void process_player(void)
}
/* Skip normal features */
- if (!(f_ptr->flags1 & (FF1_ATTR_MULTI))) continue;
+ if (!(f_ptr->flags & FF_ATTR_MULTI))
+ {
+ continue;
+ }
/* Redraw a shimmering spot */
lite_spot(j, i);
diff --git a/src/feature_flag.hpp b/src/feature_flag.hpp
new file mode 100644
index 00000000..09aa5b43
--- /dev/null
+++ b/src/feature_flag.hpp
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "feature_flag_set.hpp"
+#include <boost/preprocessor/cat.hpp>
+
+//
+// Define flag set for each flag.
+//
+#define FF(tier, index, name) \
+ DECLARE_FLAG(feature_flag_set, BOOST_PP_CAT(FF_,name), tier, index)
+#include "feature_flag_list.hpp"
+#undef FF
diff --git a/src/feature_flag_list.hpp b/src/feature_flag_list.hpp
new file mode 100644
index 00000000..0a433c3a
--- /dev/null
+++ b/src/feature_flag_list.hpp
@@ -0,0 +1,25 @@
+/**
+ * X-macro list of all the feature flags
+ */
+
+/* FF(<tier>, <index>, <name>) */
+
+FF(1, 0, NO_WALK)
+FF(1, 1, NO_VISION)
+FF(1, 2, CAN_LEVITATE)
+FF(1, 3, CAN_PASS)
+FF(1, 4, FLOOR)
+FF(1, 5, WALL)
+FF(1, 6, PERMANENT)
+FF(1, 7, CAN_FLY)
+FF(1, 8, REMEMBER)
+FF(1, 9, NOTICE)
+FF(1, 10, DONT_NOTICE_RUNNING)
+FF(1, 11, CAN_RUN)
+FF(1, 12, DOOR)
+FF(1, 13, SUPPORT_LIGHT)
+FF(1, 14, CAN_CLIMB)
+FF(1, 15, TUNNELABLE)
+FF(1, 16, WEB)
+FF(1, 17, ATTR_MULTI)
+FF(1, 18, SUPPORT_GROWTH)
diff --git a/src/feature_flag_set.hpp b/src/feature_flag_set.hpp
new file mode 100644
index 00000000..abc4f47d
--- /dev/null
+++ b/src/feature_flag_set.hpp
@@ -0,0 +1,7 @@
+#pragma once
+
+#include "flag_set.hpp"
+
+constexpr std::size_t FF_MAX_TIERS = 1;
+
+typedef flag_set<FF_MAX_TIERS> feature_flag_set;
diff --git a/src/feature_type.hpp b/src/feature_type.hpp
index 40a1f58b..e818f17a 100644
--- a/src/feature_type.hpp
+++ b/src/feature_type.hpp
@@ -2,6 +2,8 @@
#include "h-basic.h"
+#include "feature_flag_set.hpp"
+
/**
* Terrain feature descriptor.
*/
@@ -15,7 +17,7 @@ struct feature_type
byte mimic = 0; /* Feature to mimic */
- u32b flags1 = 0; /* First set of flags */
+ feature_flag_set flags; /* First set of flags */
byte d_attr = 0; /* Default feature attribute */
char d_char = '\0'; /* Default feature character */
diff --git a/src/gen_evol.cc b/src/gen_evol.cc
index 6f3fbcba..889e7a01 100644
--- a/src/gen_evol.cc
+++ b/src/gen_evol.cc
@@ -10,6 +10,7 @@
#include "cave.hpp"
#include "cave_type.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "generate.hpp"
#include "levels.hpp"
@@ -34,8 +35,8 @@ void evolve_level(bool_ noise)
{
for (j = 1; j < cur_hgt - 1; j++)
{
- if (f_info[cave[j][i].feat].flags1 & FF1_WALL) cw++;
- if (f_info[cave[j][i].feat].flags1 & FF1_FLOOR) cf++;
+ if (f_info[cave[j][i].feat].flags & FF_WALL) cw++;
+ if (f_info[cave[j][i].feat].flags & FF_FLOOR) cf++;
}
}
@@ -49,7 +50,7 @@ void evolve_level(bool_ noise)
c_ptr = &cave[j][i];
/* Permanent features should stay */
- if (f_info[c_ptr->feat].flags1 & FF1_PERMANENT) continue;
+ if (f_info[c_ptr->feat].flags & FF_PERMANENT) continue;
/* Avoid evolving grids with object or monster */
if ((!c_ptr->o_idxs.empty()) || c_ptr->m_idx) continue;
@@ -83,7 +84,7 @@ void evolve_level(bool_ noise)
c_ptr = &cave[j][i];
/* Permanent features should stay */
- if (f_info[c_ptr->feat].flags1 & FF1_PERMANENT) continue;
+ if (f_info[c_ptr->feat].flags & FF_PERMANENT) continue;
/* Avoid evolving grids with object or monster */
if ((!c_ptr->o_idxs.empty()) || c_ptr->m_idx) continue;
@@ -101,7 +102,7 @@ void evolve_level(bool_ noise)
for (y = j - 1; y <= j + 1; y++)
{
if ((x == i) && (y == j)) continue;
- if (f_info[cave[y][x].feat].flags1 & FF1_WALL) c++;
+ if (f_info[cave[y][x].feat].flags & FF_WALL) c++;
}
}
@@ -112,7 +113,7 @@ void evolve_level(bool_ noise)
/* Starved or suffocated */
if ((c < 4) || (c >= 7))
{
- if (f_info[c_ptr->feat].flags1 & FF1_WALL)
+ if (f_info[c_ptr->feat].flags & FF_WALL)
{
place_floor(j, i);
}
@@ -121,7 +122,7 @@ void evolve_level(bool_ noise)
/* Spawned */
else if ((c == 4) || (c == 5))
{
- if (!(f_info[c_ptr->feat].flags1 & FF1_WALL))
+ if (!(f_info[c_ptr->feat].flags & FF_WALL))
{
place_filler(j, i);
}
diff --git a/src/generate.cc b/src/generate.cc
index d1bcbe31..3f74bc24 100644
--- a/src/generate.cc
+++ b/src/generate.cc
@@ -13,6 +13,7 @@
#include "cave_type.hpp"
#include "dungeon_info_type.hpp"
#include "dungeon_flag.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "hook_build_room1_in.hpp"
#include "hooks.hpp"
@@ -560,8 +561,8 @@ void place_new_way(int *y, int *x)
if (c_ptr->info & (CAVE_ICKY)) continue;
/* Reject permanent features */
- if ((f_info[c_ptr->feat].flags1 & (FF1_PERMANENT)) &&
- (f_info[c_ptr->feat].flags1 & (FF1_FLOOR))) continue;
+ if ((f_info[c_ptr->feat].flags & FF_PERMANENT) &&
+ (f_info[c_ptr->feat].flags & FF_FLOOR)) continue;
/* Reject room walls */
if ((c_ptr->info & (CAVE_ROOM)) &&
@@ -780,10 +781,10 @@ static int next_to_walls(int y, int x)
{
int k = 0;
- if (f_info[cave[y + 1][x].feat].flags1 & FF1_WALL) k++;
- if (f_info[cave[y - 1][x].feat].flags1 & FF1_WALL) k++;
- if (f_info[cave[y][x + 1].feat].flags1 & FF1_WALL) k++;
- if (f_info[cave[y][x - 1].feat].flags1 & FF1_WALL) k++;
+ if (f_info[cave[y + 1][x].feat].flags & FF_WALL) k++;
+ if (f_info[cave[y - 1][x].feat].flags & FF_WALL) k++;
+ if (f_info[cave[y][x + 1].feat].flags & FF_WALL) k++;
+ if (f_info[cave[y][x - 1].feat].flags & FF_WALL) k++;
return (k);
}
@@ -1534,13 +1535,13 @@ static void build_streamer2(int feat, int killwall)
if (c_ptr->info & (CAVE_ICKY)) continue;
/* Reject permanent features */
- if ((f_info[c_ptr->feat].flags1 & (FF1_PERMANENT)) &&
- (f_info[c_ptr->feat].flags1 & (FF1_FLOOR))) continue;
+ if ((f_info[c_ptr->feat].flags & FF_PERMANENT) &&
+ (f_info[c_ptr->feat].flags & FF_FLOOR)) continue;
/* Avoid converting walls when told so */
if (killwall == 0)
{
- if (f_info[c_ptr->feat].flags1 & FF1_WALL) continue;
+ if (f_info[c_ptr->feat].flags & FF_WALL) continue;
}
/* Clear mimic feature to avoid nasty consequences */
@@ -1597,7 +1598,7 @@ static void build_streamer2(int feat, int killwall)
continue;
/* Only convert non-permanent features */
- if (f_info[cave[ty][tx].feat].flags1 & FF1_PERMANENT) continue;
+ if (f_info[cave[ty][tx].feat].flags & FF_PERMANENT) continue;
/* Clear mimic feature to avoid nasty consequences */
cave[ty][tx].mimic = 0;
@@ -1715,7 +1716,7 @@ static bool_ get_is_floor(int x, int y)
if (!in_bounds(y, x)) return (FALSE);
/* Do the real check: */
- if (f_info[cave[y][x].feat].flags1 & FF1_FLOOR) return (TRUE);
+ if (f_info[cave[y][x].feat].flags & FF_FLOOR) return (TRUE);
return (FALSE);
}
@@ -4410,7 +4411,7 @@ bool_ generate_fracave(int y0, int x0, int xsize, int ysize,
c_ptr = &cave[y + y0 - yhsize][x + x0 - xhsize];
/* A floor grid to be converted */
- if ((f_info[c_ptr->feat].flags1 & FF1_FLOOR) &&
+ if ((f_info[c_ptr->feat].flags & FF_FLOOR) &&
(c_ptr->info & CAVE_ICKY))
{
@@ -6386,15 +6387,15 @@ static bool_ possible_doorway(int y, int x)
if (next_to_corr(y, x) >= 2)
{
/* Check Vertical */
- if ((f_info[cave[y - 1][x].feat].flags1 & FF1_WALL) &&
- (f_info[cave[y + 1][x].feat].flags1 & FF1_WALL))
+ if ((f_info[cave[y - 1][x].feat].flags & FF_WALL) &&
+ (f_info[cave[y + 1][x].feat].flags & FF_WALL))
{
return (TRUE);
}
/* Check Horizontal */
- if ((f_info[cave[y][x - 1].feat].flags1 & FF1_WALL) &&
- (f_info[cave[y][x + 1].feat].flags1 & FF1_WALL))
+ if ((f_info[cave[y][x - 1].feat].flags & FF_WALL) &&
+ (f_info[cave[y][x + 1].feat].flags & FF_WALL))
{
return (TRUE);
}
@@ -6437,7 +6438,7 @@ static void try_doors(int y, int x)
if (!in_bounds(yy, xx)) continue;
/* Ignore walls */
- if (f_info[cave[yy][xx].feat].flags1 & (FF1_WALL)) continue;
+ if (f_info[cave[yy][xx].feat].flags & FF_WALL) continue;
/* Ignore room grids */
if (cave[yy][xx].info & (CAVE_ROOM)) continue;
diff --git a/src/init1.cc b/src/init1.cc
index 0a6ecff0..ec12ad34 100644
--- a/src/init1.cc
+++ b/src/init1.cc
@@ -7,6 +7,7 @@
#include "dungeon_info_type.hpp"
#include "dungeon_flag.hpp"
#include "ego_item_type.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "files.hpp"
#include "gods.hpp"
@@ -194,45 +195,6 @@ static cptr ego_flags[] =
};
/*
- * Feature flags
- */
-static cptr f_info_flags1[] =
-{
- "NO_WALK",
- "NO_VISION",
- "CAN_LEVITATE",
- "CAN_PASS",
- "FLOOR",
- "WALL",
- "PERMANENT",
- "CAN_FLY",
- "REMEMBER",
- "NOTICE",
- "DONT_NOTICE_RUNNING",
- "CAN_RUN",
- "DOOR",
- "SUPPORT_LIGHT",
- "CAN_CLIMB",
- "TUNNELABLE",
- "WEB",
- "ATTR_MULTI",
- "SUPPORT_GROWTH",
- "XXX1",
- "XXX1",
- "XXX1",
- "XXX1",
- "XXX1",
- "XXX1",
- "XXX1",
- "XXX1",
- "XXX1",
- "XXX1",
- "XXX1",
- "XXX1",
- "XXX1"
-};
-
-/*
* Trap flags
*/
static cptr t_info_flags[] =
@@ -2540,12 +2502,16 @@ errr init_v_info_txt(FILE *fp)
/*
* Grab one flag in an feature_type from a textual string
*/
-static errr grab_one_feature_flag(u32b *f1, cptr what)
+static int grab_one_feature_flag(cptr what, feature_flag_set *flags)
{
- if (lookup_flags(what, flag_tie(f1, f_info_flags1)))
- {
- return (0);
- }
+#define FF(tier, index, name) \
+ if (streq(what, #name)) \
+ { \
+ *flags |= BOOST_PP_CAT(FF_,name); \
+ return 0; \
+ };
+#include "feature_flag_list.hpp"
+#undef FF
/* Oops */
msg_format("Unknown feature flag '%s'.", what);
@@ -2783,7 +2749,7 @@ errr init_f_info_txt(FILE *fp)
/* Hack -- Process 'F' for flags */
if (buf[0] == 'F')
{
- if (0 != grab_one_feature_flag(&f_ptr->flags1, buf + 2))
+ if (0 != grab_one_feature_flag(buf + 2, &f_ptr->flags))
{
return (5);
}
diff --git a/src/melee2.cc b/src/melee2.cc
index f52c7061..a0f43492 100644
--- a/src/melee2.cc
+++ b/src/melee2.cc
@@ -17,6 +17,7 @@
#include "cave_type.hpp"
#include "cmd1.hpp"
#include "dungeon_flag.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "files.hpp"
#include "hook_mon_speak_in.hpp"
@@ -6136,35 +6137,35 @@ static void process_monster(int m_idx, bool_ is_frien)
}
/* Permanent wall */
- else if (f_info[c_ptr->feat].flags1 & FF1_PERMANENT)
+ else if (f_info[c_ptr->feat].flags & FF_PERMANENT)
{
/* Nothing */
}
/* Some monsters can fly */
- else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_LEVITATE) && (r_ptr->flags & RF_CAN_FLY))
+ else if ((f_info[c_ptr->feat].flags & FF_CAN_LEVITATE) && (r_ptr->flags & RF_CAN_FLY))
{
/* Pass through walls/doors/rubble */
do_move = TRUE;
}
/* Some monsters can fly */
- else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_FLY) && (r_ptr->flags & RF_CAN_FLY))
+ else if ((f_info[c_ptr->feat].flags & FF_CAN_FLY) && (r_ptr->flags & RF_CAN_FLY))
{
/* Pass through trees/... */
do_move = TRUE;
}
/* Monster moves through walls (and doors) */
- else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_PASS) && (r_ptr->flags & RF_PASS_WALL))
+ else if ((f_info[c_ptr->feat].flags & FF_CAN_PASS) && (r_ptr->flags & RF_PASS_WALL))
{
/* Pass through walls/doors/rubble */
do_move = TRUE;
}
/* Monster destroys walls (and doors) */
- else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_PASS) && (r_ptr->flags & RF_KILL_WALL))
+ else if ((f_info[c_ptr->feat].flags & FF_CAN_PASS) && (r_ptr->flags & RF_KILL_WALL))
{
/* Eat through walls/doors/rubble */
do_move = TRUE;
@@ -6185,14 +6186,14 @@ static void process_monster(int m_idx, bool_ is_frien)
}
/* Monster moves through walls (and doors) */
- else if ((f_info[c_ptr->feat].flags1 & FF1_CAN_PASS) && (r_ptr->flags & RF_PASS_WALL))
+ else if ((f_info[c_ptr->feat].flags & FF_CAN_PASS) && (r_ptr->flags & RF_PASS_WALL))
{
/* Pass through walls/doors/rubble */
do_move = TRUE;
}
/* Monster moves through webs */
- else if ((f_info[c_ptr->feat].flags1 & FF1_WEB) &&
+ else if ((f_info[c_ptr->feat].flags & FF_WEB) &&
(r_ptr->flags & RF_SPIDER))
{
/* Pass through webs */
diff --git a/src/object2.cc b/src/object2.cc
index ce0679cc..231a67df 100644
--- a/src/object2.cc
+++ b/src/object2.cc
@@ -16,6 +16,7 @@
#include "device_allocation.hpp"
#include "dungeon_info_type.hpp"
#include "ego_item_type.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "hooks.hpp"
#include "mimic.hpp"
@@ -5096,7 +5097,7 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x)
c_ptr = &cave[ty][tx];
/* Require floor space (or shallow terrain) -KMW- */
- if (!(f_info[c_ptr->feat].flags1 & FF1_FLOOR)) continue;
+ if (!(f_info[c_ptr->feat].flags & FF_FLOOR)) continue;
/* No traps */
if (c_ptr->t_idx) continue;
diff --git a/src/powers.cc b/src/powers.cc
index 45ca3e0c..b58eb164 100644
--- a/src/powers.cc
+++ b/src/powers.cc
@@ -14,6 +14,7 @@
#include "cmd2.hpp"
#include "cmd7.hpp"
#include "dungeon_flag.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "files.hpp"
#include "hooks.hpp"
@@ -722,7 +723,7 @@ static void power_activate(int power)
msg_print("You bite into thin air!");
break;
}
- else if ((f_info[c_ptr->feat].flags1 & FF1_PERMANENT) || (c_ptr->feat == FEAT_MOUNTAIN))
+ else if ((f_info[c_ptr->feat].flags & FF_PERMANENT) || (c_ptr->feat == FEAT_MOUNTAIN))
{
msg_print("Ouch! This wall is harder than your teeth!");
break;
diff --git a/src/q_dragons.cc b/src/q_dragons.cc
index 45666e77..8dc990d2 100644
--- a/src/q_dragons.cc
+++ b/src/q_dragons.cc
@@ -3,6 +3,7 @@
#include "cave.hpp"
#include "cave_type.hpp"
#include "dungeon_flag.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "hook_quest_finish_in.hpp"
#include "hooks.hpp"
@@ -53,13 +54,12 @@ static bool_ quest_dragons_gen_hook(void *, void *, void *)
/* Place some columns */
for (i = 35; i > 0; )
{
- int flags;
y = rand_int(21) + 3;
x = rand_int(31) + 3;
/* Bar columns on even squares so the whole level is guaranteed to be
accessible */
- flags = f_info[cave[y][x].feat].flags1;
- if (!(flags % 2) && !(flags & FF1_PERMANENT) && (flags & FF1_FLOOR))
+ auto const flags = f_info[cave[y][x].feat].flags;
+ if (!(x % 2) && !(flags & FF_PERMANENT) && (flags & FF_FLOOR))
{
--i;
cave_set_feat(y, x, FEAT_MOUNTAIN);
@@ -69,11 +69,10 @@ static bool_ quest_dragons_gen_hook(void *, void *, void *)
/* Place some random dragons */
for (i = 25; i > 0; )
{
- int m_idx, flags;
y = rand_int(21) + 3;
x = rand_int(31) + 3;
- flags = f_info[cave[y][x].feat].flags1;
- if (!(flags & FF1_PERMANENT) && (flags & FF1_FLOOR))
+ auto const flags = f_info[cave[y][x].feat].flags;
+ if (!(flags & FF_PERMANENT) && (flags & FF_FLOOR))
{
/* blue, white, red, black, bronze, gold, green, multi-hued */
int baby_dragons[8] = {163, 164, 167, 166, 218, 219, 165, 204};
@@ -95,7 +94,7 @@ static bool_ quest_dragons_gen_hook(void *, void *, void *)
dragon = mature_dragons[color];
--i;
- m_idx = place_monster_one(y, x, dragon, 0, magik(33), MSTATUS_ENEMY);
+ int m_idx = place_monster_one(y, x, dragon, 0, magik(33), MSTATUS_ENEMY);
if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
}
}
diff --git a/src/q_evil.cc b/src/q_evil.cc
index 5e93bdf1..d27e8986 100644
--- a/src/q_evil.cc
+++ b/src/q_evil.cc
@@ -3,6 +3,7 @@
#include "cave.hpp"
#include "cave_type.hpp"
#include "dungeon_flag.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "hook_quest_finish_in.hpp"
#include "hooks.hpp"
@@ -53,13 +54,12 @@ static bool_ quest_evil_gen_hook(void *, void *, void *)
/* Place some random balrogs */
for (i = 6; i > 0; )
{
- int m_idx, flags;
y = rand_int(21) + 3;
x = rand_int(31) + 3;
- flags = f_info[cave[y][x].feat].flags1;
- if (!(flags & FF1_PERMANENT) && (flags & FF1_FLOOR))
+ auto const flags = f_info[cave[y][x].feat].flags;
+ if (!(flags & FF_PERMANENT) && (flags & FF_FLOOR))
{
- m_idx = place_monster_one(y, x, 996, 0, FALSE, MSTATUS_ENEMY);
+ int m_idx = place_monster_one(y, x, 996, 0, FALSE, MSTATUS_ENEMY);
if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
--i;
}
diff --git a/src/q_fireprof.cc b/src/q_fireprof.cc
index 777ce690..fe635971 100644
--- a/src/q_fireprof.cc
+++ b/src/q_fireprof.cc
@@ -2,6 +2,7 @@
#include "cave_type.hpp"
#include "dungeon_flag.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "hook_get_in.hpp"
#include "hooks.hpp"
@@ -531,8 +532,8 @@ static bool_ fireproof_gen_hook(void *, void *, void *)
cave_type *c_ptr = &cave[trap_y][trap_x];
/* are the coordinates on a stair, or a wall? */
- if (((f_info[c_ptr->feat].flags1 & FF1_PERMANENT) != 0) ||
- ((f_info[c_ptr->feat].flags1 & FF1_FLOOR) == 0))
+ if (bool(f_info[c_ptr->feat].flags & FF_PERMANENT) ||
+ (f_info[c_ptr->feat].flags & FF_FLOOR).empty())
{
/* try again */
tries = 0;
diff --git a/src/q_god.cc b/src/q_god.cc
index 4634b46b..24dfa6a7 100644
--- a/src/q_god.cc
+++ b/src/q_god.cc
@@ -3,6 +3,7 @@
#include "cave_type.hpp"
#include "dungeon_flag.hpp"
#include "dungeon_info_type.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "hook_chardump_in.hpp"
#include "hook_get_in.hpp"
@@ -376,8 +377,8 @@ static void quest_god_generate_relic()
c_ptr = &cave[y][x];
/* are the coordinates on a floor, not on a permanent feature (eg stairs), and not on a trap ? */
- if ((f_info[c_ptr->feat].flags1 & FF1_FLOOR) &&
- (!(f_info[c_ptr->feat].flags1 & FF1_PERMANENT)) &&
+ if ((f_info[c_ptr->feat].flags & FF_FLOOR) &&
+ (!(f_info[c_ptr->feat].flags & FF_PERMANENT)) &&
(c_ptr->t_idx == 0))
{
break;
diff --git a/src/q_haunted.cc b/src/q_haunted.cc
index 5295945d..b72eb1ca 100644
--- a/src/q_haunted.cc
+++ b/src/q_haunted.cc
@@ -3,6 +3,7 @@
#include "cave.hpp"
#include "cave_type.hpp"
#include "dungeon_flag.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "hook_quest_finish_in.hpp"
#include "hooks.hpp"
@@ -54,11 +55,10 @@ static bool_ quest_haunted_gen_hook(void *, void *, void *)
/* Place some ghosts */
for (i = 12; i > 0; )
{
- int flags;
y = rand_int(21) + 3;
x = rand_int(31) + 3;
- flags = f_info[cave[y][x].feat].flags1;
- if (!(flags & FF1_PERMANENT) && (flags & FF1_FLOOR))
+ auto const flags = f_info[cave[y][x].feat].flags;
+ if (!(flags & FF_PERMANENT) && (flags & FF_FLOOR))
{
m_idx = place_monster_one(y, x, 477, 0, FALSE, MSTATUS_ENEMY);
if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
@@ -69,11 +69,10 @@ static bool_ quest_haunted_gen_hook(void *, void *, void *)
/* Place some random monsters to haunt us */
for (i = damroll(4, 4); i > 0; )
{
- int flags;
y = rand_int(21) + 3;
x = rand_int(31) + 3;
- flags = f_info[cave[y][x].feat].flags1;
- if (!(flags & FF1_PERMANENT) && (flags & FF1_FLOOR))
+ auto const flags = f_info[cave[y][x].feat].flags;
+ if (!(flags & FF_PERMANENT) && (flags & FF_FLOOR))
{
int monsters[22] = { 65, 100, 124, 125, 133, 231, 273, 327, 365, 416, 418,
507, 508, 533, 534, 553, 554, 555, 577, 607, 622, 665};
@@ -87,11 +86,10 @@ static bool_ quest_haunted_gen_hook(void *, void *, void *)
/* Place some random traps */
for (i = 10 + damroll(4, 4); i > 0; )
{
- int flags;
y = rand_int(21) + 3;
x = rand_int(31) + 3;
- flags = f_info[cave[y][x].feat].flags1;
- if (!(flags & FF1_PERMANENT) && (flags & FF1_FLOOR))
+ auto const flags = f_info[cave[y][x].feat].flags;
+ if (!(flags & FF_PERMANENT) && (flags & FF_FLOOR))
{
--i;
place_trap(y, x);
diff --git a/src/q_wolves.cc b/src/q_wolves.cc
index 96869fc9..46a66935 100644
--- a/src/q_wolves.cc
+++ b/src/q_wolves.cc
@@ -3,6 +3,7 @@
#include "cave.hpp"
#include "cave_type.hpp"
#include "dungeon_flag.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "hook_quest_finish_in.hpp"
#include "hooks.hpp"
@@ -54,13 +55,12 @@ static bool_ quest_wolves_gen_hook(void *, void *, void *)
/* Place some random wolves */
for (i = damroll(4, 4); i > 0; )
{
- int m_idx, flags;
y = rand_int(21) + 3;
x = rand_int(31) + 3;
- flags = f_info[cave[y][x].feat].flags1;
- if (!(flags & FF1_PERMANENT) && (flags & FF1_FLOOR))
+ auto const flags = f_info[cave[y][x].feat].flags;
+ if (!(flags & FF_PERMANENT) && (flags & FF_FLOOR))
{
- m_idx = place_monster_one(y, x, 196, 0, magik(50), MSTATUS_ENEMY);
+ int m_idx = place_monster_one(y, x, 196, 0, magik(50), MSTATUS_ENEMY);
if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
--i;
}
@@ -69,13 +69,12 @@ static bool_ quest_wolves_gen_hook(void *, void *, void *)
/* Place some random wargs */
for (i = damroll(4, 4); i > 0; )
{
- int m_idx, flags;
y = rand_int(21) + 3;
x = rand_int(31) + 3;
- flags = f_info[cave[y][x].feat].flags1;
- if (!(flags & FF1_PERMANENT) && (flags & FF1_FLOOR))
+ auto const flags = f_info[cave[y][x].feat].flags;
+ if (!(flags & FF_PERMANENT) && (flags & FF_FLOOR))
{
- m_idx = place_monster_one(y, x, 257, 0, magik(50), MSTATUS_ENEMY);
+ int m_idx = place_monster_one(y, x, 257, 0, magik(50), MSTATUS_ENEMY);
if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
--i;
}
diff --git a/src/spells1.cc b/src/spells1.cc
index bd5f7c99..bb4febf0 100644
--- a/src/spells1.cc
+++ b/src/spells1.cc
@@ -16,6 +16,7 @@
#include "dungeon_flag.hpp"
#include "dungeon_info_type.hpp"
#include "files.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "gods.hpp"
#include "melee2.hpp"
@@ -2987,12 +2988,12 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
* the conditional... -- pelpel
*/
if (!cave_plain_floor_bold(y, x) ||
- (f_info[cave[y][x].feat].flags1 & FF1_PERMANENT)) break;
+ (f_info[cave[y][x].feat].flags & FF_PERMANENT)) break;
/* Destination shouldn't be "interesting" either */
while (tries &&
(!cave_plain_floor_bold(y2, x2) ||
- (f_info[cave[y2][x2].feat].flags1 & FF1_PERMANENT)))
+ (f_info[cave[y2][x2].feat].flags & FF_PERMANENT)))
{
y2 = y1 = randint(cur_hgt) - 1;
x2 = x1 = randint(cur_wid) - 1;
@@ -3033,7 +3034,7 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
case GF_HELL_FIRE:
{
/* "Permanent" features will stay */
- if ((f_info[c_ptr->feat].flags1 & FF1_PERMANENT)) break;
+ if ((f_info[c_ptr->feat].flags & FF_PERMANENT)) break;
/* Trees *will* burn */
if (c_ptr->feat == FEAT_TREES)
@@ -3072,7 +3073,7 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
}
/* Floors can become ash or lava (chance == 25%) */
- else if (f_info[c_ptr->feat].flags1 & FF1_FLOOR)
+ else if (f_info[c_ptr->feat].flags & FF_FLOOR)
{
int k = rand_int(100);
@@ -3119,7 +3120,7 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
int k;
/* "Permanent" features will stay */
- if ((f_info[c_ptr->feat].flags1 & FF1_PERMANENT)) break;
+ if ((f_info[c_ptr->feat].flags & FF_PERMANENT)) break;
/* Needs more than 30 damage */
if (dam < 30) break;
@@ -3188,7 +3189,7 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
case GF_NUKE:
{
/* "Permanent" features will stay */
- if ((f_info[c_ptr->feat].flags1 & FF1_PERMANENT)) break;
+ if ((f_info[c_ptr->feat].flags & FF_PERMANENT)) break;
if ((c_ptr->feat == FEAT_TREES) ||
(c_ptr->feat == FEAT_SMALL_TREES))
@@ -3208,11 +3209,11 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
case GF_DISINTEGRATE:
{
/* "Permanent" features will stay */
- if ((f_info[c_ptr->feat].flags1 & FF1_PERMANENT)) break;
+ if ((f_info[c_ptr->feat].flags & FF_PERMANENT)) break;
if (((c_ptr->feat == FEAT_TREES) ||
(c_ptr->feat == FEAT_SMALL_TREES) ||
- (f_info[c_ptr->feat].flags1 & FF1_FLOOR)) &&
+ (f_info[c_ptr->feat].flags & FF_FLOOR)) &&
(rand_int(100) < 30))
{
/* Flow change */
@@ -3258,7 +3259,7 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
c_ptr->special = c_ptr->special2 = 0;
/* Remove the feature */
- if (!(f_info[c_ptr->feat].flags1 & FF1_PERMANENT))
+ if (!(f_info[c_ptr->feat].flags & FF_PERMANENT))
place_floor_convert_glass(y, x);
}
@@ -3328,7 +3329,7 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
c_ptr->special = c_ptr->special2 = 0;
/* Remove the feature */
- if (!(f_info[c_ptr->feat].flags1 & FF1_PERMANENT))
+ if (!(f_info[c_ptr->feat].flags & FF_PERMANENT))
place_floor_convert_glass(y, x);
/* Hack -- Force redraw */
@@ -3369,7 +3370,7 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
if (cave_floor_bold(y, x)) break;
/* "Permanent" features will stay */
- if ((f_info[c_ptr->feat].flags1 & FF1_PERMANENT)) break;
+ if ((f_info[c_ptr->feat].flags & FF_PERMANENT)) break;
/* Granite -- How about other wall types? */
if ((c_ptr->feat >= FEAT_WALL_EXTRA) &&
@@ -3497,7 +3498,7 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
/* Require a "naked" floor grid */
if (!cave_clean_bold(y, x)) break;
- if ((f_info[c_ptr->feat].flags1 & FF1_PERMANENT)) break;
+ if ((f_info[c_ptr->feat].flags & FF_PERMANENT)) break;
/* Create a closed door */
cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00);
@@ -3529,7 +3530,7 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
/* Require a "naked" floor grid */
if (!cave_clean_bold(y, x)) break;
- if ((f_info[c_ptr->feat].flags1 & FF1_PERMANENT)) break;
+ if ((f_info[c_ptr->feat].flags & FF_PERMANENT)) break;
cave_set_feat(y, x, FEAT_GLYPH);
@@ -3545,8 +3546,8 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
/* Require a "naked" floor grid */
if (!cave_clean_bold(y, x)) break;
- if ((f_info[c_ptr->feat].flags1 & FF1_PERMANENT)) break;
- if (!(f_info[c_ptr->feat].flags1 & FF1_FLOOR)) break;
+ if ((f_info[c_ptr->feat].flags & FF_PERMANENT)) break;
+ if (!(f_info[c_ptr->feat].flags & FF_FLOOR)) break;
/* Place a wall */
cave_set_feat(y, x, FEAT_WALL_EXTRA);
@@ -3589,7 +3590,7 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
case GF_LAVA_FLOW:
{
- if ((f_info[c_ptr->feat].flags1 & FF1_PERMANENT)) break;
+ if ((f_info[c_ptr->feat].flags & FF_PERMANENT)) break;
/* Shallow Lava */
if (dam == 1)
@@ -3703,7 +3704,7 @@ static bool_ project_f(int who, int r, int y, int x, int dam, int typ)
/* Delete the monster (if any) */
delete_monster(y, x);
- if ((f_info[c_ptr->feat].flags1 & FF1_PERMANENT)) break;
+ if ((f_info[c_ptr->feat].flags & FF_PERMANENT)) break;
/* Destroy "valid" grids */
if (cave_valid_bold(y, x))
diff --git a/src/spells2.cc b/src/spells2.cc
index 60aafc16..7b7c3b7b 100644
--- a/src/spells2.cc
+++ b/src/spells2.cc
@@ -14,6 +14,7 @@
#include "cmd7.hpp"
#include "dungeon_flag.hpp"
#include "dungeon_info_type.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "files.hpp"
#include "hook_identify_in.hpp"
@@ -104,7 +105,7 @@ void grow_trees(int rad)
if (!in_bounds(p_ptr->py + j, p_ptr->px + i)) continue;
if (distance(p_ptr->py, p_ptr->px, p_ptr->py + j, p_ptr->px + i) > rad) continue;
- if (cave_clean_bold(p_ptr->py + j, p_ptr->px + i) && (f_info[cave[p_ptr->py][p_ptr->px].feat].flags1 & FF1_SUPPORT_GROWTH))
+ if (cave_clean_bold(p_ptr->py + j, p_ptr->px + i) && (f_info[cave[p_ptr->py][p_ptr->px].feat].flags & FF_SUPPORT_GROWTH))
{
cave_set_feat(p_ptr->py + j, p_ptr->px + i, FEAT_TREES);
}
@@ -126,7 +127,7 @@ void grow_grass(int rad)
if (!in_bounds(p_ptr->py + j, p_ptr->px + i)) continue;
if (distance(p_ptr->py, p_ptr->px, p_ptr->py + j, p_ptr->px + i) > rad) continue;
- if (cave_clean_bold(p_ptr->py + j, p_ptr->px + i) && (f_info[cave[p_ptr->py][p_ptr->px].feat].flags1 & FF1_SUPPORT_GROWTH))
+ if (cave_clean_bold(p_ptr->py + j, p_ptr->px + i) && (f_info[cave[p_ptr->py][p_ptr->px].feat].flags & FF_SUPPORT_GROWTH))
{
cave_set_feat(p_ptr->py + j, p_ptr->px + i, FEAT_GRASS);
}
@@ -5471,11 +5472,11 @@ bool_ wall_stone(int y, int x)
{
cave_type *c_ptr = &cave[y][x];
int flg = PROJECT_GRID | PROJECT_ITEM;
- int featflags = f_info[c_ptr->feat].flags1;
+ auto const featflags = f_info[c_ptr->feat].flags;
bool_ dummy = (project(0, 1, y, x, 0, GF_STONE_WALL, flg));
- if (!(featflags & FF1_PERMANENT) && !(featflags & FF1_WALL))
+ if (!(featflags & FF_PERMANENT) && !(featflags & FF_WALL))
cave_set_feat(y, x, FEAT_FLOOR);
/* Update stuff */
@@ -6023,7 +6024,7 @@ bool_ passwall(int dir, bool_ safe)
c_ptr = &cave[y][x];
/* Perm walls stops the transfer */
- if ((!in_bounds(y, x)) && (f_info[c_ptr->feat].flags1 & FF1_PERMANENT))
+ if ((!in_bounds(y, x)) && (f_info[c_ptr->feat].flags & FF_PERMANENT))
{
/* get the last working position */
x -= ddx[dir];
@@ -6043,7 +6044,7 @@ bool_ passwall(int dir, bool_ safe)
ly = y;
/* Pass over walls */
- if (f_info[c_ptr->feat].flags1 & FF1_WALL) continue;
+ if (f_info[c_ptr->feat].flags & FF_WALL) continue;
/* So it must be ok */
ok = TRUE;
@@ -6340,12 +6341,12 @@ void create_between_gate(int dist, int y, int x)
ij = y;
ii = x;
}
- if (!(f_info[cave[p_ptr->py][p_ptr->px].feat].flags1 & FF1_PERMANENT))
+ if (!(f_info[cave[p_ptr->py][p_ptr->px].feat].flags & FF_PERMANENT))
{
cave_set_feat(p_ptr->py, p_ptr->px, FEAT_BETWEEN);
cave[p_ptr->py][p_ptr->px].special = ii + (ij << 8);
}
- if (!(f_info[cave[ij][ii].feat].flags1 & FF1_PERMANENT))
+ if (!(f_info[cave[ij][ii].feat].flags & FF_PERMANENT))
{
cave_set_feat(ij, ii, FEAT_BETWEEN);
cave[ij][ii].special = p_ptr->px + (p_ptr->py << 8);
@@ -6427,7 +6428,7 @@ void geomancy_random_wall(int y, int x)
};
/* Do not destroy permanent things */
- if (f_info[c_ptr->feat].flags1 & FF1_PERMANENT) {
+ if (f_info[c_ptr->feat].flags & FF_PERMANENT) {
return;
}
@@ -6461,10 +6462,10 @@ void geomancy_random_floor(int y, int x, bool_ kill_wall)
};
/* Do not destroy permanent things */
- if (f_info[c_ptr->feat].flags1 & FF1_PERMANENT) {
+ if (f_info[c_ptr->feat].flags & FF_PERMANENT) {
return;
}
- if (!(kill_wall || (f_info[c_ptr->feat].flags1 & FF1_FLOOR))) {
+ if (!(kill_wall || (f_info[c_ptr->feat].flags & FF_FLOOR))) {
return;
}
diff --git a/src/spells3.cc b/src/spells3.cc
index b5a767c5..fad11049 100644
--- a/src/spells3.cc
+++ b/src/spells3.cc
@@ -3,6 +3,7 @@
#include "cave.hpp"
#include "cave_type.hpp"
#include "cmd5.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "lua_bind.hpp"
#include "mimic.hpp"
@@ -2738,8 +2739,8 @@ casting_result tempo_magelock()
c_ptr = &cave[y][x];
- if ((!(f_info[c_ptr->feat].flags1 | FF1_FLOOR)) ||
- (f_info[c_ptr->feat].flags1 | FF1_PERMANENT) ||
+ if ((!(f_info[c_ptr->feat].flags | FF_FLOOR)) ||
+ (f_info[c_ptr->feat].flags | FF_PERMANENT) ||
(!los(p_ptr->py, p_ptr->px, y, x)))
{
msg_print("You cannot place it there.");
diff --git a/src/traps.cc b/src/traps.cc
index 2f8578d4..5ba66cbd 100644
--- a/src/traps.cc
+++ b/src/traps.cc
@@ -16,6 +16,7 @@
#include "cmd2.hpp"
#include "dungeon_flag.hpp"
#include "dungeon_info_type.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "files.hpp"
#include "gods.hpp"
@@ -125,7 +126,7 @@ static bool_ do_trap_teleport_away(object_type *i_ptr, s16b y, s16b x)
c_ptr = &cave[y1][x1];
/* Require floor space (or shallow terrain) -KMW- */
- if (!(f_info[c_ptr->feat].flags1 & FF1_FLOOR)) continue;
+ if (!(f_info[c_ptr->feat].flags & FF_FLOOR)) continue;
o_idx = drop_near(i_ptr, 0, y1, x1);
}
@@ -348,7 +349,7 @@ static bool_ player_handle_trap_of_walls(void)
/* Destroy location (if valid) */
if ((cx < cur_wid) && (cy < cur_hgt) && cave_valid_bold(cy, cx))
{
- bool_ floor = (f_info[cave[cy][cx].feat].flags1 & FF1_FLOOR);
+ bool floor = bool(f_info[cave[cy][cx].feat].flags & FF_FLOOR);
/* Delete any object that is still there */
delete_object(cy, cx);
@@ -1904,7 +1905,7 @@ void player_activate_door_trap(s16b y, s16b x)
/* Return if trap or door not found */
if ((c_ptr->t_idx == 0) ||
- !(f_info[c_ptr->feat].flags1 & FF1_DOOR)) return;
+ !(f_info[c_ptr->feat].flags & FF_DOOR)) return;
/* Disturb */
disturb(0);
@@ -1952,10 +1953,10 @@ void place_trap(int y, int x)
/* Traps only appears on empty floor */
if (!cave_floor_grid(c_ptr) &&
- !(f_info[c_ptr->feat].flags1 & (FF1_DOOR))) return;
+ !(f_info[c_ptr->feat].flags & FF_DOOR)) return;
/* Set flags */
- if (f_info[c_ptr->feat].flags1 & FF1_DOOR) flags = FTRAP_DOOR;
+ if (f_info[c_ptr->feat].flags & FF_DOOR) flags = FTRAP_DOOR;
else flags = FTRAP_FLOOR;
/* Try 100 times */
@@ -2054,7 +2055,7 @@ void wiz_place_trap(int y, int x, int idx)
cave_type *c_ptr = &cave[y][x];
/* Dangerous enough as it is... */
- if (!cave_floor_grid(c_ptr) && (!(f_info[c_ptr->feat].flags1 & FF1_DOOR))) return;
+ if (!cave_floor_grid(c_ptr) && (!(f_info[c_ptr->feat].flags & FF_DOOR))) return;
c_ptr->t_idx = idx;
}
diff --git a/src/wild.cc b/src/wild.cc
index 7724176f..7e7b20d0 100644
--- a/src/wild.cc
+++ b/src/wild.cc
@@ -10,6 +10,7 @@
#include "cave.hpp"
#include "cave_type.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "hook_wild_gen_in.hpp"
#include "hooks.hpp"
@@ -522,7 +523,7 @@ void wilderness_gen()
else
{
/* Darken "boring" features */
- if (!(f_info[c_ptr->feat].flags1 & FF1_REMEMBER))
+ if (!(f_info[c_ptr->feat].flags & FF_REMEMBER))
{
/* Forget the grid */
c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
@@ -915,7 +916,7 @@ static void set_border(int y, int x)
/* Was a floor */
if (cave_floor_bold(y, x) ||
- (f_info[cave[y][x].feat].flags1 & FF1_DOOR))
+ (f_info[cave[y][x].feat].flags & FF_DOOR))
{
cave_set_feat(y, x, FEAT_DOOR_HEAD);
}
diff --git a/src/xtra2.cc b/src/xtra2.cc
index 4f1536db..3665ee5b 100644
--- a/src/xtra2.cc
+++ b/src/xtra2.cc
@@ -14,6 +14,7 @@
#include "corrupt.hpp"
#include "dungeon_info_type.hpp"
#include "ego_item_type.hpp"
+#include "feature_flag.hpp"
#include "feature_type.hpp"
#include "files.hpp"
#include "gods.hpp"
@@ -2975,7 +2976,7 @@ void monster_death(int m_idx)
{
for (int j = -1; j <= 1; j++)
{
- if (!(f_info[cave[y + j][x + i].feat].flags1 & FF1_PERMANENT))
+ if (!(f_info[cave[y + j][x + i].feat].flags & FF_PERMANENT))
{
cave_set_feat(y + j, x + i, d_info[dungeon_type].floor1);
}
@@ -3849,7 +3850,7 @@ static bool_ target_set_accept(int y, int x)
(c_ptr->feat <= FEAT_DOOR_TAIL)) return (FALSE);
/* Accept 'naturally' interesting features */
- if (f_info[c_ptr->feat].flags1 & FF1_NOTICE) return (TRUE);
+ if (f_info[c_ptr->feat].flags & FF_NOTICE) return (TRUE);
}
/* Nope */