diff options
author | Bardur Arantsson <bardur@scientician.net> | 2016-03-29 20:32:55 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2016-03-29 20:32:55 +0200 |
commit | 899041ce6b7cbc33e8cb3124aaa54b518c4a4b72 (patch) | |
tree | 72d9bd8e36db2b8392512db677157b6f32c10b49 /src | |
parent | c8df88d8c61197d8f019efa0ba373ed14a28d914 (diff) |
Convert dungeon_info_type to use new flag_set
Diffstat (limited to 'src')
-rw-r--r-- | src/birth.cc | 3 | ||||
-rw-r--r-- | src/cave.cc | 3 | ||||
-rw-r--r-- | src/cmd2.cc | 19 | ||||
-rw-r--r-- | src/cmd4.cc | 7 | ||||
-rw-r--r-- | src/cmd5.cc | 11 | ||||
-rw-r--r-- | src/cmd6.cc | 9 | ||||
-rw-r--r-- | src/cmd7.cc | 3 | ||||
-rw-r--r-- | src/defines.h | 52 | ||||
-rw-r--r-- | src/dungeon.cc | 35 | ||||
-rw-r--r-- | src/dungeon_flag.hpp | 12 | ||||
-rw-r--r-- | src/dungeon_flag_list.hpp | 55 | ||||
-rw-r--r-- | src/dungeon_flag_set.hpp | 7 | ||||
-rw-r--r-- | src/dungeon_info_type.hpp | 4 | ||||
-rw-r--r-- | src/generate.cc | 89 | ||||
-rw-r--r-- | src/init1.cc | 97 | ||||
-rw-r--r-- | src/init1.hpp | 3 | ||||
-rw-r--r-- | src/levels.cc | 2 | ||||
-rw-r--r-- | src/loadsave.cc | 22 | ||||
-rw-r--r-- | src/melee2.cc | 5 | ||||
-rw-r--r-- | src/monster2.cc | 13 | ||||
-rw-r--r-- | src/powers.cc | 7 | ||||
-rw-r--r-- | src/q_betwen.cc | 3 | ||||
-rw-r--r-- | src/q_dragons.cc | 3 | ||||
-rw-r--r-- | src/q_evil.cc | 3 | ||||
-rw-r--r-- | src/q_fireprof.cc | 3 | ||||
-rw-r--r-- | src/q_god.cc | 94 | ||||
-rw-r--r-- | src/q_haunted.cc | 3 | ||||
-rw-r--r-- | src/q_library.cc | 3 | ||||
-rw-r--r-- | src/q_rand.cc | 13 | ||||
-rw-r--r-- | src/q_thief.cc | 3 | ||||
-rw-r--r-- | src/q_wolves.cc | 3 | ||||
-rw-r--r-- | src/spells1.cc | 19 | ||||
-rw-r--r-- | src/spells2.cc | 19 | ||||
-rw-r--r-- | src/traps.cc | 7 | ||||
-rw-r--r-- | src/variable.cc | 4 | ||||
-rw-r--r-- | src/variable.hpp | 4 | ||||
-rw-r--r-- | src/xtra1.cc | 5 |
37 files changed, 319 insertions, 328 deletions
diff --git a/src/birth.cc b/src/birth.cc index 4c9ff06a..09dabe24 100644 --- a/src/birth.cc +++ b/src/birth.cc @@ -12,6 +12,7 @@ #include "corrupt.hpp" #include "cmd4.hpp" #include "cmd5.hpp" +#include "dungeon_flag.hpp" #include "dungeon_info_type.hpp" #include "files.h" #include "files.hpp" @@ -3126,7 +3127,7 @@ void player_birth(void) d_ptr->t_idx[z] = 0; d_ptr->t_level[z] = 0; } - if (!(d_ptr->flags1 & DF1_RANDOM_TOWNS)) continue; + if (!(d_ptr->flags & DF_RANDOM_TOWNS)) continue; /* Can we add a town ? */ while (magik(TOWN_CHANCE - (num * 10))) diff --git a/src/cave.cc b/src/cave.cc index 5ff31019..4c5c4ae0 100644 --- a/src/cave.cc +++ b/src/cave.cc @@ -1,6 +1,7 @@ #include "cave.hpp" #include "cave_type.hpp" +#include "dungeon_flag.hpp" #include "feature_type.hpp" #include "hook_enter_dungeon_in.hpp" #include "monster2.hpp" @@ -4467,7 +4468,7 @@ void disturb(int stop_search) static int random_quest_number() { if ((dun_level >= 1) && (dun_level < MAX_RANDOM_QUEST) && - (dungeon_flags1 & DF1_PRINCIPAL) && + (dungeon_flags & DF_PRINCIPAL) && (random_quests[dun_level].type) && (!random_quests[dun_level].done) && (!is_randhero(dun_level))) diff --git a/src/cmd2.cc b/src/cmd2.cc index 8f4831bf..023f49f7 100644 --- a/src/cmd2.cc +++ b/src/cmd2.cc @@ -13,6 +13,7 @@ #include "cave_type.hpp" #include "cmd1.hpp" #include "dungeon_info_type.hpp" +#include "dungeon_flag.hpp" #include "feature_type.hpp" #include "files.hpp" #include "gods.hpp" @@ -160,7 +161,7 @@ void do_cmd_go_up(void) { go_up = TRUE; } - else if ((dungeon_flags2 & DF2_ASK_LEAVE)) + else if (dungeon_flags & DF_ASK_LEAVE) { go_up = get_check("Leave this unique level forever? "); } @@ -181,7 +182,7 @@ void do_cmd_go_up(void) { go_up = TRUE; } - else if ((dungeon_flags2 & DF2_ASK_LEAVE)) + else if (dungeon_flags & DF_ASK_LEAVE) { go_up = get_check("Leave this unique level forever? "); } @@ -200,7 +201,7 @@ void do_cmd_go_up(void) { leaving_quest = p_ptr->inside_quest; - if ((dungeon_flags2 & DF2_ASK_LEAVE) && + if ((dungeon_flags & DF_ASK_LEAVE) && !get_check("Leave this unique level forever? ")) return; @@ -214,12 +215,12 @@ void do_cmd_go_up(void) } /* Exits to previous area in flat terrains */ - else if (!(dungeon_flags1 & DF1_FLAT) && + else if (!(dungeon_flags & DF_FLAT) && p_ptr->prob_travel && !p_ptr->inside_quest) { if (d_ptr->mindepth == dun_level) return; - if (dungeon_flags2 & DF2_NO_EASY_MOVE) + if (dungeon_flags & DF_NO_EASY_MOVE) { msg_print("Some powerful force prevents your from teleporting."); return; @@ -366,7 +367,7 @@ void do_cmd_go_down(void) if (c_ptr->t_idx == TRAP_OF_SINKING) fall_trap = TRUE; /* test if on special level */ - if ((dungeon_flags2 & DF2_ASK_LEAVE)) + if (dungeon_flags & DF_ASK_LEAVE) { prt("Leave this unique level forever (y/n) ? ", 0, 0); flush(); @@ -444,12 +445,12 @@ void do_cmd_go_down(void) return; } - else if (!(dungeon_flags1 & DF1_FLAT) && + else if (!(dungeon_flags & DF_FLAT) && p_ptr->prob_travel && !p_ptr->inside_quest) { if (d_ptr->maxdepth == dun_level) return; - if (dungeon_flags2 & DF2_NO_EASY_MOVE) + if (dungeon_flags & DF_NO_EASY_MOVE) { msg_print("Some powerful force prevents your from teleporting."); return; @@ -4259,7 +4260,7 @@ static bool_ tport_vertically(bool_ how) return (FALSE); } - if (dungeon_flags2 & DF2_NO_EASY_MOVE) + if (dungeon_flags & DF_NO_EASY_MOVE) { msg_print("Some powerful force prevents you from teleporting."); return FALSE; diff --git a/src/cmd4.cc b/src/cmd4.cc index 9df90887..71ca24fe 100644 --- a/src/cmd4.cc +++ b/src/cmd4.cc @@ -10,6 +10,7 @@ #include "artifact_type.hpp" #include "cave_type.hpp" #include "corrupt.hpp" +#include "dungeon_flag.hpp" #include "dungeon_info_type.hpp" #include "feature_type.hpp" #include "files.hpp" @@ -2722,7 +2723,7 @@ void do_cmd_feeling(void) if (feeling > 10) feeling = 10; /* Feeling of the fate */ - if (fate_flag && !(dungeon_flags2 & DF2_SPECIAL) && !p_ptr->inside_quest) + if (fate_flag && !(dungeon_flags & DF_SPECIAL) && !p_ptr->inside_quest) { msg_print("You feel that you will meet your fate here."); } @@ -2734,11 +2735,11 @@ void do_cmd_feeling(void) } /* No useful feeling in special levels */ - if (dungeon_flags2 & DF2_DESC) + if (dungeon_flags & DF_DESC) { char buf[1024]; - if ((get_dungeon_save(buf)) || (generate_special_feeling) || (dungeon_flags2 & DF2_DESC_ALWAYS)) + if (get_dungeon_save(buf) || generate_special_feeling || (dungeon_flags & DF_DESC_ALWAYS)) { if (!get_level_desc(buf)) msg_print("Someone forgot to describe this level!"); else msg_print(buf); diff --git a/src/cmd5.cc b/src/cmd5.cc index 986ed18f..6dccbc8c 100644 --- a/src/cmd5.cc +++ b/src/cmd5.cc @@ -12,6 +12,7 @@ #include "cave.hpp" #include "cave_type.hpp" #include "corrupt.hpp" +#include "dungeon_flag.hpp" #include "lua_bind.hpp" #include "monster2.hpp" #include "monster_race.hpp" @@ -1586,7 +1587,7 @@ static void apply_monster_power(monster_race const *r_ptr, int power) /* BLINK */ case 68: { - if (dungeon_flags2 & DF2_NO_TELEPORT) + if (dungeon_flags & DF_NO_TELEPORT) { msg_print("No teleport on special levels..."); break; @@ -1600,7 +1601,7 @@ static void apply_monster_power(monster_race const *r_ptr, int power) /* TPORT */ case 69: { - if (dungeon_flags2 & DF2_NO_TELEPORT) + if (dungeon_flags & DF_NO_TELEPORT) { msg_print("No teleport on special levels..."); break; @@ -1616,7 +1617,7 @@ static void apply_monster_power(monster_race const *r_ptr, int power) { int ii, ij; - if (dungeon_flags2 & DF2_NO_TELEPORT) + if (dungeon_flags & DF_NO_TELEPORT) { msg_print("No teleport on special levels..."); break; @@ -1644,7 +1645,7 @@ static void apply_monster_power(monster_race const *r_ptr, int power) /* TELE_AWAY */ case 71: { - if (dungeon_flags2 & DF2_NO_TELEPORT) + if (dungeon_flags & DF_NO_TELEPORT) { msg_print("No teleport on special levels..."); break; @@ -1661,7 +1662,7 @@ static void apply_monster_power(monster_race const *r_ptr, int power) /* TELE_LEVEL */ case 72: { - if (dungeon_flags2 & DF2_NO_TELEPORT) + if (dungeon_flags & DF_NO_TELEPORT) { msg_print("No teleport on special levels..."); break; diff --git a/src/cmd6.cc b/src/cmd6.cc index 16756331..24ede94f 100644 --- a/src/cmd6.cc +++ b/src/cmd6.cc @@ -14,6 +14,7 @@ #include "cmd1.hpp" #include "cmd7.hpp" #include "corrupt.hpp" +#include "dungeon_flag.hpp" #include "dungeon_info_type.hpp" #include "ego_item_type.hpp" #include "files.hpp" @@ -3127,7 +3128,7 @@ void do_cmd_read_scroll(void) case SV_SCROLL_WORD_OF_RECALL: { - if ((dungeon_flags2 & DF2_ASK_LEAVE) && !get_check("Leave this unique level forever? ")) + if ((dungeon_flags & DF_ASK_LEAVE) && !get_check("Leave this unique level forever? ")) { used_up = FALSE; } @@ -4301,7 +4302,7 @@ void do_cmd_zap_rod(void) case SV_ROD_RECALL: { - if ((dungeon_flags2 & DF2_ASK_LEAVE) && !get_check("Leave this unique level forever? ")) + if ((dungeon_flags & DF_ASK_LEAVE) && !get_check("Leave this unique level forever? ")) { use_charge = FALSE; } @@ -6849,7 +6850,7 @@ const char *activation_aux(object_type * o_ptr, bool_ doit, int item) case ACT_DIM_DOOR: { if (!doit) return "dimension door every 100 turns"; - if (dungeon_flags2 & DF2_NO_TELEPORT) + if (dungeon_flags & DF_NO_TELEPORT) { msg_print("Not on special levels!"); break; @@ -6892,7 +6893,7 @@ const char *activation_aux(object_type * o_ptr, bool_ doit, int item) case ACT_RECALL: { - if (!(dungeon_flags2 & DF2_ASK_LEAVE) || ((dungeon_flags2 & DF2_ASK_LEAVE) && !get_check("Leave this unique level forever? "))) + if (!(dungeon_flags & DF_ASK_LEAVE) || ((dungeon_flags & DF_ASK_LEAVE) && !get_check("Leave this unique level forever? "))) { if (!doit) return "word of recall every 200 turns"; msg_print("It glows soft white..."); diff --git a/src/cmd7.cc b/src/cmd7.cc index 7b6cd8d2..6e7aefc3 100644 --- a/src/cmd7.cc +++ b/src/cmd7.cc @@ -13,6 +13,7 @@ #include "cmd1.hpp" #include "cmd5.hpp" #include "cmd6.hpp" +#include "dungeon_flag.hpp" #include "ego_item_type.hpp" #include "files.hpp" #include "hooks.hpp" @@ -531,7 +532,7 @@ void do_cmd_mindcraft(void) { int ii, ij; - if (dungeon_flags2 & DF2_NO_TELEPORT) + if (dungeon_flags & DF_NO_TELEPORT) { msg_print("Not on special levels!"); break; diff --git a/src/defines.h b/src/defines.h index 91d3065d..bcae8ae5 100644 --- a/src/defines.h +++ b/src/defines.h @@ -2558,58 +2558,6 @@ #define FF1_ATTR_MULTI 0x00020000L #define FF1_SUPPORT_GROWTH 0x00040000L -/*** Dungeon type flags -- DG ***/ -#define DF1_PRINCIPAL 0x00000001L /* Is a principal dungeon */ -#define DF1_MAZE 0x00000002L /* Is a maze-type dungeon */ -#define DF1_SMALLEST 0x00000004L /* Creates VERY small levels like The Maze */ -#define DF1_SMALL 0x00000008L /* Creates small levels like Dol Goldor */ -#define DF1_BIG 0x00000010L /* Creates big levels like Moria, and Angband dungeons */ -#define DF1_NO_DOORS 0x00000020L /* No doors on rooms, like Barrowdowns, Old Forest etc) */ -#define DF1_WATER_RIVER 0x00000040L /* Allow a single water streamer on a level */ -#define DF1_LAVA_RIVER 0x00000080L /* Allow a single lava streamer on a level */ -#define DF1_WATER_RIVERS 0x00000100L /* Allow multiple water streamers on a level */ -#define DF1_LAVA_RIVERS 0x00000200L /* Allow multiple lava streamers on a level */ -#define DF1_CAVE 0x00000400L /* Allow rooms */ -#define DF1_CAVERN 0x00000800L /* Allow cavern rooms */ -#define DF1_NO_UP 0x00001000L /* Disallow up stairs */ -#define DF1_HOT 0x00002000L /* Corpses on ground and in pack decay quicker through heat */ -#define DF1_COLD 0x00004000L /* Corpses on ground and in pack decay quicker through cold */ -#define DF1_FORCE_DOWN 0x00008000L /* No up stairs generated */ -#define DF1_FORGET 0x00010000L /* Features are forgotten, like the Maze and Illusory Castle */ -#define DF1_NO_DESTROY 0x00020000L /* No destroyed levels in dungeon */ -#define DF1_SAND_VEIN 0x00040000L /* Like in the sandworm lair */ -#define DF1_CIRCULAR_ROOMS 0x00080000L /* Allow circular rooms */ -#define DF1_EMPTY 0x00100000L /* Allow arena levels */ -#define DF1_DAMAGE_FEAT 0x00200000L -#define DF1_FLAT 0x00400000L /* Creates paths to next areas at edge of level, like Barrowdowns */ -#define DF1_TOWER 0x00800000L /* You start at bottom and go up rather than the reverse */ -#define DF1_RANDOM_TOWNS 0x01000000L /* Allow random towns */ -#define DF1_DOUBLE 0x02000000L /* Creates double-walled dungeon like Helcaraxe and Erebor */ -#define DF1_LIFE_LEVEL 0x04000000L /* Creates dungeon level on modified 'game of life' algorithm */ -#define DF1_EVOLVE 0x08000000L /* Evolving, pulsing levels like Heart of the Earth */ -#define DF1_ADJUST_LEVEL_1 0x10000000L /* Minimum monster level will be equal to dungeon level */ -#define DF1_ADJUST_LEVEL_2 0x20000000L /* Minimum monster level will be double the dungeon level */ -#define DF1_NO_RECALL 0x40000000L /* No recall allowed */ -#define DF1_NO_STREAMERS 0x80000000L /* No streamers */ - -#define DF2_ADJUST_LEVEL_1_2 0x00000001L /* Minimum monster level will be half the dungeon level */ -#define DF2_NO_SHAFT 0x00000002L /* No shafts */ -#define DF2_ADJUST_LEVEL_PLAYER 0x00000004L /* Uses player level*2 instead of dungeon level for other ADJUST_LEVEL flags */ -#define DF2_NO_TELEPORT 0x00000008L -#define DF2_ASK_LEAVE 0x00000010L -#define DF2_NO_STAIR 0x00000020L -#define DF2_SPECIAL 0x00000040L -#define DF2_NO_NEW_MONSTER 0x00000080L -#define DF2_DESC 0x00000100L -#define DF2_NO_GENO 0x00000200L -#define DF2_NO_BREATH 0x00000400L /* Oups, cannot breath here */ -#define DF2_WATER_BREATH 0x00000800L /* Oups, cannot breath here, need water breathing */ -#define DF2_ELVEN 0x00001000L /* Try to create elven monster ego */ -#define DF2_DWARVEN 0x00002000L /* Try to create dwarven monster ego */ -#define DF2_NO_EASY_MOVE 0x00004000L /* Forbid stuff like teleport level, probability travel, ... */ -#define DF2_NO_RECALL_OUT 0x00008000L /* Cannot recall out of the place */ -#define DF2_DESC_ALWAYS 0x00010000L /* Always shows the desc */ - /*** 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 bc3e4a71..b2592979 100644 --- a/src/dungeon.cc +++ b/src/dungeon.cc @@ -20,6 +20,7 @@ #include "cmd6.hpp" #include "cmd7.hpp" #include "corrupt.hpp" +#include "dungeon_flag.hpp" #include "dungeon_info_type.hpp" #include "feature_type.hpp" #include "files.h" @@ -1402,7 +1403,7 @@ static void process_world(void) (rand_int(d_info[(dun_level) ? dungeon_type : DUNGEON_WILDERNESS].max_m_alloc_chance) == 0)) { /* Make a new monster */ - if (!(dungeon_flags2 & DF2_NO_NEW_MONSTER)) + if (!(dungeon_flags & DF_NO_NEW_MONSTER)) { (void)alloc_monster(MAX_SIGHT + 5, FALSE); } @@ -2326,7 +2327,7 @@ static void process_world(void) { int l, dam = 0; - if (!(dungeon_flags1 & DF1_DAMAGE_FEAT)) + if (!(dungeon_flags & DF_DAMAGE_FEAT)) { /* If the grid is empty, skip it */ if ((cave[j][k].o_idxs.empty()) && @@ -2559,12 +2560,12 @@ static void process_world(void) } /* Arg cannot breath? */ - if ((dungeon_flags2 & DF2_WATER_BREATH) && (!p_ptr->water_breath)) + if ((dungeon_flags & DF_WATER_BREATH) && (!p_ptr->water_breath)) { cmsg_print(TERM_L_RED, "You cannot breathe water! You suffocate!"); take_hit(damroll(3, p_ptr->lev), "suffocating"); } - if ((dungeon_flags2 & DF2_NO_BREATH) && (!p_ptr->magical_breath)) + if ((dungeon_flags & DF_NO_BREATH) && (!p_ptr->magical_breath)) { cmsg_print(TERM_L_RED, "There is no air here! You suffocate!"); take_hit(damroll(3, p_ptr->lev), "suffocating"); @@ -2922,11 +2923,11 @@ static void process_world(void) { if (o_ptr->timeout > 0) { - if (dungeon_flags1 & DF1_HOT) + if (dungeon_flags & DF_HOT) { o_ptr->pval -= 2; } - else if ((dungeon_flags1 & DF1_COLD) && rand_int(2)) + else if ((dungeon_flags & DF_COLD) && rand_int(2)) { if (magik(50)) o_ptr->pval--; } @@ -3040,11 +3041,11 @@ static void process_world(void) { if (o_ptr->timeout > 0) { - if (dungeon_flags1 & DF1_HOT) + if (dungeon_flags & DF_HOT) { o_ptr->pval -= 2; } - else if ((dungeon_flags1 & DF1_COLD) && rand_int(2)) + else if ((dungeon_flags & DF_COLD) && rand_int(2)) { if (magik(50)) o_ptr->pval--; } @@ -3098,7 +3099,7 @@ static void process_world(void) } /* No recall. sorry */ - else if (dungeon_flags2 & DF2_NO_RECALL_OUT) + else if (dungeon_flags & DF_NO_RECALL_OUT) { cmsg_print(TERM_L_DARK, "You cannot recall from here."); p_ptr->word_recall = 0; @@ -4651,7 +4652,7 @@ static void process_player(void) * * Forget everything when requested hehe I'm *NASTY* */ - if (dun_level && (dungeon_flags1 & DF1_FORGET)) + if (dun_level && (dungeon_flags & DF_FORGET)) { wiz_dark(); } @@ -4736,8 +4737,8 @@ static void dungeon(void) if (!dungeon_stair) create_down_shaft = create_up_shaft = FALSE; /* no connecting stairs on special levels */ - if (!(dungeon_flags2 & DF2_NO_STAIR)) create_down_stair = create_up_stair = FALSE; - if (!(dungeon_flags2 & DF2_NO_STAIR)) create_down_shaft = create_up_shaft = FALSE; + if (!(dungeon_flags & DF_NO_STAIR)) create_down_stair = create_up_stair = FALSE; + if (!(dungeon_flags & DF_NO_STAIR)) create_down_shaft = create_up_shaft = FALSE; /* Make a stairway. */ if ((create_up_stair || create_down_stair || @@ -4753,19 +4754,19 @@ static void dungeon(void) /* Make stairs */ if (create_down_stair) { - cave_set_feat(p_ptr->py, p_ptr->px, (dungeon_flags1 & DF1_FLAT) ? FEAT_WAY_MORE : FEAT_MORE); + cave_set_feat(p_ptr->py, p_ptr->px, (dungeon_flags & DF_FLAT) ? FEAT_WAY_MORE : FEAT_MORE); } else if (create_down_shaft) { - cave_set_feat(p_ptr->py, p_ptr->px, (dungeon_flags1 & DF1_FLAT) ? FEAT_WAY_MORE : FEAT_SHAFT_DOWN); + cave_set_feat(p_ptr->py, p_ptr->px, (dungeon_flags & DF_FLAT) ? FEAT_WAY_MORE : FEAT_SHAFT_DOWN); } else if (create_up_shaft) { - cave_set_feat(p_ptr->py, p_ptr->px, (dungeon_flags1 & DF1_FLAT) ? FEAT_WAY_LESS : FEAT_SHAFT_UP); + cave_set_feat(p_ptr->py, p_ptr->px, (dungeon_flags & DF_FLAT) ? FEAT_WAY_LESS : FEAT_SHAFT_UP); } else { - cave_set_feat(p_ptr->py, p_ptr->px, (dungeon_flags1 & DF1_FLAT) ? FEAT_WAY_LESS : FEAT_LESS); + cave_set_feat(p_ptr->py, p_ptr->px, (dungeon_flags & DF_FLAT) ? FEAT_WAY_LESS : FEAT_LESS); } } @@ -4981,7 +4982,7 @@ static void dungeon(void) process_hooks_new(HOOK_END_TURN, NULL, NULL); /* Make it pulsate and live !!!! */ - if ((dungeon_flags1 & DF1_EVOLVE) && dun_level) + if ((dungeon_flags & DF_EVOLVE) && dun_level) { if (!(turn % 10)) evolve_level(TRUE); } diff --git a/src/dungeon_flag.hpp b/src/dungeon_flag.hpp new file mode 100644 index 00000000..bf8d77d8 --- /dev/null +++ b/src/dungeon_flag.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include "dungeon_flag_set.hpp" +#include <boost/preprocessor/cat.hpp> + +// +// Define flag set for each flag. +// +#define DF(tier, index, name) \ + DECLARE_FLAG(dungeon_flag_set, BOOST_PP_CAT(DF_,name), tier, index) +#include "dungeon_flag_list.hpp" +#undef DF diff --git a/src/dungeon_flag_list.hpp b/src/dungeon_flag_list.hpp new file mode 100644 index 00000000..8fdefc95 --- /dev/null +++ b/src/dungeon_flag_list.hpp @@ -0,0 +1,55 @@ +/** + * X-macro list of all the dungeon flags + */ + +/* DF(<tier>, <index>, <name>) */ +DF(1, 0, PRINCIPAL) +DF(1, 1, MAZE) +DF(1, 2, SMALLEST) +DF(1, 3, SMALL) +DF(1, 4, BIG) +DF(1, 5, NO_DOORS) +DF(1, 6, WATER_RIVER) +DF(1, 7, LAVA_RIVER) +DF(1, 8, WATER_RIVERS) +DF(1, 9, LAVA_RIVERS) +DF(1, 10, CAVE) +DF(1, 11, CAVERN) +DF(1, 12, NO_UP) +DF(1, 13, HOT) +DF(1, 14, COLD) +DF(1, 15, FORCE_DOWN) +DF(1, 16, FORGET) +DF(1, 17, NO_DESTROY) +DF(1, 18, SAND_VEIN) +DF(1, 19, CIRCULAR_ROOMS) +DF(1, 20, EMPTY) +DF(1, 21, DAMAGE_FEAT) +DF(1, 22, FLAT) +DF(1, 23, TOWER) +DF(1, 24, RANDOM_TOWNS) +DF(1, 25, DOUBLE) +DF(1, 26, LIFE_LEVEL) +DF(1, 27, EVOLVE) +DF(1, 28, ADJUST_LEVEL_1) +DF(1, 29, ADJUST_LEVEL_2) +DF(1, 30, NO_RECALL) +DF(1, 31, NO_STREAMERS) + +DF(2, 0, ADJUST_LEVEL_1_2) +DF(2, 1, NO_SHAFT) +DF(2, 2, ADJUST_LEVEL_PLAYER) +DF(2, 3, NO_TELEPORT) +DF(2, 4, ASK_LEAVE) +DF(2, 5, NO_STAIR) +DF(2, 6, SPECIAL) +DF(2, 7, NO_NEW_MONSTER) +DF(2, 8, DESC) +DF(2, 9, NO_GENO) +DF(2, 10, NO_BREATH) +DF(2, 11, WATER_BREATH) +DF(2, 12, ELVEN) +DF(2, 13, DWARVEN) +DF(2, 14, NO_EASY_MOVE) +DF(2, 15, NO_RECALL_OUT) +DF(2, 16, DESC_ALWAYS) diff --git a/src/dungeon_flag_set.hpp b/src/dungeon_flag_set.hpp new file mode 100644 index 00000000..539a574a --- /dev/null +++ b/src/dungeon_flag_set.hpp @@ -0,0 +1,7 @@ +#pragma once + +#include "flag_set.hpp" + +constexpr std::size_t DF_MAX_TIERS = 2; + +typedef flag_set<DF_MAX_TIERS> dungeon_flag_set; diff --git a/src/dungeon_info_type.hpp b/src/dungeon_info_type.hpp index 77c037a7..c4edc770 100644 --- a/src/dungeon_info_type.hpp +++ b/src/dungeon_info_type.hpp @@ -3,6 +3,7 @@ #include "h-basic.h" #include "rule_type.hpp" #include "obj_theme.hpp" +#include "dungeon_flag_set.hpp" #include <array> @@ -45,8 +46,7 @@ struct dungeon_info_type int min_m_alloc_level = 0; /* Minimal number of monsters per level */ int max_m_alloc_chance = 0; /* There is a 1/max_m_alloc_chance chance per round of creating a new monster */ - u32b flags1 = 0; /* Dungeon flags 1 */ - u32b flags2 = 0; /* Dungeon flags 2 */ + dungeon_flag_set flags { }; /* Dungeon flags */ int size_x = 0; int size_y = 0; diff --git a/src/generate.cc b/src/generate.cc index 250686fd..ca0022e1 100644 --- a/src/generate.cc +++ b/src/generate.cc @@ -12,6 +12,7 @@ #include "cave.hpp" #include "cave_type.hpp" #include "dungeon_info_type.hpp" +#include "dungeon_flag.hpp" #include "feature_type.hpp" #include "hook_build_room1_in.hpp" #include "hooks.hpp" @@ -406,7 +407,7 @@ static void place_up_stairs(int y, int x) cave_type *c_ptr = &cave[y][x]; /* Create up stairs */ - if ((rand_int(3) != 0) || (dungeon_flags2 & DF2_NO_SHAFT)) + if ((rand_int(3) != 0) || (dungeon_flags & DF_NO_SHAFT)) { cave_set_feat(y, x, FEAT_LESS); } @@ -431,7 +432,7 @@ static void place_down_stairs(int y, int x) * All thoses tests are necesary because a shaft can jump up to 4 levels */ if ((dun_level + 4 > d_info[dungeon_type].maxdepth) || - (rand_int(3) != 0) || (dungeon_flags2 & DF2_NO_SHAFT)) + (rand_int(3) != 0) || (dungeon_flags & DF_NO_SHAFT)) { cave_set_feat(y, x, FEAT_MORE); } @@ -706,7 +707,7 @@ bool_ new_player_spot(int branch) int max_attempts = 5000; /* Place the player */ - if (dungeon_flags1 & DF1_FLAT) + if (dungeon_flags & DF_FLAT) { place_new_way(&y, &x); } @@ -739,13 +740,13 @@ bool_ new_player_spot(int branch) p_ptr->px = x; /* XXX XXX XXX */ - if (dungeon_stair && !(dungeon_flags2 & DF2_NO_STAIR) && dun_level && + if (dungeon_stair && !(dungeon_flags & DF_NO_STAIR) && dun_level && (!is_quest(dun_level) || (old_dun_level < dun_level)) && !branch) { if (old_dun_level < dun_level) { place_up_stairs(p_ptr->py , p_ptr->px); - if (dungeon_flags1 & DF1_FLAT) + if (dungeon_flags & DF_FLAT) { cave_set_feat(p_ptr->py, p_ptr->px, FEAT_WAY_LESS); } @@ -753,7 +754,7 @@ bool_ new_player_spot(int branch) else { place_down_stairs(p_ptr->py , p_ptr->px); - if (dungeon_flags1 & DF1_FLAT) + if (dungeon_flags & DF_FLAT) { cave_set_feat(p_ptr->py, p_ptr->px, FEAT_WAY_MORE); } @@ -1024,7 +1025,7 @@ static void alloc_stairs(int feat, int num, int walls, int branch) /* Try several times, then decrease "walls" */ for (j = 0; j <= SAFE_MAX_ATTEMPTS; j++) { - if (dungeon_flags1 & DF1_FLAT) + if (dungeon_flags & DF_FLAT) { place_new_way(&y, &x); } @@ -1045,11 +1046,11 @@ static void alloc_stairs(int feat, int num, int walls, int branch) if (!dun_level) { /* Clear previous contents, add down stairs */ - if (dungeon_flags1 & DF1_FLAT) + if (dungeon_flags & DF_FLAT) { cave_set_feat(y, x, FEAT_WAY_MORE); } - else if ((rand_int(3) == 0) && (!(dungeon_flags2 & DF2_NO_SHAFT))) + else if ((rand_int(3) == 0) && (!(dungeon_flags & DF_NO_SHAFT))) { cave_set_feat(y, x, FEAT_SHAFT_DOWN); } @@ -1062,14 +1063,14 @@ static void alloc_stairs(int feat, int num, int walls, int branch) /* Quest -- must go up */ else if ((is_quest(dun_level) && (dun_level >= 1)) || ((dun_level >= d_info[dungeon_type].maxdepth) && - (!(dungeon_flags1 & DF1_FORCE_DOWN)))) + (!(dungeon_flags & DF_FORCE_DOWN)))) { /* Clear previous contents, add up stairs */ - if (dungeon_flags1 & DF1_FLAT) + if (dungeon_flags & DF_FLAT) { cave_set_feat(y, x, FEAT_WAY_LESS); } - else if ((rand_int(3) == 0) && (!(dungeon_flags2 & DF2_NO_SHAFT))) + else if ((rand_int(3) == 0) && (!(dungeon_flags & DF_NO_SHAFT))) { cave_set_feat(y, x, FEAT_SHAFT_UP); } @@ -1726,7 +1727,7 @@ static void check_room_boundary(int x1, int y1, int x2, int y2) bool_ old_is_floor, new_is_floor; /* Avoid doing this in irrelevant places -- pelpel */ - if (!(dungeon_flags1 & DF1_CAVERN)) return; + if (!(dungeon_flags & DF_CAVERN)) return; /* Initialize */ count = 0; @@ -6359,7 +6360,7 @@ static void build_tunnel(int row1, int col1, int row2, int col2, bool_ water) place_floor(y, x); /* Occasional doorway */ - if (!(dungeon_flags1 & DF1_NO_DOORS) && + if (!(dungeon_flags & DF_NO_DOORS) && (rand_int(100) < DUN_TUN_PEN)) { /* Place a random door */ @@ -6463,7 +6464,7 @@ static void try_doors(int y, int x) /* if (!in_bounds(y, x)) return; */ /* Some dungeons don't have doors at all */ - if (dungeon_flags1 & (DF1_NO_DOORS)) return; + if (dungeon_flags & DF_NO_DOORS) return; /* Reset tally */ n = 0; @@ -6703,7 +6704,7 @@ bool_ level_generate_dungeon() } /* Check for arena level */ - if ((dungeon_flags1 & (DF1_EMPTY)) || + if ((dungeon_flags & DF_EMPTY) || (empty_levels && (rand_int(EMPTY_LEVEL) == 0))) { empty_level = TRUE; @@ -6718,7 +6719,7 @@ bool_ level_generate_dungeon() } /* Possible cavern */ - if ((dungeon_flags1 & DF1_CAVERN) && (rand_int(dun_level / 2) > DUN_CAVERN)) + if ((dungeon_flags & DF_CAVERN) && (rand_int(dun_level / 2) > DUN_CAVERN)) { cavern = TRUE; @@ -6744,7 +6745,7 @@ bool_ level_generate_dungeon() if ((cur_wid != MAX_WID) || (cur_hgt != MAX_HGT)) destroyed = FALSE; /* Hack -- No destroyed levels */ - if (dungeon_flags1 & DF1_NO_DESTROY) destroyed = FALSE; + if (dungeon_flags & DF_NO_DESTROY) destroyed = FALSE; /* Actual maximum number of rooms on this level */ dun->row_rooms = cur_hgt / BLOCK_HGT; @@ -6819,7 +6820,7 @@ bool_ level_generate_dungeon() else { /* Attempt a "trivial" room */ - if ((dungeon_flags1 & DF1_CIRCULAR_ROOMS) && + if ((dungeon_flags & DF_CIRCULAR_ROOMS) && room_build(y, x, 9)) { continue; @@ -6894,7 +6895,7 @@ bool_ level_generate_dungeon() /* Hack - build standard rectangular rooms if needed */ if (k < 90) { - if ((dungeon_flags1 & DF1_CIRCULAR_ROOMS) && room_build(y, x, 1)) continue; + if ((dungeon_flags & DF_CIRCULAR_ROOMS) && room_build(y, x, 1)) continue; else if (room_build(y, x, 9)) continue; } @@ -6903,13 +6904,13 @@ bool_ level_generate_dungeon() } /* Attempt a trivial room */ - if (dungeon_flags1 & DF1_CAVE) + if (dungeon_flags & DF_CAVE) { if (room_build(y, x, 10)) continue; } else { - if ((dungeon_flags1 & DF1_CIRCULAR_ROOMS) && room_build(y, x, 9)) continue; + if ((dungeon_flags & DF_CIRCULAR_ROOMS) && room_build(y, x, 9)) continue; else if (room_build(y, x, 1)) continue; } } @@ -6993,7 +6994,7 @@ bool_ level_generate_dungeon() } /* Add some sand streamers */ - if ((dungeon_flags1 & DF1_SAND_VEIN) && !rand_int(4)) + if ((dungeon_flags & DF_SAND_VEIN) && !rand_int(4)) { if ((cheat_room) || (p_ptr->precognition)) msg_print("Sand vein."); build_streamer(FEAT_SANDWALL, DUN_STR_SC); @@ -7009,18 +7010,18 @@ bool_ level_generate_dungeon() } /* Hack -- Add some rivers if requested */ - if ((dungeon_flags1 & DF1_WATER_RIVER) && !rand_int(4)) + if ((dungeon_flags & DF_WATER_RIVER) && !rand_int(4)) { if (cheat_room || p_ptr->precognition) msg_print("River of water."); add_river(FEAT_DEEP_WATER, FEAT_SHAL_WATER); } - if ((dungeon_flags1 & DF1_LAVA_RIVER) && !rand_int(4)) + if ((dungeon_flags & DF_LAVA_RIVER) && !rand_int(4)) { if ((cheat_room) || (p_ptr->precognition)) msg_print("River of lava."); add_river(FEAT_DEEP_LAVA, FEAT_SHAL_LAVA); } - if (dungeon_flags1 & DF1_WATER_RIVERS) + if (dungeon_flags & DF_WATER_RIVERS) { int max = 3 + rand_int(2); bool_ said = FALSE; @@ -7036,7 +7037,7 @@ bool_ level_generate_dungeon() } } - if (dungeon_flags1 & DF1_LAVA_RIVERS) + if (dungeon_flags & DF_LAVA_RIVERS) { int max = 2 + rand_int(2); bool_ said = FALSE; @@ -7053,7 +7054,7 @@ bool_ level_generate_dungeon() } /* Add streamers of trees, water, or lava -KMW- */ - if (!(dungeon_flags1 & DF1_NO_STREAMERS)) + if (!(dungeon_flags & DF_NO_STREAMERS)) { int num; @@ -7062,7 +7063,7 @@ bool_ level_generate_dungeon() * * Small trees (penetrate walls) */ - if ((dungeon_flags1 & DF1_FLAT) && (randint(20) > 15)) + if ((dungeon_flags & DF_FLAT) && (randint(20) > 15)) { num = randint(DUN_STR_QUA); @@ -7599,7 +7600,7 @@ static bool_ cave_gen(void) * width/height, generate the dungeon normally, then double it * in both directions */ - if (dungeon_flags1 & DF1_DOUBLE) + if (dungeon_flags & DF_DOUBLE) { cur_wid /= 2; cur_hgt /= 2; @@ -7662,22 +7663,22 @@ static bool_ cave_gen(void) alloc_stairs(FEAT_LESS, 5, 3, branch); } - if ((dun_level < d_ptr->maxdepth) || ((dun_level == d_ptr->maxdepth) && (dungeon_flags1 & DF1_FORCE_DOWN))) + if ((dun_level < d_ptr->maxdepth) || ((dun_level == d_ptr->maxdepth) && (dungeon_flags & DF_FORCE_DOWN))) { /* Place 3 or 4 down stairs near some walls */ - alloc_stairs((dungeon_flags1 & DF1_FLAT) ? FEAT_WAY_MORE : FEAT_MORE, rand_range(3, 4), 3, 0); + alloc_stairs((dungeon_flags & DF_FLAT) ? FEAT_WAY_MORE : FEAT_MORE, rand_range(3, 4), 3, 0); /* Place 0 or 1 down shafts near some walls */ - if (!(dungeon_flags2 & DF2_NO_SHAFT)) alloc_stairs((dungeon_flags1 & DF1_FLAT) ? FEAT_WAY_MORE : FEAT_SHAFT_DOWN, rand_range(0, 1), 3, 0); + if (!(dungeon_flags & DF_NO_SHAFT)) alloc_stairs((dungeon_flags & DF_FLAT) ? FEAT_WAY_MORE : FEAT_SHAFT_DOWN, rand_range(0, 1), 3, 0); } - if ((dun_level > d_ptr->mindepth) || ((dun_level == d_ptr->mindepth) && (!(dungeon_flags1 & DF1_NO_UP)))) + if ((dun_level > d_ptr->mindepth) || ((dun_level == d_ptr->mindepth) && (!(dungeon_flags & DF_NO_UP)))) { /* Place 1 or 2 up stairs near some walls */ - alloc_stairs((dungeon_flags1 & DF1_FLAT) ? FEAT_WAY_LESS : FEAT_LESS, rand_range(1, 2), 3, 0); + alloc_stairs((dungeon_flags & DF_FLAT) ? FEAT_WAY_LESS : FEAT_LESS, rand_range(1, 2), 3, 0); /* Place 0 or 1 up shafts near some walls */ - if (!(dungeon_flags2 & DF2_NO_SHAFT)) alloc_stairs((dungeon_flags1 & DF1_FLAT) ? FEAT_WAY_LESS : FEAT_SHAFT_UP, rand_range(0, 1), 3, 0); + if (!(dungeon_flags & DF_NO_SHAFT)) alloc_stairs((dungeon_flags & DF_FLAT) ? FEAT_WAY_LESS : FEAT_SHAFT_UP, rand_range(0, 1), 3, 0); } } @@ -8051,7 +8052,7 @@ static bool_ cave_gen(void) wiz_lite(); /* Now double the generated dungeon */ - if (dungeon_flags1 & DF1_DOUBLE) + if (dungeon_flags & DF_DOUBLE) { /* * We begin at the bottom-right corner and move upwards @@ -8266,13 +8267,11 @@ void generate_cave(void) /* Initialize the flags with the basic dungeon flags */ if (!dun_level) { - dungeon_flags1 = d_info[DUNGEON_WILDERNESS].flags1; - dungeon_flags2 = d_info[DUNGEON_WILDERNESS].flags2; + dungeon_flags = d_info[DUNGEON_WILDERNESS].flags; } else { - dungeon_flags1 = d_ptr->flags1; - dungeon_flags2 = d_ptr->flags2; + dungeon_flags = d_ptr->flags; } /* Is it a town level ? */ @@ -8462,8 +8461,8 @@ void generate_cave(void) } } /* Very small (1 x 1 panel) level */ - else if (!(dungeon_flags1 & DF1_BIG) && - (dungeon_flags1 & DF1_SMALLEST)) + else if (!(dungeon_flags & DF_BIG) && + (dungeon_flags & DF_SMALLEST)) { if (cheat_room || p_ptr->precognition) { @@ -8488,9 +8487,9 @@ void generate_cave(void) } /* Small level */ - else if (!(dungeon_flags1 & DF1_BIG) && + else if (!(dungeon_flags & DF_BIG) && (always_small_level || - (dungeon_flags1 & DF1_SMALL) || + (dungeon_flags & DF_SMALL) || (small_levels && rand_int(SMALL_LEVEL) == 0))) { if (cheat_room || p_ptr->precognition) diff --git a/src/init1.cc b/src/init1.cc index 03966464..7ff179fb 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -5,6 +5,7 @@ #include "cave.hpp" #include "cave_type.hpp" #include "dungeon_info_type.hpp" +#include "dungeon_flag.hpp" #include "ego_item_type.hpp" #include "feature_type.hpp" #include "files.hpp" @@ -856,81 +857,6 @@ static cptr f_info_flags1[] = }; /* - * Dungeon flags - */ -static cptr d_info_flags1[] = -{ - "PRINCIPAL", - "MAZE", - "SMALLEST", - "SMALL", - "BIG", - "NO_DOORS", - "WATER_RIVER", - "LAVA_RIVER", - "WATER_RIVERS", - "LAVA_RIVERS", - "CAVE", - "CAVERN", - "NO_UP", - "HOT", - "COLD", - "FORCE_DOWN", - "FORGET", - "NO_DESTROY", - "SAND_VEIN", - "CIRCULAR_ROOMS", - "EMPTY", - "DAMAGE_FEAT", - "FLAT", - "TOWER", - "RANDOM_TOWNS", - "DOUBLE", - "LIFE_LEVEL", - "EVOLVE", - "ADJUST_LEVEL_1", - "ADJUST_LEVEL_2", - "NO_RECALL", - "NO_STREAMERS" -}; - -static cptr d_info_flags2[] = -{ - "ADJUST_LEVEL_1_2", - "NO_SHAFT", - "ADJUST_LEVEL_PLAYER", - "NO_TELEPORT", - "ASK_LEAVE", - "NO_STAIR", - "SPECIAL", - "NO_NEW_MONSTER", - "DESC", - "NO_GENO", - "NO_BREATH", - "WATER_BREATH", - "ELVEN", - "DWARVEN", - "NO_EASY_MOVE", - "NO_RECALL_OUT", - "DESC_ALWAYS", - "XXX1", - "XXX1", - "XXX1", - "XXX1", - "XXX1", - "XXX1", - "XXX1", - "XXX1", - "XXX1", - "XXX1", - "XXX1", - "XXX1", - "XXX1", - "XXX1", - "XXX1" -}; - -/* * Trap flags */ static cptr t_info_flags[] = @@ -6585,20 +6511,15 @@ errr init_t_info_txt(FILE *fp) return (0); } -/* - * Grab one flag for a dungeon type from a textual string - */ -errr grab_one_dungeon_flag(u32b *f1, u32b *f2, cptr what) +errr grab_one_dungeon_flag(dungeon_flag_set *flags, const char *str) { - if (lookup_flags(what, - flag_tie(f1, d_info_flags1), - flag_tie(f2, d_info_flags2))) - { - return (0); - } +#define DF(tier, index, name) \ + if (streq(str, #name)) { *flags |= DF_##name; return 0; } +#include "dungeon_flag_list.hpp" +#undef DF /* Oops */ - msg_format("Unknown dungeon type flag '%s'.", what); + msg_format("Unknown dungeon type flag '%s'.", str); /* Failure */ return (1); @@ -7013,7 +6934,7 @@ errr init_d_info_txt(FILE *fp) /* Parse this entry */ else { - if (0 != grab_one_dungeon_flag(&(d_ptr->flags1), &(d_ptr->flags2), s)) + if (0 != grab_one_dungeon_flag(&d_ptr->flags, s)) { return (5); } @@ -8044,7 +7965,7 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst } /* Parse this entry */ - if (0 != grab_one_dungeon_flag(&dungeon_flags1, &dungeon_flags2, s)) return 1; + if (0 != grab_one_dungeon_flag(&dungeon_flags, s)) return 1; /* Start the next entry */ s = t; diff --git a/src/init1.hpp b/src/init1.hpp index 766e467d..3f0198a7 100644 --- a/src/init1.hpp +++ b/src/init1.hpp @@ -1,6 +1,7 @@ #pragma once #include "h-basic.h" +#include "dungeon_flag_set.hpp" extern int color_char_to_attr(char c); extern byte conv_color[16]; @@ -22,5 +23,5 @@ extern errr init_ba_info_txt(FILE *fp); extern errr init_st_info_txt(FILE *fp); extern errr init_ow_info_txt(FILE *fp); extern errr init_wf_info_txt(FILE *fp); -extern errr grab_one_dungeon_flag(u32b *flags1, u32b *flags2, cptr what); +extern errr grab_one_dungeon_flag(dungeon_flag_set *flags, const char *str); extern errr process_dungeon_file(cptr name, int *yval, int *xval, int ymax, int xmax, bool_ init, bool_ full); diff --git a/src/levels.cc b/src/levels.cc index ac3aa3d3..726ebd1a 100644 --- a/src/levels.cc +++ b/src/levels.cc @@ -213,7 +213,7 @@ void get_level_flags() } /* Parse this entry */ - if (0 != grab_one_dungeon_flag(&dungeon_flags1, &dungeon_flags2, s)) return; + if (0 != grab_one_dungeon_flag(&dungeon_flags, s)) return; /* Start the next entry */ s = t; diff --git a/src/loadsave.cc b/src/loadsave.cc index d358e271..6b3ad713 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -1311,8 +1311,6 @@ static void my_sentinel(const char *place, u16b value, ls_flag_t flag) */ static bool_ do_dungeon(ls_flag_t flag, bool_ no_companions) { - int i; - cave_type *c_ptr; /* Read specific */ @@ -1331,8 +1329,10 @@ static bool_ do_dungeon(ls_flag_t flag, bool_ no_companions) do_s16b(&max_panel_rows, flag); do_s16b(&max_panel_cols, flag); - do_u32b(&dungeon_flags1, flag); - do_u32b(&dungeon_flags2, flag); + for (std::size_t i = 0; i < dungeon_flags.size(); i++) + { + do_u32b(&dungeon_flags[i], flag); + } /* Last teleportation */ do_s16b(&last_teleportation_y, flag); @@ -1347,7 +1347,7 @@ static bool_ do_dungeon(ls_flag_t flag, bool_ no_companions) quit("Too many spell effects"); } - for (i = 0; i < tmp16b; ++i) + for (std::size_t i = 0; i < tmp16b; ++i) { do_s16b(&effects[i].type, flag); do_s16b(&effects[i].dam, flag); @@ -1359,7 +1359,7 @@ static bool_ do_dungeon(ls_flag_t flag, bool_ no_companions) } /* TO prevent bugs with evolving dungeons */ - for (i = 0; i < 100; i++) + for (std::size_t i = 0; i < 100; i++) { do_s16b(&floor_type[i], flag); do_s16b(&fill_type[i], flag); @@ -1393,7 +1393,7 @@ static bool_ do_dungeon(ls_flag_t flag, bool_ no_companions) if (no_companions) { - for (i = 1; i < o_max; i++) + for (int i = 1; i < o_max; i++) { object_type *o_ptr = &o_list[i]; @@ -1418,7 +1418,7 @@ static bool_ do_dungeon(ls_flag_t flag, bool_ no_companions) } /* Dungeon items */ - for (i = 1; i < tmp16b; i++) + for (int i = 1; i < tmp16b; i++) { int o_idx; @@ -1481,7 +1481,7 @@ static bool_ do_dungeon(ls_flag_t flag, bool_ no_companions) if (no_companions) { - for (i = 1; i < m_max; i++) + for (int i = 1; i < m_max; i++) { monster_type *m_ptr = &m_list[i]; @@ -1506,7 +1506,7 @@ static bool_ do_dungeon(ls_flag_t flag, bool_ no_companions) } /* Read the monsters */ - for (i = 1; i < tmp16b; i++) + for (int i = 1; i < tmp16b; i++) { int m_idx; monster_type *m_ptr; @@ -1569,7 +1569,7 @@ static bool_ do_dungeon(ls_flag_t flag, bool_ no_companions) note(format("Too many (%d) monster entries!", tmp16b)); return (FALSE); } - for (i = 1; i < tmp16b; i++) + for (std::size_t i = 1; i < tmp16b; i++) { monster_type *m_ptr; diff --git a/src/melee2.cc b/src/melee2.cc index 5a643132..e4f0802a 100644 --- a/src/melee2.cc +++ b/src/melee2.cc @@ -16,6 +16,7 @@ #include "cave.hpp" #include "cave_type.hpp" #include "cmd1.hpp" +#include "dungeon_flag.hpp" #include "feature_type.hpp" #include "files.hpp" #include "hook_mon_speak_in.hpp" @@ -2259,7 +2260,7 @@ static bool_ monst_spell_monst(int m_idx) /* RF6_TPORT */ case 160 + 5: { - if (dungeon_flags2 & DF2_NO_TELEPORT) break; /* No teleport on special levels */ + if (dungeon_flags & DF_NO_TELEPORT) break; /* No teleport on special levels */ else { if (disturb_other) disturb(1); @@ -2279,7 +2280,7 @@ static bool_ monst_spell_monst(int m_idx) /* RF6_TELE_AWAY */ case 160 + 7: { - if (dungeon_flags2 & DF2_NO_TELEPORT) break; + if (dungeon_flags & DF_NO_TELEPORT) break; if (!direct) break; else diff --git a/src/monster2.cc b/src/monster2.cc index 4649f446..e166950f 100644 --- a/src/monster2.cc +++ b/src/monster2.cc @@ -11,6 +11,7 @@ #include "artifact_type.hpp" #include "cave.hpp" #include "cave_type.hpp" +#include "dungeon_flag.hpp" #include "dungeon_info_type.hpp" #include "files.hpp" #include "hook_new_monster_in.hpp" @@ -215,7 +216,7 @@ static int pick_ego_monster(monster_race const *r_ptr) int tries = max_re_idx + 10; monster_ego *re_ptr; - if ((!(dungeon_flags2 & DF2_ELVEN)) && (!(dungeon_flags2 & DF2_DWARVEN))) + if ((!(dungeon_flags & DF_ELVEN)) && (!(dungeon_flags & DF_DWARVEN))) { /* No townspeople ego */ if (!r_ptr->level) return 0; @@ -250,9 +251,9 @@ static int pick_ego_monster(monster_race const *r_ptr) /* Bypass restrictions for themed townspeople */ else { - if (dungeon_flags2 & DF2_ELVEN) + if (dungeon_flags & DF_ELVEN) ego = test_mego_name("Elven"); - else if (dungeon_flags2 & DF2_DWARVEN) + else if (dungeon_flags & DF_DWARVEN) ego = test_mego_name("Dwarven"); if (mego_ok(r_ptr, ego)) @@ -2548,18 +2549,18 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) } - if (dungeon_flags2 & DF2_ADJUST_LEVEL_1_2) + if (dungeon_flags & DF_ADJUST_LEVEL_1_2) { min_level = max_level = dun_level / 2; add_level = TRUE; } - if (dungeon_flags1 & DF1_ADJUST_LEVEL_1) + if (dungeon_flags & DF_ADJUST_LEVEL_1) { if (!min_level) min_level = dun_level; max_level = dun_level; add_level = TRUE; } - if (dungeon_flags1 & DF1_ADJUST_LEVEL_2) + if (dungeon_flags & DF_ADJUST_LEVEL_2) { if (!min_level) min_level = dun_level * 2; max_level = dun_level * 2; diff --git a/src/powers.cc b/src/powers.cc index a7db2968..632fb338 100644 --- a/src/powers.cc +++ b/src/powers.cc @@ -13,6 +13,7 @@ #include "cmd1.hpp" #include "cmd2.hpp" #include "cmd7.hpp" +#include "dungeon_flag.hpp" #include "feature_type.hpp" #include "files.hpp" #include "hooks.hpp" @@ -390,7 +391,7 @@ static void power_activate(int power) } if (amber_power == 2) { - if (dungeon_flags2 & DF2_NO_TELEPORT) + if (dungeon_flags & DF_NO_TELEPORT) { msg_print("No teleport on special levels ..."); break; @@ -417,7 +418,7 @@ static void power_activate(int power) } if (amber_power == 3) { - if (dungeon_flags2 & DF2_NO_TELEPORT) + if (dungeon_flags & DF_NO_TELEPORT) { msg_print("No recall on special levels.."); break; @@ -978,7 +979,7 @@ static void power_activate(int power) case PWR_RECALL: { - if (!(dungeon_flags2 & DF2_ASK_LEAVE) || ((dungeon_flags2 & DF2_ASK_LEAVE) && !get_check("Leave this unique level forever? "))) + if (!(dungeon_flags & DF_ASK_LEAVE) || ((dungeon_flags & DF_ASK_LEAVE) && !get_check("Leave this unique level forever? "))) { recall_player(21, 15); } diff --git a/src/q_betwen.cc b/src/q_betwen.cc index 2bebe452..541be9f9 100644 --- a/src/q_betwen.cc +++ b/src/q_betwen.cc @@ -1,6 +1,7 @@ #include "q_betwen.hpp" #include "cave.hpp" +#include "dungeon_flag.hpp" #include "cave_type.hpp" #include "hook_chardump_in.hpp" #include "hook_init_quest_in.hpp" @@ -96,7 +97,7 @@ static bool_ quest_between_gen_hook(void *, void *, void *) /* Otherwise instadeath */ energy_use = 0; - dungeon_flags2 |= DF2_NO_GENO; + dungeon_flags |= DF_NO_GENO; return TRUE; } diff --git a/src/q_dragons.cc b/src/q_dragons.cc index 6c6084d1..45666e77 100644 --- a/src/q_dragons.cc +++ b/src/q_dragons.cc @@ -2,6 +2,7 @@ #include "cave.hpp" #include "cave_type.hpp" +#include "dungeon_flag.hpp" #include "feature_type.hpp" #include "hook_quest_finish_in.hpp" #include "hooks.hpp" @@ -47,7 +48,7 @@ static bool_ quest_dragons_gen_hook(void *, void *, void *) init_flags = INIT_CREATE_DUNGEON; process_dungeon_file("dragons.map", &ystart, &xstart, cur_hgt, cur_wid, TRUE, FALSE); - dungeon_flags2 |= DF2_NO_GENO; + dungeon_flags |= DF_NO_GENO; /* Place some columns */ for (i = 35; i > 0; ) diff --git a/src/q_evil.cc b/src/q_evil.cc index 3bc953cd..5e93bdf1 100644 --- a/src/q_evil.cc +++ b/src/q_evil.cc @@ -2,6 +2,7 @@ #include "cave.hpp" #include "cave_type.hpp" +#include "dungeon_flag.hpp" #include "feature_type.hpp" #include "hook_quest_finish_in.hpp" #include "hooks.hpp" @@ -47,7 +48,7 @@ static bool_ quest_evil_gen_hook(void *, void *, void *) init_flags = INIT_CREATE_DUNGEON; process_dungeon_file("evil.map", &ystart, &xstart, cur_hgt, cur_wid, TRUE, FALSE); - dungeon_flags2 |= DF2_NO_GENO; + dungeon_flags |= DF_NO_GENO; /* Place some random balrogs */ for (i = 6; i > 0; ) diff --git a/src/q_fireprof.cc b/src/q_fireprof.cc index 0942a71c..1e75b1b1 100644 --- a/src/q_fireprof.cc +++ b/src/q_fireprof.cc @@ -1,6 +1,7 @@ #include "q_fireprof.hpp" #include "cave_type.hpp" +#include "dungeon_flag.hpp" #include "feature_type.hpp" #include "hook_get_in.hpp" #include "hooks.hpp" @@ -488,7 +489,7 @@ static bool_ fireproof_gen_hook(void *, void *, void *) } /* no teleport */ - dungeon_flags2 = DF2_NO_TELEPORT; + dungeon_flags = DF_NO_TELEPORT; /* determine type of item */ fireproof_set_sval(randint(settings->sval_max)); diff --git a/src/q_god.cc b/src/q_god.cc index 79213146..3714e457 100644 --- a/src/q_god.cc +++ b/src/q_god.cc @@ -1,6 +1,7 @@ #include "q_god.hpp" #include "cave_type.hpp" +#include "dungeon_flag.hpp" #include "dungeon_info_type.hpp" #include "feature_type.hpp" #include "hook_chardump_in.hpp" @@ -450,13 +451,17 @@ static void quest_god_set_god_dungeon_attributes_eru() /* F: A large pillar, with stairs created at edges. (You can't * climb a rock through the middle, can you?) */ - d_info[DUNGEON_GOD].flags1 = - DF1_BIG | DF1_NO_DOORS | DF1_CIRCULAR_ROOMS | - DF1_EMPTY | DF1_TOWER | DF1_FLAT | DF1_ADJUST_LEVEL_2; - d_info[DUNGEON_GOD].flags2 = - DF2_ADJUST_LEVEL_1_2 | - DF2_NO_SHAFT | - DF2_ADJUST_LEVEL_PLAYER; + d_info[DUNGEON_GOD].flags = + DF_BIG | + DF_NO_DOORS | + DF_CIRCULAR_ROOMS | + DF_EMPTY | + DF_TOWER | + DF_FLAT | + DF_ADJUST_LEVEL_2 | + DF_ADJUST_LEVEL_1_2 | + DF_NO_SHAFT | + DF_ADJUST_LEVEL_PLAYER; /* R: */ d_info[DUNGEON_GOD].rules[0].mode = 3; @@ -505,11 +510,13 @@ static void quest_god_set_god_dungeon_attributes_manwe() /* F: It's open, goes up like a tower, give it a few * interesting rooms, make the monsters hard(ish). */ - d_info[DUNGEON_GOD].flags1 = - DF1_NO_DOORS | DF1_TOWER | - DF1_CAVERN | DF1_ADJUST_LEVEL_2; - d_info[DUNGEON_GOD].flags2 = - DF2_NO_SHAFT | DF2_ADJUST_LEVEL_PLAYER; + d_info[DUNGEON_GOD].flags = + DF_NO_DOORS | + DF_TOWER | + DF_CAVERN | + DF_ADJUST_LEVEL_2 | + DF_NO_SHAFT | + DF_ADJUST_LEVEL_PLAYER; /* R: */ d_info[DUNGEON_GOD].rules[0].mode = 3; @@ -564,8 +571,10 @@ static void quest_god_set_god_dungeon_attributes_tulkas() d_info[DUNGEON_GOD].objs.tools = 15; /* F: fairly standard */ - d_info[DUNGEON_GOD].flags1 = DF1_NO_DESTROY | DF1_ADJUST_LEVEL_2; - d_info[DUNGEON_GOD].flags2 = DF2_ADJUST_LEVEL_PLAYER; + d_info[DUNGEON_GOD].flags = + DF_NO_DESTROY | + DF_ADJUST_LEVEL_2 | + DF_ADJUST_LEVEL_PLAYER; /* R: */ d_info[DUNGEON_GOD].rules[0].mode = 3; @@ -609,8 +618,12 @@ static void quest_god_set_god_dungeon_attributes_melkor() d_info[DUNGEON_GOD].objs.tools = 25; /* F: Small, lava rivers, nasty monsters hehehehehe */ - d_info[DUNGEON_GOD].flags1 = DF1_SMALL | DF1_LAVA_RIVERS | DF1_ADJUST_LEVEL_1; - d_info[DUNGEON_GOD].flags2 = DF2_ADJUST_LEVEL_1_2 | DF2_ADJUST_LEVEL_PLAYER; + d_info[DUNGEON_GOD].flags = + DF_SMALL | + DF_LAVA_RIVERS | + DF_ADJUST_LEVEL_1 | + DF_ADJUST_LEVEL_1_2 | + DF_ADJUST_LEVEL_PLAYER; /* R: No restrictions on monsters here */ d_info[DUNGEON_GOD].rules[0].mode = 0; @@ -655,13 +668,16 @@ static void quest_god_set_god_dungeon_attributes_yavanna() d_info[DUNGEON_GOD].objs.tools = 40; /* F: Natural looking */ - d_info[DUNGEON_GOD].flags1 = - DF1_NO_DOORS | DF1_WATER_RIVERS | - DF1_NO_DESTROY | DF1_ADJUST_LEVEL_1 | - DF1_NO_RECALL; - d_info[DUNGEON_GOD].flags2 = - DF2_ADJUST_LEVEL_1_2 | DF2_NO_SHAFT | - DF2_NO_GENO | DF2_ADJUST_LEVEL_PLAYER; + d_info[DUNGEON_GOD].flags = + DF_NO_DOORS | + DF_WATER_RIVERS | + DF_NO_DESTROY | + DF_ADJUST_LEVEL_1 | + DF_NO_RECALL | + DF_ADJUST_LEVEL_1_2 | + DF_NO_SHAFT | + DF_NO_GENO | + DF_ADJUST_LEVEL_PLAYER; /* R: Demons, Undead, non-living */ d_info[DUNGEON_GOD].rules[0].mode = 3; @@ -703,9 +719,11 @@ static void quest_god_set_god_dungeon_attributes_aule() /* F: Small, no destroyed levels, min monster level = dungeon * level */ - d_info[DUNGEON_GOD].flags1 = - DF1_SMALL | DF1_NO_DESTROY | - DF1_ADJUST_LEVEL_1 | DF1_NO_STREAMERS; + d_info[DUNGEON_GOD].flags = + DF_SMALL | + DF_NO_DESTROY | + DF_ADJUST_LEVEL_1 | + DF_NO_STREAMERS; /* R: No restrictions on monsters here */ d_info[DUNGEON_GOD].rules[0].mode = 0; @@ -743,11 +761,13 @@ static void quest_god_set_god_dungeon_attributes_varda() /* F: It's open, goes up like a tower, give it a few * interesting rooms, make the monsters hard(ish). */ - d_info[DUNGEON_GOD].flags1 = - DF1_NO_DOORS | DF1_TOWER | - DF1_CAVERN | DF1_ADJUST_LEVEL_1; - d_info[DUNGEON_GOD].flags2 = - DF2_NO_SHAFT | DF2_ADJUST_LEVEL_PLAYER; + d_info[DUNGEON_GOD].flags = + DF_NO_DOORS | + DF_TOWER | + DF_CAVERN | + DF_ADJUST_LEVEL_1 | + DF_NO_SHAFT | + DF_ADJUST_LEVEL_PLAYER; /* R: */ d_info[DUNGEON_GOD].rules[0].mode = 3; @@ -795,8 +815,10 @@ static void quest_god_set_god_dungeon_attributes_ulmo() d_info[DUNGEON_GOD].objs.tools = 5; /* F: fairly standard */ - d_info[DUNGEON_GOD].flags1 = DF1_NO_DESTROY | DF1_ADJUST_LEVEL_2; - d_info[DUNGEON_GOD].flags2 = DF2_ADJUST_LEVEL_PLAYER; + d_info[DUNGEON_GOD].flags = + DF_NO_DESTROY | + DF_ADJUST_LEVEL_2 | + DF_ADJUST_LEVEL_PLAYER; /* R: */ d_info[DUNGEON_GOD].rules[0].mode = 3; @@ -838,8 +860,10 @@ static void quest_god_set_god_dungeon_attributes_mandos() d_info[DUNGEON_GOD].objs.tools = 15; /* F: fairly standard */ - d_info[DUNGEON_GOD].flags1 = DF1_NO_DESTROY | DF1_ADJUST_LEVEL_2; - d_info[DUNGEON_GOD].flags2 = DF2_ADJUST_LEVEL_PLAYER; + d_info[DUNGEON_GOD].flags = + DF_NO_DESTROY | + DF_ADJUST_LEVEL_2 | + DF_ADJUST_LEVEL_PLAYER; /* R: */ d_info[DUNGEON_GOD].rules[0].mode = 3; diff --git a/src/q_haunted.cc b/src/q_haunted.cc index 57daa40e..5295945d 100644 --- a/src/q_haunted.cc +++ b/src/q_haunted.cc @@ -2,6 +2,7 @@ #include "cave.hpp" #include "cave_type.hpp" +#include "dungeon_flag.hpp" #include "feature_type.hpp" #include "hook_quest_finish_in.hpp" #include "hooks.hpp" @@ -48,7 +49,7 @@ static bool_ quest_haunted_gen_hook(void *, void *, void *) init_flags = INIT_CREATE_DUNGEON; process_dungeon_file("haunted.map", &ystart, &xstart, cur_hgt, cur_wid, TRUE, FALSE); - dungeon_flags2 |= DF2_NO_GENO; + dungeon_flags |= DF_NO_GENO; /* Place some ghosts */ for (i = 12; i > 0; ) diff --git a/src/q_library.cc b/src/q_library.cc index 48c9d0cf..47246f60 100644 --- a/src/q_library.cc +++ b/src/q_library.cc @@ -1,6 +1,7 @@ #include "q_library.hpp" #include "cave_type.hpp" +#include "dungeon_flag.hpp" #include "hooks.hpp" #include "lua_bind.hpp" #include "monster2.hpp" @@ -324,7 +325,7 @@ static bool_ quest_library_gen_hook(void *, void *, void *) int y = 2; int x = 2; load_map("library.map", &y, &x); - dungeon_flags2 = DF2_NO_GENO; + dungeon_flags = DF_NO_GENO; } /* Generate monsters */ diff --git a/src/q_rand.cc b/src/q_rand.cc index 8fb49b34..c5d2adac 100644 --- a/src/q_rand.cc +++ b/src/q_rand.cc @@ -3,6 +3,7 @@ #include "artifact_type.hpp" #include "cave.hpp" #include "cave_type.hpp" +#include "dungeon_flag.hpp" #include "dungeon_info_type.hpp" #include "generate.hpp" #include "hook_build_room1_in.hpp" @@ -84,7 +85,7 @@ void initialize_random_quests(int n) { dungeon_info_type *d_ptr = &d_info[j]; - if (!(d_ptr->flags1 & DF1_PRINCIPAL)) continue; + if (!(d_ptr->flags & DF_PRINCIPAL)) continue; if ((d_ptr->mindepth <= rl) && (rl <= d_ptr->maxdepth)) { @@ -408,7 +409,7 @@ static bool_ quest_random_death_hook(void *, void *in_, void *) s32b m_idx = in->m_idx; int r_idx = m_list[m_idx].r_idx; - if (!(dungeon_flags1 & DF1_PRINCIPAL)) return (FALSE); + if (!(dungeon_flags & DF_PRINCIPAL)) return (FALSE); if ((dun_level < 1) || (dun_level >= MAX_RANDOM_QUEST)) return (FALSE); if (!random_quests[dun_level].type) return (FALSE); if (random_quests[dun_level].done) return (FALSE); @@ -439,7 +440,7 @@ static bool_ quest_random_turn_hook(void *, void *, void *) static bool_ quest_random_feeling_hook(void *, void *, void *) { - if (!(dungeon_flags1 & DF1_PRINCIPAL)) return (FALSE); + if (!(dungeon_flags & DF_PRINCIPAL)) return (FALSE); if ((dun_level < 1) || (dun_level >= MAX_RANDOM_QUEST)) return (FALSE); if (!random_quests[dun_level].type) return (FALSE); if (random_quests[dun_level].done) return (FALSE); @@ -460,7 +461,7 @@ static bool_ quest_random_gen_hero_hook(void *, void *, void *) { int i; - if (!(dungeon_flags1 & DF1_PRINCIPAL)) return (FALSE); + if (!(dungeon_flags & DF_PRINCIPAL)) return (FALSE); if ((dun_level < 1) || (dun_level >= MAX_RANDOM_QUEST)) return (FALSE); if (!random_quests[dun_level].type) return (FALSE); if (random_quests[dun_level].done) return (FALSE); @@ -498,7 +499,7 @@ static bool_ quest_random_gen_hook(void *, void *in_, void *) int y2, x2, yval, xval; int y1, x1, xsize, ysize; - if (!(dungeon_flags1 & DF1_PRINCIPAL)) return (FALSE); + if (!(dungeon_flags & DF_PRINCIPAL)) return (FALSE); if ((dun_level < 1) || (dun_level >= MAX_RANDOM_QUEST)) return (FALSE); if (!random_quests[dun_level].type) return (FALSE); if (random_quests[dun_level].done) return (FALSE); @@ -620,7 +621,7 @@ std::string quest_random_describe() { // Only emit description if we're actually on a // random quest level. - if (!(dungeon_flags1 & DF1_PRINCIPAL)) return ""; + if (!(dungeon_flags & DF_PRINCIPAL)) return ""; if ((dun_level < 1) || (dun_level >= MAX_RANDOM_QUEST)) return ""; if (!random_quests[dun_level].type) return ""; if (random_quests[dun_level].done) return ""; diff --git a/src/q_thief.cc b/src/q_thief.cc index 0f6543cc..35ecdfbb 100644 --- a/src/q_thief.cc +++ b/src/q_thief.cc @@ -2,6 +2,7 @@ #include "cave.hpp" #include "cave_type.hpp" +#include "dungeon_flag.hpp" #include "hook_quest_finish_in.hpp" #include "hooks.hpp" #include "init1.hpp" @@ -52,7 +53,7 @@ static bool_ quest_thieves_gen_hook(void *, void *, void *) init_flags = INIT_CREATE_DUNGEON; process_dungeon_file("thieves.map", &ystart, &xstart, cur_hgt, cur_wid, TRUE, FALSE); - dungeon_flags2 |= DF2_NO_GENO; + dungeon_flags |= DF_NO_GENO; /* Rip the inventory from the player */ cmsg_print(TERM_YELLOW, "You feel a vicious blow on your head."); diff --git a/src/q_wolves.cc b/src/q_wolves.cc index c5863b59..96869fc9 100644 --- a/src/q_wolves.cc +++ b/src/q_wolves.cc @@ -2,6 +2,7 @@ #include "cave.hpp" #include "cave_type.hpp" +#include "dungeon_flag.hpp" #include "feature_type.hpp" #include "hook_quest_finish_in.hpp" #include "hooks.hpp" @@ -48,7 +49,7 @@ static bool_ quest_wolves_gen_hook(void *, void *, void *) init_flags = INIT_CREATE_DUNGEON; process_dungeon_file("wolves.map", &ystart, &xstart, cur_hgt, cur_wid, TRUE, FALSE); - dungeon_flags2 |= DF2_NO_GENO; + dungeon_flags |= DF_NO_GENO; /* Place some random wolves */ for (i = damroll(4, 4); i > 0; ) diff --git a/src/spells1.cc b/src/spells1.cc index d1930ad2..7a203bb8 100644 --- a/src/spells1.cc +++ b/src/spells1.cc @@ -13,6 +13,7 @@ #include "cmd1.hpp" #include "cmd3.hpp" #include "cmd5.hpp" +#include "dungeon_flag.hpp" #include "dungeon_info_type.hpp" #include "files.hpp" #include "feature_type.hpp" @@ -508,7 +509,7 @@ void teleport_player(int dis) return; } - if ((dungeon_flags2 & DF2_NO_TELEPORT) && (!teleport_player_bypass)) + if ((dungeon_flags & DF_NO_TELEPORT) && (!teleport_player_bypass)) { msg_print("No teleport on special levels..."); return; @@ -797,7 +798,7 @@ void teleport_player_to(int ny, int nx) return; } - if (dungeon_flags2 & DF2_NO_TELEPORT) + if (dungeon_flags & DF_NO_TELEPORT) { msg_print("No teleport on special levels..."); return; @@ -879,12 +880,12 @@ void teleport_player_level(void) msg_print("There is no effect."); return; } - if (dungeon_flags2 & DF2_NO_TELEPORT) + if (dungeon_flags & DF_NO_TELEPORT) { msg_print("No teleport on special levels..."); return; } - if (dungeon_flags2 & DF2_NO_EASY_MOVE) + if (dungeon_flags & DF_NO_EASY_MOVE) { msg_print("Some powerful force prevents your from teleporting."); return; @@ -2403,7 +2404,7 @@ static void apply_nexus(monster_type *m_ptr) { if (m_ptr == NULL) return; - if (!(dungeon_flags2 & DF2_NO_TELEPORT)) + if (!(dungeon_flags & DF_NO_TELEPORT)) { switch (randint(7)) { @@ -6245,7 +6246,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) case GF_AWAY_UNDEAD: { - if (dungeon_flags2 & DF2_NO_TELEPORT) break; /* No teleport on special levels */ + if (dungeon_flags & DF_NO_TELEPORT) break; /* No teleport on special levels */ /* Only affect undead */ if (r_ptr->flags3 & (RF3_UNDEAD)) { @@ -6291,7 +6292,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) /* Teleport evil (Use "dam" as "power") */ case GF_AWAY_EVIL: { - if (dungeon_flags2 & DF2_NO_TELEPORT) break; /* No teleport on special levels */ + if (dungeon_flags & DF_NO_TELEPORT) break; /* No teleport on special levels */ /* Only affect evil */ if (r_ptr->flags3 & (RF3_EVIL)) { @@ -6339,7 +6340,7 @@ bool_ project_m(int who, int r, int y, int x, int dam, int typ) { bool_ resists_tele = FALSE; - if (dungeon_flags2 & DF2_NO_TELEPORT) break; /* No teleport on special levels */ + if (dungeon_flags & DF_NO_TELEPORT) break; /* No teleport on special levels */ if (r_ptr->flags3 & (RF3_RES_TELE)) { if (r_ptr->flags1 & (RF1_UNIQUE)) @@ -7812,7 +7813,7 @@ static bool_ project_p(int who, int r, int y, int x, int dam, int typ, int a_rad /* Gravity -- stun plus slowness plus teleport */ case GF_GRAVITY: { - if (dungeon_flags2 & DF2_NO_TELEPORT) break; /* No teleport on special levels */ + if (dungeon_flags & DF_NO_TELEPORT) break; /* No teleport on special levels */ if (fuzzy) msg_print("You are hit by something heavy!"); msg_print("Gravity warps around you."); if (!unsafe) diff --git a/src/spells2.cc b/src/spells2.cc index 08a643c9..3882a914 100644 --- a/src/spells2.cc +++ b/src/spells2.cc @@ -12,6 +12,7 @@ #include "cave_type.hpp" #include "cmd1.hpp" #include "cmd7.hpp" +#include "dungeon_flag.hpp" #include "dungeon_info_type.hpp" #include "feature_type.hpp" #include "files.hpp" @@ -2622,13 +2623,13 @@ void stair_creation(void) return; } - if (dungeon_flags1 & DF1_FLAT) + if (dungeon_flags & DF_FLAT) { msg_print("No stair creation in non dungeons..."); return; } - if (dungeon_flags2 & DF2_SPECIAL) + if (dungeon_flags & DF_SPECIAL) { msg_print("No stair creation on special levels..."); return; @@ -4096,7 +4097,7 @@ bool_ genocide(bool_ player_cast) { char typ; - if (dungeon_flags2 & DF2_NO_GENO) return (FALSE); + if (dungeon_flags & DF_NO_GENO) return (FALSE); /* Hack -- when you are fated to die, you cant cheat :) */ if (dungeon_type == DUNGEON_DEATH) @@ -4122,7 +4123,7 @@ bool_ mass_genocide(bool_ player_cast) int msec = delay_factor * delay_factor * delay_factor; int dam = 0; - if (dungeon_flags2 & DF2_NO_GENO) return (FALSE); + if (dungeon_flags & DF_NO_GENO) return (FALSE); /* Hack -- when you are fated to die, you cant cheat :) */ if (dungeon_type == DUNGEON_DEATH) @@ -4324,7 +4325,7 @@ void destroy_area(int y1, int x1, int r) bool_ flag = FALSE; - if (dungeon_flags2 & DF2_NO_GENO) + if (dungeon_flags & DF_NO_GENO) { msg_print("Not on special levels!"); return; @@ -6156,7 +6157,7 @@ bool_ passwall(int dir, bool_ safe) if (p_ptr->wild_mode) return FALSE; if (p_ptr->inside_quest) return FALSE; - if (dungeon_flags2 & DF2_NO_TELEPORT) return FALSE; + if (dungeon_flags & DF_NO_TELEPORT) return FALSE; /* Must go somewhere */ if (dir == 5) return FALSE; @@ -6305,7 +6306,7 @@ static int reset_recall_aux() for (size_t i = 1; i < max_d_idx; i++) { /* skip "blocked" dungeons */ - if (d_info[i].flags1 & DF1_NO_RECALL) continue; + if (d_info[i].flags & DF_NO_RECALL) continue; if (max_dlv[i]) { @@ -6372,7 +6373,7 @@ static int reset_recall_aux() msg_print(NULL); continue; } - else if (d_info[i].flags1 & DF1_NO_RECALL) + else if (d_info[i].flags & DF_NO_RECALL) { msg_print("This place blocks my magic!"); msg_print(NULL); @@ -6457,7 +6458,7 @@ void create_between_gate(int dist, int y, int x) { int ii, ij, plev = get_skill(SKILL_CONVEYANCE); - if (dungeon_flags2 & DF2_NO_TELEPORT) + if (dungeon_flags & DF_NO_TELEPORT) { msg_print("Not on special levels!"); return; diff --git a/src/traps.cc b/src/traps.cc index 9c9f2b64..7b286434 100644 --- a/src/traps.cc +++ b/src/traps.cc @@ -14,6 +14,7 @@ #include "cave_type.hpp" #include "cmd1.hpp" #include "cmd2.hpp" +#include "dungeon_flag.hpp" #include "dungeon_info_type.hpp" #include "feature_type.hpp" #include "files.hpp" @@ -838,7 +839,7 @@ bool_ player_activate_trap_type(s16b y, s16b x, object_type *i_ptr, s16b item) if (p_ptr->ffall) { - if (dungeon_flags1 & DF1_TOWER) + if (dungeon_flags & DF_TOWER) { msg_print("You float gently down to the previous level."); } @@ -858,7 +859,7 @@ bool_ player_activate_trap_type(s16b y, s16b x, object_type *i_ptr, s16b item) autosave_checkpoint(); } - if (dungeon_flags1 & DF1_TOWER) dun_level--; + if (dungeon_flags & DF_TOWER) dun_level--; else dun_level++; /* Leaving */ @@ -1977,7 +1978,7 @@ void place_trap(int y, int x) */ if ((trap == TRAP_OF_SINKING) && ((d_ptr->maxdepth == dun_level) || - (dungeon_flags1 & DF1_FLAT) || (is_quest(dun_level))) ) + (dungeon_flags & DF_FLAT) || is_quest(dun_level)) ) { continue; } diff --git a/src/variable.cc b/src/variable.cc index 98d2c1c0..6fa38470 100644 --- a/src/variable.cc +++ b/src/variable.cc @@ -10,6 +10,7 @@ #include "variable.h" #include "cli_comm_fwd.hpp" +#include "dungeon_flag_set.hpp" #include "player_type.hpp" #include "randart_gen_type.hpp" #include "util.hpp" @@ -909,8 +910,7 @@ bool_ generate_special_feeling = FALSE; /* * Dungeon flags */ -u32b dungeon_flags1; -u32b dungeon_flags2; +DECLARE_FLAG_ZERO_IMPL(dungeon_flag_set, dungeon_flags); /* * The last character displayed diff --git a/src/variable.hpp b/src/variable.hpp index 3723a8fb..9c4340a0 100644 --- a/src/variable.hpp +++ b/src/variable.hpp @@ -7,6 +7,7 @@ #include "birther.hpp" #include "cave_type_fwd.hpp" #include "deity_type.hpp" +#include "dungeon_flag_set.hpp" #include "dungeon_info_type_fwd.hpp" #include "effect_type.hpp" #include "ego_item_type_fwd.hpp" @@ -276,8 +277,7 @@ extern s16b plots[MAX_PLOTS]; extern random_quest random_quests[MAX_RANDOM_QUEST]; extern bool_ *special_lvl[MAX_DUNGEON_DEPTH]; extern bool_ generate_special_feeling; -extern u32b dungeon_flags1; -extern u32b dungeon_flags2; +DECLARE_FLAG_ZERO_INTF(dungeon_flag_set, dungeon_flags); extern birther previous_char; extern int max_bg_idx; extern s16b schools_count; diff --git a/src/xtra1.cc b/src/xtra1.cc index ab521c61..140d9edc 100644 --- a/src/xtra1.cc +++ b/src/xtra1.cc @@ -13,6 +13,7 @@ #include "cave_type.hpp" #include "corrupt.hpp" #include "cmd7.hpp" +#include "dungeon_flag.hpp" #include "dungeon_info_type.hpp" #include "files.hpp" #include "gods.hpp" @@ -540,7 +541,7 @@ static void prt_depth(int row, int col) { /* Empty */ } - else if (dungeon_flags2 & DF2_SPECIAL) + else if (dungeon_flags & DF_SPECIAL) { strcpy(depths, "Special"); } @@ -561,7 +562,7 @@ static void prt_depth(int row, int col) } else { - if (dungeon_flags1 & DF1_TOWER) + if (dungeon_flags & DF_TOWER) { (void)strnfmt(depths, 32, "%c%c%c -%d", d_ptr->short_name[0], |