diff options
51 files changed, 149 insertions, 117 deletions
diff --git a/src/cave.cc b/src/cave.cc index 8d78a757..7136e060 100644 --- a/src/cave.cc +++ b/src/cave.cc @@ -1,7 +1,4 @@ -/* File: cave.c */ - -/* Purpose: low level dungeon routines -BEN- */ - +#include "cave.hpp" #include "angband.h" #include "q_rand.h" @@ -4502,33 +4499,16 @@ void disturb(int stop_search) } -/* - * Hack -- Check if a level is a "quest" level - */ -int is_quest(int level) -{ - int i = random_quest_number(); - - /* Check quests */ - if (p_ptr->inside_quest) - return (p_ptr->inside_quest); - - if (i) return (QUEST_RANDOM); - - /* Nope */ - return (0); -} - /* * Return the index of the random quest on this level * (or zero) */ -int random_quest_number() +static int random_quest_number() { if ((dun_level >= 1) && (dun_level < MAX_RANDOM_QUEST) && - (dungeon_flags1 & DF1_PRINCIPAL) && - (random_quests[dun_level].type) && + (dungeon_flags1 & DF1_PRINCIPAL) && + (random_quests[dun_level].type) && (!random_quests[dun_level].done) && (!is_randhero(dun_level))) { @@ -4540,6 +4520,25 @@ int random_quest_number() } + +/* + * Hack -- Check if a level is a "quest" level + */ +int is_quest(int level) +{ + int i = random_quest_number(); + + /* Check quests */ + if (p_ptr->inside_quest) + return (p_ptr->inside_quest); + + if (i) return (QUEST_RANDOM); + + /* Nope */ + return (0); +} + + /* * handle spell effects */ diff --git a/src/cave.hpp b/src/cave.hpp new file mode 100644 index 00000000..612d93b4 --- /dev/null +++ b/src/cave.hpp @@ -0,0 +1,39 @@ +#pragma once + +#include "angband.h" + +extern int distance(int y1, int x1, int y2, int x2); +extern bool_ los(int y1, int x1, int y2, int x2); +extern bool_ cave_valid_bold(int y, int x); +extern bool_ no_lite(void); +extern void map_info_default(int y, int x, byte *ap, char *cp); +extern void move_cursor_relative(int row, int col); +extern void print_rel(char c, byte a, int y, int x); +extern void note_spot(int y, int x); +extern void lite_spot(int y, int x); +extern void prt_map(void); +extern void display_map(int *cy, int *cx); +extern void do_cmd_view_map(void); +extern errr vinfo_init(void); +extern void forget_view(void); +extern void update_view(void); +extern void forget_mon_lite(void); +extern void update_mon_lite(void); +extern void update_flow(void); +extern void map_area(void); +extern void wiz_lite(void); +extern void wiz_lite_extra(void); +extern void wiz_dark(void); +extern void cave_set_feat(int y, int x, int feat); +extern void place_floor(int y, int x); +extern void place_floor_convert_glass(int y, int x); +extern void place_filler(int y, int x); +extern void mmove2(int *y, int *x, int y1, int x1, int y2, int x2); +extern bool_ projectable(int y1, int x1, int y2, int x2); +extern void scatter(int *yp, int *xp, int y, int x, int d); +extern void health_track(int m_idx); +extern void monster_race_track(int r_idx, int ego); +extern void object_track(object_type *o_ptr); +extern void disturb(int stop_search); +extern int is_quest(int level); +extern int new_effect(int type, int dam, int time, int cy, int cx, int rad, s32b flags); diff --git a/src/cmd1.cc b/src/cmd1.cc index 46effe49..bd351d0d 100644 --- a/src/cmd1.cc +++ b/src/cmd1.cc @@ -7,6 +7,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "gods.hpp" #include "hooks.h" #include "mimic.hpp" diff --git a/src/cmd2.cc b/src/cmd2.cc index 939624ac..f6371789 100644 --- a/src/cmd2.cc +++ b/src/cmd2.cc @@ -8,6 +8,7 @@ #include "angband.h" #include "bldg.hpp" +#include "cave.hpp" #include "gods.hpp" #include "hooks.h" #include "skills.hpp" diff --git a/src/cmd3.cc b/src/cmd3.cc index 2d1a6f38..9084907b 100644 --- a/src/cmd3.cc +++ b/src/cmd3.cc @@ -1,7 +1,3 @@ -/* File: cmd3.c */ - -/* Purpose: Inventory commands */ - /* * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke * @@ -11,7 +7,7 @@ */ #include "angband.h" - +#include "cave.hpp" #include "gods.hpp" #include "hooks.h" #include "quark.h" diff --git a/src/cmd5.cc b/src/cmd5.cc index 97e972d0..c5cbedc7 100644 --- a/src/cmd5.cc +++ b/src/cmd5.cc @@ -8,6 +8,7 @@ #include "angband.h" #include "birth.hpp" +#include "cave.hpp" #include "corrupt.hpp" #include "skills.hpp" #include "spell_type.hpp" diff --git a/src/cmd6.cc b/src/cmd6.cc index 5205a0f7..834ac972 100644 --- a/src/cmd6.cc +++ b/src/cmd6.cc @@ -7,6 +7,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "corrupt.hpp" #include "hooks.h" #include "lua_bind.hpp" diff --git a/src/cmd7.cc b/src/cmd7.cc index 86cef678..e13373cc 100644 --- a/src/cmd7.cc +++ b/src/cmd7.cc @@ -1,7 +1,3 @@ -/* File: cmd7.c */ - -/* Purpose: More Class commands */ - /* * Copyright (c) 1999 Dark God * @@ -10,8 +6,8 @@ * included in all such copies. */ - #include "angband.h" +#include "cave.hpp" #include "hooks.h" #include "mimic.hpp" #include "quark.h" diff --git a/src/dungeon.cc b/src/dungeon.cc index 5a669aac..a561c9a3 100644 --- a/src/dungeon.cc +++ b/src/dungeon.cc @@ -8,6 +8,7 @@ #include "angband.h" #include "birth.hpp" +#include "cave.hpp" #include "corrupt.hpp" #include "gods.hpp" #include "hooks.h" diff --git a/src/externs.h b/src/externs.h index 8c5e7070..ba005a24 100644 --- a/src/externs.h +++ b/src/externs.h @@ -471,44 +471,6 @@ extern void help_ability(cptr ability); /* birth.c */ extern bool_ no_begin_screen; -/* cave.c */ -extern int distance(int y1, int x1, int y2, int x2); -extern bool_ los(int y1, int x1, int y2, int x2); -extern bool_ cave_valid_bold(int y, int x); -extern bool_ no_lite(void); -extern void map_info_default(int y, int x, byte *ap, char *cp); -extern void move_cursor_relative(int row, int col); -extern void print_rel(char c, byte a, int y, int x); -extern void note_spot(int y, int x); -extern void lite_spot(int y, int x); -extern void prt_map(void); -extern void display_map(int *cy, int *cx); -extern void do_cmd_view_map(void); -extern errr vinfo_init(void); -extern void forget_view(void); -extern void update_view(void); -extern void forget_mon_lite(void); -extern void update_mon_lite(void); -extern void update_flow(void); -extern void map_area(void); -extern void wiz_lite(void); -extern void wiz_lite_extra(void); -extern void wiz_dark(void); -extern void cave_set_feat(int y, int x, int feat); -extern void place_floor(int y, int x); -extern void place_floor_convert_glass(int y, int x); -extern void place_filler(int y, int x); -extern void mmove2(int *y, int *x, int y1, int x1, int y2, int x2); -extern bool_ projectable(int y1, int x1, int y2, int x2); -extern void scatter(int *yp, int *xp, int y, int x, int d); -extern void health_track(int m_idx); -extern void monster_race_track(int r_idx, int ego); -extern void object_track(object_type *o_ptr); -extern void disturb(int stop_search); -extern int is_quest(int level); -extern int random_quest_number(void); -extern int new_effect(int type, int dam, int time, int cy, int cx, int rad, s32b flags); - /* cmd1.c */ extern void attack_special(monster_type *m_ptr, s32b special, int dam); extern bool_ test_hit_fire(int chance, int ac, int vis); diff --git a/src/files.cc b/src/files.cc index 77188e81..0c32794c 100644 --- a/src/files.cc +++ b/src/files.cc @@ -7,6 +7,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "corrupt.hpp" #include "hiscore.h" #include "hooks.h" diff --git a/src/gen_evol.cc b/src/gen_evol.cc index bfdfbd68..802a4a87 100644 --- a/src/gen_evol.cc +++ b/src/gen_evol.cc @@ -11,7 +11,7 @@ */ #include "angband.h" - +#include "cave.hpp" /* * Generate a game of life level :) and make it evolve diff --git a/src/gen_maze.cc b/src/gen_maze.cc index 86f6d866..9fca14ec 100644 --- a/src/gen_maze.cc +++ b/src/gen_maze.cc @@ -12,7 +12,7 @@ */ #include "angband.h" - +#include "cave.hpp" #include <memory> /* diff --git a/src/generate.cc b/src/generate.cc index acaf5c1b..8121666b 100644 --- a/src/generate.cc +++ b/src/generate.cc @@ -1,7 +1,3 @@ -/* File: generate.c */ - -/* Purpose: Dungeon generation */ - /* * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke * @@ -11,6 +7,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "hooks.h" #include "randart.hpp" diff --git a/src/init1.cc b/src/init1.cc index 08287688..25e933e7 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -1,4 +1,5 @@ #include "angband.h" +#include "cave.hpp" #include "gods.hpp" #include "skills.hpp" diff --git a/src/init2.cc b/src/init2.cc index 38423518..b6ce8894 100644 --- a/src/init2.cc +++ b/src/init2.cc @@ -1,8 +1,5 @@ -/* File: init2.c */ - -/* Purpose: Initialisation (part 2) -BEN- */ - #include "angband.h" +#include "cave.hpp" #include "modules.hpp" #include "messages.h" #include "quark.h" diff --git a/src/melee1.cc b/src/melee1.cc index 4e6111b5..946cde65 100644 --- a/src/melee1.cc +++ b/src/melee1.cc @@ -7,6 +7,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "mimic.hpp" #include "skills.hpp" #include "store.hpp" diff --git a/src/melee2.cc b/src/melee2.cc index 6832eb39..bf294b9e 100644 --- a/src/melee2.cc +++ b/src/melee2.cc @@ -1,14 +1,10 @@ -/* File: melee2.c */ - -/* Purpose: Monster spells and movement */ - /* -* Copyright (c) 1989 James E. Wilson, Robert A. Koeneke -* -* This software may be copied and distributed for educational, research, and -* not for profit purposes provided that this copyright and statement are -* included in all such copies. -*/ + * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke + * + * This software may be copied and distributed for educational, research, and + * not for profit purposes provided that this copyright and statement are + * included in all such copies. + */ /* * This file has several additions to it by Keldon Jones (keldon@umr.edu) @@ -17,6 +13,7 @@ #include "angband.h" +#include "cave.hpp" #include "hooks.h" #include "messages.h" #include "quark.h" diff --git a/src/monster2.cc b/src/monster2.cc index d6c75f91..13f86549 100644 --- a/src/monster2.cc +++ b/src/monster2.cc @@ -6,6 +6,7 @@ * included in all such copies. */ #include "angband.h" +#include "cave.hpp" #include "hooks.h" #include "mimic.hpp" #include "randart.hpp" diff --git a/src/object1.cc b/src/object1.cc index fec6f1b2..492cd9dd 100644 --- a/src/object1.cc +++ b/src/object1.cc @@ -1,7 +1,3 @@ -/* File: object1.c */ - -/* Purpose: Object code, part 1 */ - /* * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke * @@ -11,6 +7,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "hooks.h" #include "lua_bind.hpp" #include "mimic.hpp" diff --git a/src/object2.cc b/src/object2.cc index 9c08ce93..5b467086 100644 --- a/src/object2.cc +++ b/src/object2.cc @@ -1,7 +1,3 @@ -/* File: object2.c */ - -/* Purpose: Object code, part 2 */ - /* * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke * @@ -11,6 +7,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "spell_type.hpp" #include "device_allocation.h" #include "hooks.h" diff --git a/src/powers.cc b/src/powers.cc index e62e2f1c..2d4eda34 100644 --- a/src/powers.cc +++ b/src/powers.cc @@ -1,7 +1,3 @@ -/* File: powers.c */ - -/* Purpose: Powers */ - /* * Copyright (c) 2001 James E. Wilson, Robert A. Koeneke, DarkGod * @@ -11,6 +7,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "quark.h" #include "hooks.h" #include "mimic.hpp" diff --git a/src/q_betwen.cc b/src/q_betwen.cc index 117edeba..98d15570 100644 --- a/src/q_betwen.cc +++ b/src/q_betwen.cc @@ -1,4 +1,6 @@ #include "q_betwen.h" + +#include "cave.hpp" #include "hooks.h" #define cquest (quest[QUEST_BETWEEN]) diff --git a/src/q_dragons.cc b/src/q_dragons.cc index 2ee537de..0ea831b3 100644 --- a/src/q_dragons.cc +++ b/src/q_dragons.cc @@ -1,4 +1,6 @@ #include "q_dragons.h" + +#include "cave.hpp" #include "hooks.h" #define cquest (quest[QUEST_DRAGONS]) diff --git a/src/q_eol.cc b/src/q_eol.cc index b00d433b..1e7b6f05 100644 --- a/src/q_eol.cc +++ b/src/q_eol.cc @@ -1,5 +1,8 @@ #include "q_eol.h" + +#include "cave.hpp" #include "hooks.h" + #include <cassert> #define cquest (quest[QUEST_EOL]) diff --git a/src/q_evil.cc b/src/q_evil.cc index da0816ae..73972c95 100644 --- a/src/q_evil.cc +++ b/src/q_evil.cc @@ -1,4 +1,6 @@ #include "q_evil.h" + +#include "cave.hpp" #include "hooks.h" #define cquest (quest[QUEST_EVIL]) diff --git a/src/q_haunted.cc b/src/q_haunted.cc index 7b6d7f15..ff3b69d6 100644 --- a/src/q_haunted.cc +++ b/src/q_haunted.cc @@ -1,4 +1,6 @@ #include "q_haunted.h" + +#include "cave.hpp" #include "hooks.h" #define cquest (quest[QUEST_HAUNTED]) diff --git a/src/q_hobbit.cc b/src/q_hobbit.cc index 10e67176..4d8085d5 100644 --- a/src/q_hobbit.cc +++ b/src/q_hobbit.cc @@ -1,6 +1,9 @@ #include "q_hobbit.h" + +#include "cave.hpp" #include "messages.h" #include "hooks.h" + #include <cassert> #define cquest (quest[QUEST_HOBBIT]) diff --git a/src/q_invas.cc b/src/q_invas.cc index 983e84fb..0a8c41b8 100644 --- a/src/q_invas.cc +++ b/src/q_invas.cc @@ -1,4 +1,6 @@ #include "q_invas.h" + +#include "cave.hpp" #include "hooks.h" #define cquest (quest[QUEST_INVASION]) diff --git a/src/q_nazgul.cc b/src/q_nazgul.cc index 32449f1d..9e528ece 100644 --- a/src/q_nazgul.cc +++ b/src/q_nazgul.cc @@ -1,5 +1,8 @@ #include "q_nazgul.h" + +#include "cave.hpp" #include "hooks.h" + #include <cassert> #define cquest (quest[QUEST_NAZGUL]) diff --git a/src/q_nirna.cc b/src/q_nirna.cc index 145c9953..8f5678c5 100644 --- a/src/q_nirna.cc +++ b/src/q_nirna.cc @@ -1,4 +1,6 @@ #include "q_nirna.h" + +#include "cave.hpp" #include "hooks.h" #define cquest (quest[QUEST_NIRNAETH]) diff --git a/src/q_poison.cc b/src/q_poison.cc index 29993fff..98d29d77 100644 --- a/src/q_poison.cc +++ b/src/q_poison.cc @@ -1,4 +1,6 @@ #include "q_poison.h" + +#include "cave.hpp" #include "quark.h" #include "messages.h" #include "hooks.h" diff --git a/src/q_rand.cc b/src/q_rand.cc index fd4f8ef6..57c0c4de 100644 --- a/src/q_rand.cc +++ b/src/q_rand.cc @@ -1,8 +1,11 @@ #include "q_rand.h" + +#include "cave.hpp" #include "hooks.h" #include "skills.hpp" #include "util.hpp" #include "messages.h" + #include <cassert> static int randquest_hero[] = { 20, 13, 15, 16, 9, 17, 18, 8, -1 }; diff --git a/src/q_shroom.cc b/src/q_shroom.cc index 97d76275..b512484a 100644 --- a/src/q_shroom.cc +++ b/src/q_shroom.cc @@ -1,6 +1,9 @@ #include "q_shroom.h" + +#include "cave.hpp" #include "messages.h" #include "hooks.h" + #include <cassert> #define cquest (quest[QUEST_SHROOM]) diff --git a/src/q_spider.cc b/src/q_spider.cc index 63f21fe0..dbee4255 100644 --- a/src/q_spider.cc +++ b/src/q_spider.cc @@ -1,5 +1,6 @@ #include "q_spider.h" +#include "cave.hpp" #include "gods.hpp" #include "hooks.h" diff --git a/src/q_thief.cc b/src/q_thief.cc index cc4bd5a5..425c8e93 100644 --- a/src/q_thief.cc +++ b/src/q_thief.cc @@ -1,4 +1,6 @@ #include "q_thief.h" + +#include "cave.hpp" #include "hooks.h" #define cquest (quest[QUEST_THIEVES]) diff --git a/src/q_thrain.cc b/src/q_thrain.cc index ba5ba56b..1590304c 100644 --- a/src/q_thrain.cc +++ b/src/q_thrain.cc @@ -1,5 +1,6 @@ #include "q_thrain.h" +#include "cave.hpp" #include "hooks.h" #include "quark.h" #include "randart.hpp" diff --git a/src/q_troll.cc b/src/q_troll.cc index 39e4a28a..5d547b1a 100644 --- a/src/q_troll.cc +++ b/src/q_troll.cc @@ -1,5 +1,8 @@ #include "q_troll.h" + +#include "cave.hpp" #include "hooks.h" + #include <cassert> #define cquest (quest[QUEST_TROLL]) diff --git a/src/q_ultrag.cc b/src/q_ultrag.cc index 28cce009..90f90e6d 100644 --- a/src/q_ultrag.cc +++ b/src/q_ultrag.cc @@ -1,4 +1,6 @@ #include "q_ultrag.h" + +#include "cave.hpp" #include "hooks.h" #define cquest (quest[QUEST_ULTRA_GOOD]) diff --git a/src/q_wight.cc b/src/q_wight.cc index 68794ead..a07c617c 100644 --- a/src/q_wight.cc +++ b/src/q_wight.cc @@ -1,6 +1,9 @@ #include "q_wight.h" + +#include "cave.hpp" #include "quark.h" #include "hooks.h" + #include <cassert> #define cquest (quest[QUEST_WIGHT]) diff --git a/src/q_wolves.cc b/src/q_wolves.cc index 1afa0fb8..9a68c7ca 100644 --- a/src/q_wolves.cc +++ b/src/q_wolves.cc @@ -1,4 +1,6 @@ #include "q_wolves.h" + +#include "cave.hpp" #include "hooks.h" #define cquest (quest[QUEST_WOLVES]) diff --git a/src/spells1.cc b/src/spells1.cc index 7cf56ac0..90c728c0 100644 --- a/src/spells1.cc +++ b/src/spells1.cc @@ -7,6 +7,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "gods.hpp" #include "skills.hpp" #include "spell_type.hpp" diff --git a/src/spells2.cc b/src/spells2.cc index 9cbeb333..c03123ff 100644 --- a/src/spells2.cc +++ b/src/spells2.cc @@ -7,6 +7,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "hooks.h" #include "notes.hpp" #include "skills.hpp" diff --git a/src/spells3.cc b/src/spells3.cc index 4cd65c0f..531e5c67 100644 --- a/src/spells3.cc +++ b/src/spells3.cc @@ -1,15 +1,16 @@ #include "spells3.hpp" -#include "spells5.hpp" -#include "angband.h" - -#include <assert.h> +#include "angband.h" +#include "cave.hpp" +#include "skills.hpp" #include "spell_type.hpp" #include "spell_idx_list.hpp" -#include "skills.hpp" +#include "spells5.hpp" #include "mimic.hpp" #include "xtra2.hpp" +#include <algorithm> +#include <cassert> #include <vector> s32b NOXIOUSCLOUD = -1; /* Identifier */ diff --git a/src/spells4.cc b/src/spells4.cc index c0e3e9af..34b39c5f 100644 --- a/src/spells4.cc +++ b/src/spells4.cc @@ -1,8 +1,6 @@ #include "angband.h" -#include <assert.h> -#include <sstream> - +#include "cave.hpp" #include "gods.hpp" #include "lua_bind.hpp" #include "spell_type.hpp" @@ -11,6 +9,9 @@ #include "spells5.hpp" #include <algorithm> +#include <cassert> +#include <sstream> + school_book_type school_books[SCHOOL_BOOKS_SIZE]; s32b SCHOOL_AIR; diff --git a/src/store.cc b/src/store.cc index 9bb50234..7f7bef88 100644 --- a/src/store.cc +++ b/src/store.cc @@ -9,9 +9,10 @@ #include "store.hpp" #include "bldg.hpp" +#include "cave.hpp" #include "hooks.h" -#include "spell_type.hpp" #include "quark.h" +#include "spell_type.hpp" #include "skills.hpp" #include "spells5.hpp" #include "xtra1.hpp" diff --git a/src/traps.cc b/src/traps.cc index d9056f83..ba78a3ce 100644 --- a/src/traps.cc +++ b/src/traps.cc @@ -8,6 +8,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "gods.hpp" #include "xtra1.hpp" #include "xtra2.hpp" diff --git a/src/wild.cc b/src/wild.cc index 35d526d9..c9e64bc7 100644 --- a/src/wild.cc +++ b/src/wild.cc @@ -1,7 +1,3 @@ -/* File: generate.c */ - -/* Purpose: Wilderness & Town related things */ - /* * Copyright (c) 2001 James E. Wilson, Robert A. Koeneke, DarkGod * @@ -11,6 +7,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "hooks.h" #include <memory> diff --git a/src/wizard2.cc b/src/wizard2.cc index b98b7131..3f99726e 100644 --- a/src/wizard2.cc +++ b/src/wizard2.cc @@ -11,6 +11,7 @@ */ #include "angband.h" +#include "cave.hpp" #include "corrupt.hpp" #include "hooks.h" #include "randart.hpp" diff --git a/src/xtra1.cc b/src/xtra1.cc index 10e35c67..24381afe 100644 --- a/src/xtra1.cc +++ b/src/xtra1.cc @@ -9,6 +9,7 @@ #include "xtra1.hpp" #include "angband.h" +#include "cave.hpp" #include "corrupt.hpp" #include "gods.hpp" #include "hooks.h" diff --git a/src/xtra2.cc b/src/xtra2.cc index 63e2f45f..75624c58 100644 --- a/src/xtra2.cc +++ b/src/xtra2.cc @@ -9,6 +9,7 @@ #include "xtra2.hpp" #include "angband.h" +#include "cave.hpp" #include "corrupt.hpp" #include "gods.hpp" #include "hooks.h" |