summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/angband.h1
-rw-r--r--src/birth.c1
-rw-r--r--src/bldg.c1
-rw-r--r--src/cmd1.c1
-rw-r--r--src/cmd2.c1
-rw-r--r--src/cmd3.c1
-rw-r--r--src/cmd4.c1
-rw-r--r--src/cmd6.c1
-rw-r--r--src/cmd7.c3
-rw-r--r--src/dungeon.c1
-rw-r--r--src/externs.h22
-rw-r--r--src/files.c1
-rw-r--r--src/generate.c2
-rw-r--r--src/help.c1
-rw-r--r--src/hooks.c (renamed from src/plots.c)79
-rw-r--r--src/hooks.h18
-rw-r--r--src/init2.c1
-rw-r--r--src/loadsave.c3
-rw-r--r--src/melee2.c1
-rw-r--r--src/modules.c5
-rw-r--r--src/monster2.c1
-rw-r--r--src/object1.c1
-rw-r--r--src/object2.c1
-rw-r--r--src/plots.h5
-rw-r--r--src/powers.c1
-rw-r--r--src/q_betwen.c19
-rw-r--r--src/q_dragons.c7
-rw-r--r--src/q_eol.c16
-rw-r--r--src/q_evil.c7
-rw-r--r--src/q_fireprof.c7
-rw-r--r--src/q_god.c17
-rw-r--r--src/q_haunted.c7
-rw-r--r--src/q_hobbit.c19
-rw-r--r--src/q_invas.c19
-rw-r--r--src/q_library.c3
-rw-r--r--src/q_library.h1
-rw-r--r--src/q_main.c17
-rw-r--r--src/q_narsil.c11
-rw-r--r--src/q_nazgul.c16
-rw-r--r--src/q_nirna.c13
-rw-r--r--src/q_one.c28
-rw-r--r--src/q_poison.c16
-rw-r--r--src/q_rand.c13
-rw-r--r--src/q_rand.h1
-rw-r--r--src/q_shroom.c18
-rw-r--r--src/q_spider.c10
-rw-r--r--src/q_thief.c11
-rw-r--r--src/q_thrain.c15
-rw-r--r--src/q_troll.c10
-rw-r--r--src/q_ultrag.c12
-rw-r--r--src/q_wight.c10
-rw-r--r--src/q_wolves.c7
-rw-r--r--src/script.c1
-rw-r--r--src/skills.c1
-rw-r--r--src/spells2.c1
-rw-r--r--src/store.c1
-rw-r--r--src/tables.c2
-rw-r--r--src/types.h2
-rw-r--r--src/wild.c1
-rw-r--r--src/wizard2.c1
-rw-r--r--src/xtra1.c1
-rw-r--r--src/xtra2.c1
63 files changed, 270 insertions, 228 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 74d71c68..ba0fd9d2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -8,7 +8,7 @@ ADD_SUBDIRECTORY (squelch)
SET(SRCS
main-gcu.c main-x11.c main-xaw.c main-sdl.c main-gtk2.c
z-rand.c z-util.c z-form.c z-virt.c z-term.c
- variable.c tables.c plots.c util.c cave.c dungeon.c
+ variable.c tables.c hooks.c util.c cave.c dungeon.c
melee1.c melee2.c messages.c modules.c
q_god.c q_library.c q_fireprof.c q_bounty.c q_thrain.c
q_narsil.c q_evil.c q_betwen.c q_haunted.c q_invas.c
diff --git a/src/angband.h b/src/angband.h
index 6bfbb984..7cceb7bd 100644
--- a/src/angband.h
+++ b/src/angband.h
@@ -57,7 +57,6 @@ extern "C" {
#include "types.h"
#include "spell_type_fwd.h"
#include "externs.h"
-#include "plots.h"
/***** Some copyright messages follow below *****/
diff --git a/src/birth.c b/src/birth.c
index 844c3be8..c6b612d3 100644
--- a/src/birth.c
+++ b/src/birth.c
@@ -12,6 +12,7 @@
#include "angband.h"
#include "messages.h"
+#include "hooks.h"
#include "q_rand.h"
/*
diff --git a/src/bldg.c b/src/bldg.c
index a182df65..468e3c1d 100644
--- a/src/bldg.c
+++ b/src/bldg.c
@@ -14,6 +14,7 @@
*/
#include "angband.h"
+#include "hooks.h"
#include "q_library.h"
#include "q_fireprof.h"
#include "q_bounty.h"
diff --git a/src/cmd1.c b/src/cmd1.c
index a349ac12..46fc15eb 100644
--- a/src/cmd1.c
+++ b/src/cmd1.c
@@ -13,6 +13,7 @@
#include "angband.h"
#include "quark.h"
+#include "hooks.h"
#define MAX_VAMPIRIC_DRAIN 100
diff --git a/src/cmd2.c b/src/cmd2.c
index 20ef50af..28a3dc1e 100644
--- a/src/cmd2.c
+++ b/src/cmd2.c
@@ -11,6 +11,7 @@
*/
#include "angband.h"
+#include "hooks.h"
void do_cmd_immovable_special(void);
diff --git a/src/cmd3.c b/src/cmd3.c
index d648a0dc..9f4170bc 100644
--- a/src/cmd3.c
+++ b/src/cmd3.c
@@ -13,6 +13,7 @@
#include "angband.h"
#include "quark.h"
+#include "hooks.h"
/*
* Display p_ptr->inventory
diff --git a/src/cmd4.c b/src/cmd4.c
index da606cc6..b74bfff9 100644
--- a/src/cmd4.c
+++ b/src/cmd4.c
@@ -13,6 +13,7 @@
#include "angband.h"
#include "messages.h"
+#include "hooks.h"
/*
* Hack -- redraw the screen
diff --git a/src/cmd6.c b/src/cmd6.c
index bfe364e5..80f61816 100644
--- a/src/cmd6.c
+++ b/src/cmd6.c
@@ -13,6 +13,7 @@
#include "angband.h"
#include "spell_type.h"
+#include "hooks.h"
/*
* Forward declare
diff --git a/src/cmd7.c b/src/cmd7.c
index 3d3b1bb2..02f84437 100644
--- a/src/cmd7.c
+++ b/src/cmd7.c
@@ -14,6 +14,7 @@
#include "angband.h"
#include "quark.h"
+#include "hooks.h"
/*
* Describe class powers of Mindcrafters
@@ -816,7 +817,7 @@ void do_cmd_mimic_lore()
p_ptr->update |= (PU_BONUS);
}
-static bool_ mimic_forbid_travel(char *fmt)
+static bool_ mimic_forbid_travel(const char *fmt)
{
u32b value = p_ptr->mimic_extra >> 16;
u32b att = p_ptr->mimic_extra & 0xFFFF;
diff --git a/src/dungeon.c b/src/dungeon.c
index 0b2551bf..5b462bb8 100644
--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -15,6 +15,7 @@
#include <assert.h>
#include "quark.h"
+#include "hooks.h"
#include "spell_type.h"
#define TY_CURSE_CHANCE 100
diff --git a/src/externs.h b/src/externs.h
index cf8702bd..28e99e1c 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -561,28 +561,6 @@ extern deity_type deity_info[MAX_GODS];
extern timer_type *gl_timers;
extern const char *get_version_string();
-/* plots.c */
-extern FILE *hook_file;
-extern bool_ check_hook(int h_idx);
-extern void wipe_hooks(void);
-extern void dump_hooks(int h_idx);
-extern void init_hooks(void);
-extern hooks_chain* add_hook(int h_idx, hook_type hook, cptr name);
-extern void add_hook_new(int h_idx, bool_ (*hook_f)(void *, void *, void *), cptr name, void *data);
-extern void add_hook_script(int h_idx, char *script, cptr name);
-extern void del_hook(int h_idx, hook_type hook);
-extern void del_hook_name(int h_idx, cptr name);
-extern s32b get_next_arg(char *fmt);
-extern char* get_next_arg_str(char *fmt);
-extern object_type *get_next_arg_obj();
-extern int process_hooks_restart;
-extern hook_return process_hooks_return[20];
-extern bool_ process_hooks_ret(int h_idx, char *ret, char *fmt, ...);
-extern bool_ process_hooks(int h_idx, char *fmt, ...);
-extern bool_ process_hooks_new(int h_idx, void *in, void *out);
-
-extern void initialize_bookable_spells();
-
/* help.c */
extern void init_hooks_help();
extern void help_race(cptr race);
diff --git a/src/files.c b/src/files.c
index 664c96d7..c97315fc 100644
--- a/src/files.c
+++ b/src/files.c
@@ -13,6 +13,7 @@
#include "angband.h"
#include "hiscore.h"
+#include "hooks.h"
/*
diff --git a/src/generate.c b/src/generate.c
index 44e331a6..652d2bee 100644
--- a/src/generate.c
+++ b/src/generate.c
@@ -11,6 +11,8 @@
*/
#include "angband.h"
+#include "hooks.h"
+
#define SAFE_MAX_ATTEMPTS 5000
/*
diff --git a/src/help.c b/src/help.c
index 7aae360e..4c14da9d 100644
--- a/src/help.c
+++ b/src/help.c
@@ -12,6 +12,7 @@
*/
#include "angband.h"
+#include "hooks.h"
#define DESC_MAX 14
#define TRIGGERED_HELP_MAX 19
diff --git a/src/plots.c b/src/hooks.c
index 065cef54..2b70e90d 100644
--- a/src/plots.c
+++ b/src/hooks.c
@@ -1,7 +1,3 @@
-/* File: plots.c */
-
-/* Purpose: plots & quests */
-
/*
* Copyright (c) 2001 James E. Wilson, Robert A. Koeneke, DarkGod
*
@@ -9,9 +5,8 @@
* not for profit purposes provided that this copyright and statement are
* included in all such copies.
*/
-
+#include "hooks.h"
#include "angband.h"
-
#include <assert.h>
/******** Hooks stuff *********/
@@ -44,38 +39,6 @@ void init_hooks()
}
}
-void dump_hooks(int h_idx)
-{
- int min = 0, max = MAX_HOOKS, i;
-
- if (h_idx != -1)
- {
- min = h_idx;
- max = h_idx + 1;
- }
-
- for (i = min; i < max; i++)
- {
- hooks_chain *c = hooks_heads[i];
-
- /* Find it */
- while (c != NULL)
- {
- msg_format("%s(%s)", c->name, (c->type == HOOK_TYPE_C) ? "C" : "Lua");
-
- c = c->next;
- }
- }
-}
-
-/* Check a hook */
-bool_ check_hook(int h_idx)
-{
- hooks_chain *c = hooks_heads[h_idx];
-
- return (c != NULL);
-}
-
/* Add a hook */
hooks_chain* add_hook(int h_idx, hook_type hook, cptr name)
{
@@ -136,38 +99,11 @@ void del_hook(int h_idx, hook_type hook)
}
}
-void del_hook_name(int h_idx, cptr name)
-{
- hooks_chain *c = hooks_heads[h_idx], *p = NULL;
-
- /* Find it */
- while ((c != NULL) && (strcmp(c->name, name)))
- {
- p = c;
- c = c->next;
- }
-
- /* Remove it */
- if (c != NULL)
- {
- if (p == NULL)
- {
- hooks_heads[h_idx] = c->next;
- FREE(c, hooks_chain);
- }
- else
- {
- p->next = c->next;
- FREE(c, hooks_chain);
- }
- }
-}
-
/* get the next argument */
static hook_return param_pile[MAX_ARGS];
static int get_next_arg_pos = 0;
static int get_next_arg_pile_pos = 0;
-s32b get_next_arg(char *fmt)
+s32b get_next_arg(const char *fmt)
{
while (TRUE)
{
@@ -185,7 +121,7 @@ s32b get_next_arg(char *fmt)
}
}
}
-char* get_next_arg_str(char *fmt)
+char* get_next_arg_str(const char *fmt)
{
while (TRUE)
{
@@ -337,12 +273,3 @@ bool_ process_hooks_new(int h_idx, void *in, void *out)
return FALSE;
}
-
-/******** Plots & Quest stuff ********/
-
-/* Catch-all quest hook */
-bool_ quest_null_hook(int q)
-{
- /* Do nothing */
- return (FALSE);
-}
diff --git a/src/hooks.h b/src/hooks.h
new file mode 100644
index 00000000..0c83cf84
--- /dev/null
+++ b/src/hooks.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "angband.h"
+
+extern FILE *hook_file;
+extern void wipe_hooks(void);
+extern void init_hooks(void);
+extern hooks_chain* add_hook(int h_idx, hook_type hook, cptr name);
+extern void add_hook_new(int h_idx, bool_ (*hook_f)(void *, void *, void *), cptr name, void *data);
+extern void del_hook(int h_idx, hook_type hook);
+extern s32b get_next_arg(const char *fmt);
+extern char* get_next_arg_str(const char *fmt);
+extern object_type *get_next_arg_obj();
+extern int process_hooks_restart;
+extern hook_return process_hooks_return[20];
+extern bool_ process_hooks_ret(int h_idx, char *ret, char *fmt, ...);
+extern bool_ process_hooks(int h_idx, char *fmt, ...);
+extern bool_ process_hooks_new(int h_idx, void *in, void *out);
diff --git a/src/init2.c b/src/init2.c
index a38cccee..815d1255 100644
--- a/src/init2.c
+++ b/src/init2.c
@@ -8,6 +8,7 @@
#include "messages.h"
#include "quark.h"
+#include "hooks.h"
/*
* This file is used to initialise various variables and arrays for the
diff --git a/src/loadsave.c b/src/loadsave.c
index 1b142e59..1800298d 100644
--- a/src/loadsave.c
+++ b/src/loadsave.c
@@ -8,6 +8,7 @@
#include "messages.h"
#include "quark.h"
+#include "hooks.h"
static void do_byte(byte *, int);
static void do_bool(bool_ *, int);
@@ -2715,7 +2716,7 @@ static bool_ do_savefile_aux(int flag)
}
/* Init the hooks */
- if (flag == LS_LOAD)
+ if ((flag == LS_LOAD) && (quest[i].init != NULL))
{
quest[i].init(i);
}
diff --git a/src/melee2.c b/src/melee2.c
index 4f63959d..bc3fc75b 100644
--- a/src/melee2.c
+++ b/src/melee2.c
@@ -19,6 +19,7 @@
#include "messages.h"
#include "quark.h"
+#include "hooks.h"
#define SPEAK_CHANCE 8
#define GRINDNOISE 20
diff --git a/src/modules.c b/src/modules.c
index 8376e3fb..7b11b568 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -1,7 +1,3 @@
-/* File: modules.c */
-
-/* Purpose: T-engine modules */
-
/*
* Copyright (c) 2003 DarkGod
*
@@ -11,6 +7,7 @@
*/
#include "angband.h"
+#include "hooks.h"
static void module_reset_dir_aux(cptr *dir, cptr new_path)
{
diff --git a/src/monster2.c b/src/monster2.c
index 5ed4758a..4c4df91d 100644
--- a/src/monster2.c
+++ b/src/monster2.c
@@ -11,6 +11,7 @@
*/
#include "angband.h"
+#include "hooks.h"
#define MAX_HORROR 20
#define MAX_FUNNY 22
diff --git a/src/object1.c b/src/object1.c
index dd27c27e..72ccd5af 100644
--- a/src/object1.c
+++ b/src/object1.c
@@ -14,6 +14,7 @@
#include "quark.h"
#include "spell_type.h"
+#include "hooks.h"
/*
* Hack -- note that "TERM_MULTI" is now just "TERM_VIOLET".
diff --git a/src/object2.c b/src/object2.c
index cf688c15..3e55ed00 100644
--- a/src/object2.c
+++ b/src/object2.c
@@ -14,6 +14,7 @@
#include "spell_type.h"
#include "device_allocation.h"
+#include "hooks.h"
/*
diff --git a/src/plots.h b/src/plots.h
deleted file mode 100644
index b7a0dec5..00000000
--- a/src/plots.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* File: plots.h */
-
-/* Purpose: extern plots declarations */
-
-extern bool_ quest_null_hook(int q);
diff --git a/src/powers.c b/src/powers.c
index afc4a13a..7001a859 100644
--- a/src/powers.c
+++ b/src/powers.c
@@ -13,6 +13,7 @@
#include "angband.h"
#include "quark.h"
+#include "hooks.h"
/*
* Note: return value indicates the amount of mana to use
diff --git a/src/q_betwen.c b/src/q_betwen.c
index 1814cf2b..6f4072ca 100644
--- a/src/q_betwen.c
+++ b/src/q_betwen.c
@@ -1,8 +1,9 @@
#include "q_betwen.h"
+#include "hooks.h"
#define cquest (quest[QUEST_BETWEEN])
-bool_ quest_between_move_hook(char *fmt)
+static bool_ quest_between_move_hook(const char *fmt)
{
s32b y;
s32b x;
@@ -50,7 +51,8 @@ bool_ quest_between_move_hook(char *fmt)
return FALSE;
}
-bool_ quest_between_gen_hook(char *fmt)
+
+static bool_ quest_between_gen_hook(const char *fmt)
{
int x, y;
int xstart = 2;
@@ -84,7 +86,8 @@ bool_ quest_between_gen_hook(char *fmt)
return TRUE;
}
-bool_ quest_between_finish_hook(char *fmt)
+
+static bool_ quest_between_finish_hook(const char *fmt)
{
s32b q_idx;
object_type forge, *q_ptr;
@@ -122,7 +125,8 @@ bool_ quest_between_finish_hook(char *fmt)
return TRUE;
}
-bool_ quest_between_death_hook(char *fmt)
+
+static bool_ quest_between_death_hook(const char *fmt)
{
int i, mcnt = 0;
@@ -151,7 +155,8 @@ bool_ quest_between_death_hook(char *fmt)
return FALSE;
}
-bool_ quest_between_dump_hook(char *fmt)
+
+static bool_ quest_between_dump_hook(const char *fmt)
{
if (cquest.status >= QUEST_STATUS_COMPLETED)
{
@@ -160,7 +165,8 @@ bool_ quest_between_dump_hook(char *fmt)
}
return (FALSE);
}
-bool_ quest_between_forbid_hook(char *fmt)
+
+static bool_ quest_between_forbid_hook(const char *fmt)
{
s32b q_idx;
q_idx = get_next_arg(fmt);
@@ -174,6 +180,7 @@ bool_ quest_between_forbid_hook(char *fmt)
}
return (FALSE);
}
+
bool_ quest_between_init_hook(int q)
{
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
diff --git a/src/q_dragons.c b/src/q_dragons.c
index cd6ebf2c..e63f662a 100644
--- a/src/q_dragons.c
+++ b/src/q_dragons.c
@@ -1,8 +1,9 @@
#include "q_dragons.h"
+#include "hooks.h"
#define cquest (quest[QUEST_DRAGONS])
-bool_ quest_dragons_gen_hook(char *fmt)
+static bool_ quest_dragons_gen_hook(const char *fmt)
{
int x, y, i;
int xstart = 2;
@@ -90,7 +91,7 @@ bool_ quest_dragons_gen_hook(char *fmt)
return TRUE;
}
-bool_ quest_dragons_death_hook(char *fmt)
+static bool_ quest_dragons_death_hook(const char *fmt)
{
int i, mcnt = 0;
@@ -122,7 +123,7 @@ bool_ quest_dragons_death_hook(char *fmt)
return FALSE;
}
-bool_ quest_dragons_finish_hook(char *fmt)
+static bool_ quest_dragons_finish_hook(const char *fmt)
{
s32b q_idx;
diff --git a/src/q_eol.c b/src/q_eol.c
index 3d9b13c8..4f0aa498 100644
--- a/src/q_eol.c
+++ b/src/q_eol.c
@@ -1,8 +1,9 @@
#include "q_eol.h"
+#include "hooks.h"
#define cquest (quest[QUEST_EOL])
-bool_ quest_eol_gen_hook(char *fmt)
+static bool_ quest_eol_gen_hook(const char *fmt)
{
int x, y;
bool_ done = FALSE;
@@ -82,7 +83,8 @@ bool_ quest_eol_gen_hook(char *fmt)
return TRUE;
}
-bool_ quest_eol_finish_hook(char *fmt)
+
+static bool_ quest_eol_finish_hook(const char *fmt)
{
object_type forge, *q_ptr;
s32b q_idx;
@@ -114,7 +116,8 @@ bool_ quest_eol_finish_hook(char *fmt)
return TRUE;
}
-bool_ quest_eol_fail_hook(char *fmt)
+
+static bool_ quest_eol_fail_hook(const char *fmt)
{
s32b q_idx;
@@ -132,7 +135,8 @@ bool_ quest_eol_fail_hook(char *fmt)
return TRUE;
}
-bool_ quest_eol_death_hook(char *fmt)
+
+static bool_ quest_eol_death_hook(const char *fmt)
{
s32b r_idx, m_idx;
@@ -152,7 +156,8 @@ bool_ quest_eol_death_hook(char *fmt)
return FALSE;
}
-bool_ quest_eol_stair_hook(char *fmt)
+
+static bool_ quest_eol_stair_hook(const char *fmt)
{
monster_race *r_ptr = &r_info[test_monster_name("Eol, the Dark Elf")];
cptr down;
@@ -182,6 +187,7 @@ bool_ quest_eol_stair_hook(char *fmt)
return FALSE;
}
+
bool_ quest_eol_init_hook(int q)
{
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
diff --git a/src/q_evil.c b/src/q_evil.c
index 4f4d59cd..64a9fabc 100644
--- a/src/q_evil.c
+++ b/src/q_evil.c
@@ -1,8 +1,9 @@
#include "q_evil.h"
+#include "hooks.h"
#define cquest (quest[QUEST_EVIL])
-bool_ quest_evil_gen_hook(char *fmt)
+static bool_ quest_evil_gen_hook(const char *fmt)
{
int x, y, i;
int xstart = 2;
@@ -55,7 +56,7 @@ bool_ quest_evil_gen_hook(char *fmt)
return TRUE;
}
-bool_ quest_evil_death_hook(char *fmt)
+static bool_ quest_evil_death_hook(const char *fmt)
{
int i, mcnt = 0;
@@ -89,7 +90,7 @@ bool_ quest_evil_death_hook(char *fmt)
return FALSE;
}
-bool_ quest_evil_finish_hook(char *fmt)
+static bool_ quest_evil_finish_hook(const char *fmt)
{
s32b q_idx;
diff --git a/src/q_fireprof.c b/src/q_fireprof.c
index e252af4f..a515335f 100644
--- a/src/q_fireprof.c
+++ b/src/q_fireprof.c
@@ -1,5 +1,6 @@
#include "q_fireprof.h"
#include "quark.h"
+#include "hooks.h"
#define cquest (quest[QUEST_FIREPROOF])
@@ -379,7 +380,7 @@ void quest_fireproof_building(bool_ *paid, bool_ *recreate)
}
}
-static bool_ fireproof_get_hook(char *fmt)
+static bool_ fireproof_get_hook(const char *fmt)
{
object_type *o_ptr = get_next_arg_obj();
@@ -398,7 +399,7 @@ static bool_ fireproof_get_hook(char *fmt)
return FALSE;
}
-static bool_ fireproof_stair_hook(char *fmt)
+static bool_ fireproof_stair_hook(const char *fmt)
{
/* only ask this if player about to go up stairs of quest and
* hasn't retrieved item */
@@ -480,7 +481,7 @@ bool_ quest_fireproof_describe(FILE *hook_file)
return TRUE;
}
-static bool_ fireproof_gen_hook(char *fmt)
+static bool_ fireproof_gen_hook(const char *fmt)
{
fireproof_settings const *settings = fireproof_get_settings();
diff --git a/src/q_god.c b/src/q_god.c
index 50f54762..26b44a30 100644
--- a/src/q_god.c
+++ b/src/q_god.c
@@ -1,5 +1,6 @@
#include "q_god.h"
#include "quark.h"
+#include "hooks.h"
#include <assert.h>
@@ -864,7 +865,7 @@ static void quest_god_set_god_dungeon_attributes_mandos()
d_info[DUNGEON_GOD].rules[0].mflags3 = RF3_UNDEAD | RF3_EVIL;
}
-static bool_ quest_god_level_end_gen_hook(char *fmt)
+static bool_ quest_god_level_end_gen_hook(const char *fmt)
{
/* Check for dungeon */
if ((dungeon_type != DUNGEON_GOD) ||
@@ -921,7 +922,7 @@ static bool_ quest_god_level_end_gen_hook(char *fmt)
return FALSE;
}
-static bool_ quest_god_player_level_hook(char *fmt)
+static bool_ quest_god_player_level_hook(const char *fmt)
{
s32b gained = get_next_arg(fmt);
@@ -981,7 +982,7 @@ static bool_ quest_god_player_level_hook(char *fmt)
return FALSE;
}
-static bool_ quest_god_get_hook(char *fmt)
+static bool_ quest_god_get_hook(const char *fmt)
{
s32b item;
object_type *o_ptr = NULL;
@@ -1039,7 +1040,7 @@ static bool_ quest_god_get_hook(char *fmt)
return FALSE;
}
-static bool_ quest_god_char_dump_hook(char *fmt)
+static bool_ quest_god_char_dump_hook(const char *fmt)
{
if (cquest_quests_given > 0)
{
@@ -1140,26 +1141,26 @@ static void quest_god_dungeon_setup(int d_idx)
set_god_dungeon_attributes();
}
-static bool_ quest_god_enter_dungeon_hook(char *fmt)
+static bool_ quest_god_enter_dungeon_hook(const char *fmt)
{
s32b d_idx = get_next_arg(fmt);
quest_god_dungeon_setup(d_idx);
return FALSE;
}
-static bool_ quest_god_gen_level_begin_hook(char *fmt)
+static bool_ quest_god_gen_level_begin_hook(const char *fmt)
{
quest_god_dungeon_setup(dungeon_type);
return FALSE;
}
-static bool_ quest_god_stair_hook(char *fmt)
+static bool_ quest_god_stair_hook(const char *fmt)
{
quest_god_dungeon_setup(dungeon_type);
return FALSE;
}
-static bool_ quest_god_birth_objects_hook(char *fmt)
+static bool_ quest_god_birth_objects_hook(const char *fmt)
{
cquest_quests_given = 0;
cquest_relics_found = 0;
diff --git a/src/q_haunted.c b/src/q_haunted.c
index efd5a47c..83f97cb2 100644
--- a/src/q_haunted.c
+++ b/src/q_haunted.c
@@ -1,8 +1,9 @@
#include "q_haunted.h"
+#include "hooks.h"
#define cquest (quest[QUEST_HAUNTED])
-bool_ quest_haunted_gen_hook(char *fmt)
+static bool_ quest_haunted_gen_hook(const char *fmt)
{
int x, y, i, m_idx;
int xstart = 2;
@@ -87,7 +88,7 @@ bool_ quest_haunted_gen_hook(char *fmt)
return TRUE;
}
-bool_ quest_haunted_death_hook(char *fmt)
+static bool_ quest_haunted_death_hook(const char *fmt)
{
int i, mcnt = 0;
@@ -119,7 +120,7 @@ bool_ quest_haunted_death_hook(char *fmt)
return FALSE;
}
-bool_ quest_haunted_finish_hook(char *fmt)
+static bool_ quest_haunted_finish_hook(const char *fmt)
{
s32b q_idx;
diff --git a/src/q_hobbit.c b/src/q_hobbit.c
index fd15a94a..a6a1f140 100644
--- a/src/q_hobbit.c
+++ b/src/q_hobbit.c
@@ -1,9 +1,10 @@
#include "q_hobbit.h"
#include "messages.h"
+#include "hooks.h"
#define cquest (quest[QUEST_HOBBIT])
-bool_ quest_hobbit_town_gen_hook(char *fmt)
+static bool_ quest_hobbit_town_gen_hook(const char *fmt)
{
int x = 1, y = 1, tries = 10000;
s32b small;
@@ -35,7 +36,8 @@ bool_ quest_hobbit_town_gen_hook(char *fmt)
return FALSE;
}
-bool_ quest_hobbit_gen_hook(char *fmt)
+
+static bool_ quest_hobbit_gen_hook(const char *fmt)
{
int x = 1, y = 1, tries = 10000;
@@ -62,7 +64,8 @@ bool_ quest_hobbit_gen_hook(char *fmt)
return FALSE;
}
-bool_ quest_hobbit_give_hook(char *fmt)
+
+static bool_ quest_hobbit_give_hook(const char *fmt)
{
object_type *o_ptr;
monster_type *m_ptr;
@@ -92,7 +95,8 @@ bool_ quest_hobbit_give_hook(char *fmt)
return TRUE;
}
-bool_ quest_hobbit_speak_hook(char *fmt)
+
+static bool_ quest_hobbit_speak_hook(const char *fmt)
{
s32b m_idx = get_next_arg(fmt);
@@ -108,7 +112,8 @@ bool_ quest_hobbit_speak_hook(char *fmt)
}
return (TRUE);
}
-bool_ quest_hobbit_chat_hook(char *fmt)
+
+static bool_ quest_hobbit_chat_hook(const char *fmt)
{
monster_type *m_ptr;
s32b m_idx;
@@ -160,7 +165,8 @@ bool_ quest_hobbit_chat_hook(char *fmt)
return TRUE;
}
-bool_ quest_hobbit_dump_hook(char *fmt)
+
+static bool_ quest_hobbit_dump_hook(const char *fmt)
{
if (cquest.status >= QUEST_STATUS_COMPLETED)
{
@@ -168,6 +174,7 @@ bool_ quest_hobbit_dump_hook(char *fmt)
}
return (FALSE);
}
+
bool_ quest_hobbit_init_hook(int q_idx)
{
/* Get a level to place the hobbit */
diff --git a/src/q_invas.c b/src/q_invas.c
index 5a52457f..10cb5dc6 100644
--- a/src/q_invas.c
+++ b/src/q_invas.c
@@ -1,8 +1,9 @@
#include "q_invas.h"
+#include "hooks.h"
#define cquest (quest[QUEST_INVASION])
-bool_ quest_invasion_gen_hook(char *fmt)
+static bool_ quest_invasion_gen_hook(const char *fmt)
{
int x, y;
int xstart = 2;
@@ -44,7 +45,8 @@ bool_ quest_invasion_gen_hook(char *fmt)
return TRUE;
}
-bool_ quest_invasion_ai_hook(char *fmt)
+
+static bool_ quest_invasion_ai_hook(const char *fmt)
{
monster_type *m_ptr;
s32b m_idx;
@@ -83,7 +85,8 @@ bool_ quest_invasion_ai_hook(char *fmt)
return (FALSE);
}
-bool_ quest_invasion_turn_hook(char *fmt)
+
+static bool_ quest_invasion_turn_hook(const char *fmt)
{
if (cquest.status != QUEST_STATUS_UNTAKEN) return (FALSE);
if (p_ptr->lev < 45) return (FALSE);
@@ -107,7 +110,8 @@ bool_ quest_invasion_turn_hook(char *fmt)
process_hooks_restart = TRUE;
return (FALSE);
}
-bool_ quest_invasion_dump_hook(char *fmt)
+
+static bool_ quest_invasion_dump_hook(const char *fmt)
{
if (cquest.status == QUEST_STATUS_FAILED)
{
@@ -119,7 +123,8 @@ bool_ quest_invasion_dump_hook(char *fmt)
}
return (FALSE);
}
-bool_ quest_invasion_death_hook(char *fmt)
+
+static bool_ quest_invasion_death_hook(const char *fmt)
{
s32b r_idx, m_idx;
@@ -139,7 +144,8 @@ bool_ quest_invasion_death_hook(char *fmt)
return FALSE;
}
-bool_ quest_invasion_stair_hook(char *fmt)
+
+static bool_ quest_invasion_stair_hook(const char *fmt)
{
cptr down;
@@ -182,6 +188,7 @@ bool_ quest_invasion_stair_hook(char *fmt)
return TRUE;
}
+
bool_ quest_invasion_init_hook(int q_idx)
{
add_hook(HOOK_END_TURN, quest_invasion_turn_hook, "invasion_turn");
diff --git a/src/q_library.c b/src/q_library.c
index 6e412719..36d2cd0b 100644
--- a/src/q_library.c
+++ b/src/q_library.c
@@ -1,5 +1,6 @@
#include "q_library.h"
#include "quark.h"
+#include "hooks.h"
#define cquest (quest[QUEST_LIBRARY])
@@ -375,7 +376,7 @@ static bool_ quest_library_stair_hook()
}
}
-static bool_ quest_library_monster_death_hook(char *fmt)
+static bool_ quest_library_monster_death_hook(const char *fmt)
{
int i, count = -1;
diff --git a/src/q_library.h b/src/q_library.h
index 24504282..0ba02970 100644
--- a/src/q_library.h
+++ b/src/q_library.h
@@ -9,6 +9,7 @@ extern "C" {
bool_ quest_library_init_hook(int q);
bool_ quest_library_describe(FILE *fff);
void quest_library_building(bool_ *paid, bool_ *recreate);
+void initialize_bookable_spells();
#ifdef __cplusplus
} // extern "C"
diff --git a/src/q_main.c b/src/q_main.c
index 4eef2298..f0e6214e 100644
--- a/src/q_main.c
+++ b/src/q_main.c
@@ -1,4 +1,5 @@
#include "q_main.h"
+#include "hooks.h"
static void quest_describe(int q_idx)
{
@@ -10,7 +11,7 @@ static void quest_describe(int q_idx)
}
}
-bool_ quest_main_monsters_hook(char *fmt)
+static bool_ quest_main_monsters_hook(const char *fmt)
{
s32b r_idx;
r_idx = get_next_arg(fmt);
@@ -29,7 +30,8 @@ bool_ quest_main_monsters_hook(char *fmt)
}
return FALSE;
}
-bool_ quest_morgoth_hook(char *fmt)
+
+static bool_ quest_morgoth_hook(const char *fmt)
{
/* Using test_monster_name() here would be a lot less ugly, but would take much more time */
monster_race *r_ptr = &r_info[862];
@@ -79,7 +81,8 @@ bool_ quest_morgoth_hook(char *fmt)
}
return (FALSE);
}
-bool_ quest_morgoth_dump_hook(char *fmt)
+
+static bool_ quest_morgoth_dump_hook(const char *fmt)
{
if (quest[QUEST_MORGOTH].status >= QUEST_STATUS_COMPLETED)
{
@@ -90,6 +93,7 @@ bool_ quest_morgoth_dump_hook(char *fmt)
}
return (FALSE);
}
+
bool_ quest_morgoth_init_hook(int q_idx)
{
if ((quest[QUEST_MORGOTH].status >= QUEST_STATUS_TAKEN) && (quest[QUEST_MORGOTH].status < QUEST_STATUS_FINISHED))
@@ -101,7 +105,7 @@ bool_ quest_morgoth_init_hook(int q_idx)
return (FALSE);
}
-bool_ quest_sauron_hook(char *fmt)
+static bool_ quest_sauron_hook(const char *fmt)
{
/* Using test_monster_name() here would be a lot less ugly, but would take much more time */
monster_race *r_ptr = &r_info[860];
@@ -125,7 +129,7 @@ bool_ quest_sauron_hook(char *fmt)
return (FALSE);
}
-bool_ quest_sauron_resurect_hook(char *fmt)
+static bool_ quest_sauron_resurect_hook(const char *fmt)
{
s32b m_idx = get_next_arg(fmt);
monster_type *m_ptr = &m_list[m_idx];
@@ -155,7 +159,7 @@ bool_ quest_sauron_init_hook(int q_idx)
return (FALSE);
}
-bool_ quest_necro_hook(char *fmt)
+static bool_ quest_necro_hook(const char *fmt)
{
/* Using test_monster_name() here would be a lot less ugly, but would take much more time */
monster_race *r_ptr = &r_info[819];
@@ -177,6 +181,7 @@ bool_ quest_necro_hook(char *fmt)
}
return (FALSE);
}
+
bool_ quest_necro_init_hook(int q_idx)
{
if ((quest[QUEST_NECRO].status >= QUEST_STATUS_TAKEN) && (quest[QUEST_NECRO].status < QUEST_STATUS_FINISHED))
diff --git a/src/q_narsil.c b/src/q_narsil.c
index 3fe8b19f..521e344b 100644
--- a/src/q_narsil.c
+++ b/src/q_narsil.c
@@ -1,9 +1,9 @@
#include "q_narsil.h"
-
+#include "hooks.h"
#define cquest (quest[QUEST_NARSIL])
-bool_ quest_narsil_move_hook(char *fmt)
+static bool_ quest_narsil_move_hook(const char *fmt)
{
s32b y, x;
cave_type *c_ptr;
@@ -58,7 +58,8 @@ bool_ quest_narsil_move_hook(char *fmt)
return TRUE;
}
-bool_ quest_narsil_dump_hook(char *fmt)
+
+static bool_ quest_narsil_dump_hook(const char *fmt)
{
if (cquest.status >= QUEST_STATUS_COMPLETED)
{
@@ -66,7 +67,8 @@ bool_ quest_narsil_dump_hook(char *fmt)
}
return (FALSE);
}
-bool_ quest_narsil_identify_hook(char *fmt)
+
+static bool_ quest_narsil_identify_hook(const char *fmt)
{
if (cquest.status == QUEST_STATUS_UNTAKEN)
{
@@ -98,6 +100,7 @@ bool_ quest_narsil_identify_hook(char *fmt)
return (FALSE);
}
+
bool_ quest_narsil_init_hook(int q_idx)
{
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
diff --git a/src/q_nazgul.c b/src/q_nazgul.c
index b386b70f..5573b40b 100644
--- a/src/q_nazgul.c
+++ b/src/q_nazgul.c
@@ -1,8 +1,9 @@
#include "q_nazgul.h"
+#include "hooks.h"
#define cquest (quest[QUEST_NAZGUL])
-bool_ quest_nazgul_gen_hook(char *fmt)
+static bool_ quest_nazgul_gen_hook(const char *fmt)
{
int m_idx, x = 1, y = 1, tries = 10000;
s32b small;
@@ -34,7 +35,8 @@ bool_ quest_nazgul_gen_hook(char *fmt)
return FALSE;
}
-bool_ quest_nazgul_finish_hook(char *fmt)
+
+static bool_ quest_nazgul_finish_hook(const char *fmt)
{
object_type forge, *q_ptr;
s32b q_idx;
@@ -64,7 +66,8 @@ bool_ quest_nazgul_finish_hook(char *fmt)
return TRUE;
}
-bool_ quest_nazgul_dump_hook(char *fmt)
+
+static bool_ quest_nazgul_dump_hook(const char *fmt)
{
if (cquest.status >= QUEST_STATUS_COMPLETED)
{
@@ -72,7 +75,8 @@ bool_ quest_nazgul_dump_hook(char *fmt)
}
return (FALSE);
}
-bool_ quest_nazgul_forbid_hook(char *fmt)
+
+static bool_ quest_nazgul_forbid_hook(const char *fmt)
{
s32b q_idx;
q_idx = get_next_arg(fmt);
@@ -86,7 +90,8 @@ bool_ quest_nazgul_forbid_hook(char *fmt)
}
return (FALSE);
}
-bool_ quest_nazgul_death_hook(char *fmt)
+
+static bool_ quest_nazgul_death_hook(const char *fmt)
{
s32b r_idx, m_idx;
@@ -103,6 +108,7 @@ bool_ quest_nazgul_death_hook(char *fmt)
return (FALSE);
}
+
bool_ quest_nazgul_init_hook(int q_idx)
{
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
diff --git a/src/q_nirna.c b/src/q_nirna.c
index 07991487..d9e178c3 100644
--- a/src/q_nirna.c
+++ b/src/q_nirna.c
@@ -1,8 +1,9 @@
#include "q_nirna.h"
+#include "hooks.h"
#define cquest (quest[QUEST_NIRNAETH])
-bool_ quest_nirnaeth_gen_hook(char *fmt)
+static bool_ quest_nirnaeth_gen_hook(const char *fmt)
{
int x, y;
int xstart = 2;
@@ -40,7 +41,8 @@ bool_ quest_nirnaeth_gen_hook(char *fmt)
return TRUE;
}
-bool_ quest_nirnaeth_finish_hook(char *fmt)
+
+static bool_ quest_nirnaeth_finish_hook(const char *fmt)
{
s32b q_idx;
@@ -77,7 +79,8 @@ bool_ quest_nirnaeth_finish_hook(char *fmt)
return TRUE;
}
-bool_ quest_nirnaeth_death_hook(char *fmt)
+
+static bool_ quest_nirnaeth_death_hook(const char *fmt)
{
if (p_ptr->inside_quest != QUEST_NIRNAETH) return FALSE;
@@ -85,7 +88,8 @@ bool_ quest_nirnaeth_death_hook(char *fmt)
return FALSE;
}
-bool_ quest_nirnaeth_stair_hook(char *fmt)
+
+static bool_ quest_nirnaeth_stair_hook(const char *fmt)
{
if (p_ptr->inside_quest != QUEST_NIRNAETH) return FALSE;
@@ -97,6 +101,7 @@ bool_ quest_nirnaeth_stair_hook(char *fmt)
process_hooks_restart = TRUE;
return (FALSE);
}
+
bool_ quest_nirnaeth_init_hook(int q_idx)
{
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
diff --git a/src/q_one.c b/src/q_one.c
index f9c71a91..de80afad 100644
--- a/src/q_one.c
+++ b/src/q_one.c
@@ -1,8 +1,9 @@
#include "q_one.h"
+#include "hooks.h"
#define cquest (quest[QUEST_ONE])
-bool_ quest_one_move_hook(char *fmt)
+static bool_ quest_one_move_hook(const char *fmt)
{
s32b y, x;
cave_type *c_ptr;
@@ -67,7 +68,8 @@ bool_ quest_one_move_hook(char *fmt)
return FALSE;
}
-bool_ quest_one_drop_hook(char *fmt)
+
+static bool_ quest_one_drop_hook(const char *fmt)
{
s32b o_idx;
object_type *o_ptr;
@@ -97,7 +99,8 @@ bool_ quest_one_drop_hook(char *fmt)
return TRUE;
}
-bool_ quest_one_wield_hook(char *fmt)
+
+static bool_ quest_one_wield_hook(const char *fmt)
{
s32b o_idx;
object_type *o_ptr;
@@ -154,7 +157,8 @@ bool_ quest_one_wield_hook(char *fmt)
return FALSE;
}
-bool_ quest_one_hp_hook(char *fmt)
+
+static bool_ quest_one_hp_hook(const char *fmt)
{
if (cquest.status == QUEST_STATUS_FAILED_DONE)
{
@@ -171,7 +175,8 @@ bool_ quest_one_hp_hook(char *fmt)
}
return (FALSE);
}
-bool_ quest_one_die_hook(char *fmt)
+
+static bool_ quest_one_die_hook(const char *fmt)
{
if (cquest.status == QUEST_STATUS_FAILED_DONE)
{
@@ -190,7 +195,8 @@ bool_ quest_one_die_hook(char *fmt)
}
return (FALSE);
}
-bool_ quest_one_identify_hook(char *fmt)
+
+static bool_ quest_one_identify_hook(const char *fmt)
{
s32b item;
@@ -212,7 +218,8 @@ bool_ quest_one_identify_hook(char *fmt)
return (FALSE);
}
-bool_ quest_one_death_hook(char *fmt)
+
+static bool_ quest_one_death_hook(const char *fmt)
{
s32b r_idx, m_idx;
bool_ ok = FALSE;
@@ -292,7 +299,8 @@ bool_ quest_one_death_hook(char *fmt)
return (FALSE);
}
-bool_ quest_one_dump_hook(char *fmt)
+
+static bool_ quest_one_dump_hook(const char *fmt)
{
if (cquest.status == QUEST_STATUS_FINISHED)
{
@@ -304,7 +312,8 @@ bool_ quest_one_dump_hook(char *fmt)
}
return (FALSE);
}
-bool_ quest_one_gen_hook(char *fmt)
+
+static bool_ quest_one_gen_hook(const char *fmt)
{
s32b x, y, tries = 10000;
@@ -334,6 +343,7 @@ bool_ quest_one_gen_hook(char *fmt)
return (FALSE);
}
+
bool_ quest_one_init_hook(int q_idx)
{
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
diff --git a/src/q_poison.c b/src/q_poison.c
index 152b7d59..a63dca96 100644
--- a/src/q_poison.c
+++ b/src/q_poison.c
@@ -1,6 +1,7 @@
#include "q_poison.h"
#include "quark.h"
#include "messages.h"
+#include "hooks.h"
#define cquest (quest[QUEST_POISON])
@@ -24,7 +25,7 @@ static bool_ create_molds_hook(int r_idx)
else return FALSE;
}
-bool_ quest_poison_gen_hook(char *fmt)
+static bool_ quest_poison_gen_hook(const char *fmt)
{
int cy = 1, cx = 1, x, y, tries = 10000, r_idx;
bool_ (*old_get_mon_num_hook)(int r_idx);
@@ -101,7 +102,8 @@ bool_ quest_poison_gen_hook(char *fmt)
return FALSE;
}
-bool_ quest_poison_finish_hook(char *fmt)
+
+static bool_ quest_poison_finish_hook(const char *fmt)
{
object_type forge, *q_ptr;
s32b q_idx;
@@ -132,7 +134,8 @@ bool_ quest_poison_finish_hook(char *fmt)
return TRUE;
}
-bool_ quest_poison_dump_hook(char *fmt)
+
+static bool_ quest_poison_dump_hook(const char *fmt)
{
if (cquest.status >= QUEST_STATUS_COMPLETED)
{
@@ -140,7 +143,8 @@ bool_ quest_poison_dump_hook(char *fmt)
}
return (FALSE);
}
-bool_ quest_poison_quest_hook(char *fmt)
+
+static bool_ quest_poison_quest_hook(const char *fmt)
{
object_type forge, *q_ptr;
s32b q_idx;
@@ -163,7 +167,8 @@ bool_ quest_poison_quest_hook(char *fmt)
return FALSE;
}
-bool_ quest_poison_drop_hook(char *fmt)
+
+static bool_ quest_poison_drop_hook(const char *fmt)
{
s32b mcnt = 0, i, x, y, o_idx;
object_type *o_ptr;
@@ -216,6 +221,7 @@ bool_ quest_poison_drop_hook(char *fmt)
}
return FALSE;
}
+
bool_ quest_poison_init_hook(int q_idx)
{
/* Get a place to place the poison */
diff --git a/src/q_rand.c b/src/q_rand.c
index 998379e2..4296d85d 100644
--- a/src/q_rand.c
+++ b/src/q_rand.c
@@ -1,4 +1,5 @@
#include "q_rand.h"
+#include "hooks.h"
static int randquest_hero[] = { 20, 13, 15, 16, 9, 17, 18, 8, -1 };
@@ -215,7 +216,7 @@ static void hero_death(s32b m_idx, s32b r_idx)
}
}
-static bool_ quest_random_death_hook(char *fmt)
+static bool_ quest_random_death_hook(const char *fmt)
{
int r_idx;
s32b m_idx;
@@ -245,14 +246,14 @@ static bool_ quest_random_death_hook(char *fmt)
return (FALSE);
}
-static bool_ quest_random_turn_hook(char *fmt)
+static bool_ quest_random_turn_hook(const char *fmt)
{
quest[QUEST_RANDOM].data[0] = 0;
quest[QUEST_RANDOM].data[1] = 0;
return (FALSE);
}
-static bool_ quest_random_feeling_hook(char *fmt)
+static bool_ quest_random_feeling_hook(const char *fmt)
{
if (!(dungeon_flags1 & DF1_PRINCIPAL)) return (FALSE);
if ((dun_level < 1) || (dun_level >= MAX_RANDOM_QUEST)) return (FALSE);
@@ -271,7 +272,7 @@ static bool_ quest_random_feeling_hook(char *fmt)
return (FALSE);
}
-static bool_ quest_random_gen_hero_hook(char *fmt)
+static bool_ quest_random_gen_hero_hook(const char *fmt)
{
int i;
@@ -302,7 +303,7 @@ static bool_ quest_random_gen_hero_hook(char *fmt)
return (FALSE);
}
-static bool_ quest_random_gen_hook(char *fmt)
+static bool_ quest_random_gen_hook(const char *fmt)
{
s32b x, y, bx0, by0;
int xstart;
@@ -385,7 +386,7 @@ static bool_ quest_random_gen_hook(char *fmt)
return (TRUE);
}
-static bool_ quest_random_dump_hook(char *fmt)
+static bool_ quest_random_dump_hook(const char *fmt)
{
static char *number[] =
{ "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" };
diff --git a/src/q_rand.h b/src/q_rand.h
index ea88b56c..6d4e5eba 100644
--- a/src/q_rand.h
+++ b/src/q_rand.h
@@ -6,6 +6,7 @@
extern "C" {
#endif
+void initialize_random_quests(int n);
bool_ is_randhero(int level);
bool_ quest_random_init_hook(int q_idx);
bool_ quest_random_describe(FILE *fff);
diff --git a/src/q_shroom.c b/src/q_shroom.c
index 96e1ac81..d402c818 100644
--- a/src/q_shroom.c
+++ b/src/q_shroom.c
@@ -1,11 +1,12 @@
#include "q_shroom.h"
#include "messages.h"
+#include "hooks.h"
#define cquest (quest[QUEST_SHROOM])
-bool_ quest_shroom_speak_hook(char *fmt);
+static bool_ quest_shroom_speak_hook(const char *fmt);
-bool_ quest_shroom_town_gen_hook(char *fmt)
+static bool_ quest_shroom_town_gen_hook(const char *fmt)
{
int m_idx, x = 1, y = 1, tries = 10000;
s32b small;
@@ -83,7 +84,8 @@ bool_ quest_shroom_town_gen_hook(char *fmt)
return FALSE;
}
-bool_ quest_shroom_death_hook(char *fmt)
+
+static bool_ quest_shroom_death_hook(const char *fmt)
{
s32b r_idx, m_idx;
@@ -101,7 +103,8 @@ bool_ quest_shroom_death_hook(char *fmt)
return FALSE;
}
-bool_ quest_shroom_give_hook(char *fmt)
+
+static bool_ quest_shroom_give_hook(const char *fmt)
{
object_type *o_ptr;
monster_type *m_ptr;
@@ -185,7 +188,8 @@ bool_ quest_shroom_give_hook(char *fmt)
return TRUE;
}
-bool_ quest_shroom_speak_hook(char *fmt)
+
+static bool_ quest_shroom_speak_hook(const char *fmt)
{
s32b m_idx = get_next_arg(fmt);
@@ -222,7 +226,8 @@ bool_ quest_shroom_speak_hook(char *fmt)
}
return (TRUE);
}
-bool_ quest_shroom_chat_hook(char *fmt)
+
+static bool_ quest_shroom_chat_hook(const char *fmt)
{
monster_type *m_ptr;
s32b m_idx;
@@ -267,6 +272,7 @@ bool_ quest_shroom_chat_hook(char *fmt)
return TRUE;
}
+
bool_ quest_shroom_init_hook(int q_idx)
{
/* Get a number of 'shrooms */
diff --git a/src/q_spider.c b/src/q_spider.c
index b8731a33..03305f59 100644
--- a/src/q_spider.c
+++ b/src/q_spider.c
@@ -1,8 +1,9 @@
#include "q_spider.h"
+#include "hooks.h"
#define cquest (quest[QUEST_SPIDER])
-bool_ quest_spider_gen_hook(char *fmt)
+static bool_ quest_spider_gen_hook(const char *fmt)
{
int x, y;
int xstart = 2;
@@ -31,7 +32,8 @@ bool_ quest_spider_gen_hook(char *fmt)
return TRUE;
}
-bool_ quest_spider_death_hook(char *fmt)
+
+static bool_ quest_spider_death_hook(const char *fmt)
{
int i, mcnt = 0;
@@ -67,7 +69,8 @@ bool_ quest_spider_death_hook(char *fmt)
return (FALSE);
}
-bool_ quest_spider_finish_hook(char *fmt)
+
+static bool_ quest_spider_finish_hook(const char *fmt)
{
object_type forge, *q_ptr;
s32b q_idx;
@@ -97,6 +100,7 @@ bool_ quest_spider_finish_hook(char *fmt)
return TRUE;
}
+
bool_ quest_spider_init_hook(int q_idx)
{
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
diff --git a/src/q_thief.c b/src/q_thief.c
index b341c572..912309a9 100644
--- a/src/q_thief.c
+++ b/src/q_thief.c
@@ -1,8 +1,9 @@
#include "q_thief.h"
+#include "hooks.h"
#define cquest (quest[QUEST_THIEVES])
-bool_ quest_thieves_gen_hook(char *fmt)
+static bool_ quest_thieves_gen_hook(const char *fmt)
{
int x, y;
int xstart = 2;
@@ -62,7 +63,8 @@ bool_ quest_thieves_gen_hook(char *fmt)
return TRUE;
}
-bool_ quest_thieves_hook(char *fmt)
+
+static bool_ quest_thieves_hook(const char *fmt)
{
int i, mcnt = 0;
@@ -114,7 +116,8 @@ bool_ quest_thieves_hook(char *fmt)
}
return FALSE;
}
-bool_ quest_thieves_finish_hook(char *fmt)
+
+static bool_ quest_thieves_finish_hook(const char *fmt)
{
s32b q_idx;
@@ -147,7 +150,7 @@ bool_ quest_thieves_finish_hook(char *fmt)
return TRUE;
}
-bool_ quest_thieves_feeling_hook(char *fmt)
+static bool_ quest_thieves_feeling_hook(const char *fmt)
{
if (p_ptr->inside_quest != QUEST_THIEVES) return FALSE;
diff --git a/src/q_thrain.c b/src/q_thrain.c
index 1b505a20..c22b39e9 100644
--- a/src/q_thrain.c
+++ b/src/q_thrain.c
@@ -1,10 +1,11 @@
#include "q_thrain.h"
#include "quark.h"
#include "messages.h"
+#include "hooks.h"
#define cquest (quest[QUEST_THRAIN])
-bool_ quest_thrain_death_hook(char *fmt)
+static bool_ quest_thrain_death_hook(const char *fmt)
{
s32b m_idx;
int r, x, y;
@@ -90,7 +91,7 @@ bool_ quest_thrain_death_hook(char *fmt)
return (FALSE);
}
-bool_ quest_thrain_gen_hook(char *fmt)
+static bool_ quest_thrain_gen_hook(const char *fmt)
{
s32b x, y, bx0, by0;
int xstart;
@@ -161,7 +162,8 @@ bool_ quest_thrain_gen_hook(char *fmt)
return (TRUE);
}
-bool_ quest_thrain_feeling_hook(char *fmt)
+
+static bool_ quest_thrain_feeling_hook(const char *fmt)
{
if (dungeon_type != DUNGEON_DOL_GULDUR) return (FALSE);
if (cquest.data[0] != dun_level) return (FALSE);
@@ -173,7 +175,8 @@ bool_ quest_thrain_feeling_hook(char *fmt)
return (FALSE);
}
-bool_ quest_thrain_move_hook(char *fmt)
+
+static bool_ quest_thrain_move_hook(const char *fmt)
{
s32b y;
s32b x;
@@ -204,12 +207,14 @@ bool_ quest_thrain_move_hook(char *fmt)
return (FALSE);
}
-bool_ quest_thrain_turn_hook(char *fmt)
+
+static bool_ quest_thrain_turn_hook(const char *fmt)
{
cquest.data[1] = 0;
cquest.data[2] = 0;
return (FALSE);
}
+
bool_ quest_thrain_init_hook(int q)
{
if (!cquest.data[0])
diff --git a/src/q_troll.c b/src/q_troll.c
index b3875418..4a38f2d0 100644
--- a/src/q_troll.c
+++ b/src/q_troll.c
@@ -1,8 +1,9 @@
#include "q_troll.h"
+#include "hooks.h"
#define cquest (quest[QUEST_TROLL])
-bool_ quest_troll_gen_hook(char *fmt)
+static bool_ quest_troll_gen_hook(const char *fmt)
{
int x, y;
int xstart = 2;
@@ -94,7 +95,8 @@ bool_ quest_troll_gen_hook(char *fmt)
cquest.data[0] = FALSE;
return TRUE;
}
-bool_ quest_troll_finish_hook(char *fmt)
+
+static bool_ quest_troll_finish_hook(const char *fmt)
{
s32b q_idx;
@@ -114,7 +116,8 @@ bool_ quest_troll_finish_hook(char *fmt)
return TRUE;
}
-bool_ quest_troll_death_hook(char *fmt)
+
+static bool_ quest_troll_death_hook(const char *fmt)
{
int x, y, xstart = 2, ystart = 2;
s32b r_idx, m_idx;
@@ -167,6 +170,7 @@ bool_ quest_troll_death_hook(char *fmt)
return FALSE;
}
+
bool_ quest_troll_init_hook(int q_idx)
{
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
diff --git a/src/q_ultrag.c b/src/q_ultrag.c
index a5d28369..0eb50d15 100644
--- a/src/q_ultrag.c
+++ b/src/q_ultrag.c
@@ -1,8 +1,9 @@
#include "q_ultrag.h"
+#include "hooks.h"
#define cquest (quest[QUEST_ULTRA_GOOD])
-bool_ quest_ultra_good_move_hook(char *fmt)
+static bool_ quest_ultra_good_move_hook(const char *fmt)
{
s32b y, x;
cave_type *c_ptr;
@@ -74,7 +75,7 @@ bool_ quest_ultra_good_move_hook(char *fmt)
return FALSE;
}
-bool_ quest_ultra_good_stair_hook(char *fmt)
+static bool_ quest_ultra_good_stair_hook(const char *fmt)
{
cptr dir;
@@ -137,7 +138,7 @@ bool_ quest_ultra_good_stair_hook(char *fmt)
return FALSE;
}
-bool_ quest_ultra_good_recall_hook(char *fmt)
+static bool_ quest_ultra_good_recall_hook(const char *fmt)
{
if ((dungeon_type != DUNGEON_VOID) && (dungeon_type != DUNGEON_NETHER_REALM))
return FALSE;
@@ -146,7 +147,7 @@ bool_ quest_ultra_good_recall_hook(char *fmt)
return TRUE;
}
-bool_ quest_ultra_good_death_hook(char *fmt)
+static bool_ quest_ultra_good_death_hook(const char *fmt)
{
s32b m_idx = get_next_arg(fmt);
@@ -232,7 +233,8 @@ bool_ quest_ultra_good_death_hook(char *fmt)
}
return (FALSE);
}
-bool_ quest_ultra_good_dump_hook(char *fmt)
+
+static bool_ quest_ultra_good_dump_hook(const char *fmt)
{
if (quest[QUEST_ULTRA_GOOD].status >= QUEST_STATUS_TAKEN)
{
diff --git a/src/q_wight.c b/src/q_wight.c
index 4be72fc2..ce4c5ac4 100644
--- a/src/q_wight.c
+++ b/src/q_wight.c
@@ -1,9 +1,10 @@
#include "q_wight.h"
#include "quark.h"
+#include "hooks.h"
#define cquest (quest[QUEST_WIGHT])
-bool_ quest_wight_gen_hook(char *fmt)
+static bool_ quest_wight_gen_hook(const char *fmt)
{
int x, y;
int xstart = 2;
@@ -103,7 +104,8 @@ bool_ quest_wight_gen_hook(char *fmt)
return TRUE;
}
-bool_ quest_wight_death_hook(char *fmt)
+
+static bool_ quest_wight_death_hook(const char *fmt)
{
s32b r_idx, m_idx;
@@ -127,7 +129,8 @@ bool_ quest_wight_death_hook(char *fmt)
return (FALSE);
}
-bool_ quest_wight_finish_hook(char *fmt)
+
+static bool_ quest_wight_finish_hook(const char *fmt)
{
s32b q_idx;
q_idx = get_next_arg(fmt);
@@ -146,6 +149,7 @@ bool_ quest_wight_finish_hook(char *fmt)
return TRUE;
}
+
bool_ quest_wight_init_hook(int q_idx)
{
if ((cquest.status >= QUEST_STATUS_TAKEN) && (cquest.status < QUEST_STATUS_FINISHED))
diff --git a/src/q_wolves.c b/src/q_wolves.c
index badbd319..5da28ee7 100644
--- a/src/q_wolves.c
+++ b/src/q_wolves.c
@@ -1,8 +1,9 @@
#include "q_wolves.h"
+#include "hooks.h"
#define cquest (quest[QUEST_WOLVES])
-bool_ quest_wolves_gen_hook(char *fmt)
+static bool_ quest_wolves_gen_hook(const char *fmt)
{
int x, y, i;
int xstart = 2;
@@ -70,7 +71,7 @@ bool_ quest_wolves_gen_hook(char *fmt)
return TRUE;
}
-bool_ quest_wolves_death_hook(char *fmt)
+static bool_ quest_wolves_death_hook(const char *fmt)
{
int i, mcnt = 0;
@@ -102,7 +103,7 @@ bool_ quest_wolves_death_hook(char *fmt)
return FALSE;
}
-bool_ quest_wolves_finish_hook(char *fmt)
+static bool_ quest_wolves_finish_hook(const char *fmt)
{
s32b q_idx;
diff --git a/src/script.c b/src/script.c
index 40f43f95..a9407352 100644
--- a/src/script.c
+++ b/src/script.c
@@ -11,6 +11,7 @@
*/
#include "angband.h"
+#include "q_library.h"
void init_lua_init()
diff --git a/src/skills.c b/src/skills.c
index 4df3c1b3..12d5da56 100644
--- a/src/skills.c
+++ b/src/skills.c
@@ -13,6 +13,7 @@
#include "angband.h"
#include <math.h>
+#include "hooks.h"
/*
* Advance the skill point of the skill specified by i and
diff --git a/src/spells2.c b/src/spells2.c
index 8778e49f..3e3ac568 100644
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -11,6 +11,7 @@
*/
#include "angband.h"
+#include "hooks.h"
#define WEIRD_LUCK 12
#define BIAS_LUCK 20
diff --git a/src/store.c b/src/store.c
index ff5e89dc..fb413eb8 100644
--- a/src/store.c
+++ b/src/store.c
@@ -14,6 +14,7 @@
#include "spell_type.h"
#include "quark.h"
+#include "hooks.h"
#define STORE_GENERAL_STORE "General Store"
#define STORE_ARMOURY "Armoury"
diff --git a/src/tables.c b/src/tables.c
index 33330e80..20d24966 100644
--- a/src/tables.c
+++ b/src/tables.c
@@ -3493,7 +3493,7 @@ quest_type quest[MAX_Q_IDX] =
0,
NULL,
- quest_null_hook,
+ NULL,
{0, 0},
NULL,
},
diff --git a/src/types.h b/src/types.h
index 92aa428b..b9529436 100644
--- a/src/types.h
+++ b/src/types.h
@@ -2226,7 +2226,7 @@ struct power_type
};
/* Hooks */
-typedef bool_ (*hook_type)(char *fmt);
+typedef bool_ (*hook_type)(const char *fmt);
typedef struct hook_move_in hook_move_in;
struct hook_move_in {
diff --git a/src/wild.c b/src/wild.c
index 279b79d9..76ad3136 100644
--- a/src/wild.c
+++ b/src/wild.c
@@ -11,6 +11,7 @@
*/
#include "angband.h"
+#include "hooks.h"
diff --git a/src/wizard2.c b/src/wizard2.c
index 66ddaa38..eb391437 100644
--- a/src/wizard2.c
+++ b/src/wizard2.c
@@ -11,6 +11,7 @@
*/
#include "angband.h"
+#include "hooks.h"
void do_cmd_wizard_body(s16b);
extern void status_main(void);
diff --git a/src/xtra1.c b/src/xtra1.c
index 638a2102..821fe508 100644
--- a/src/xtra1.c
+++ b/src/xtra1.c
@@ -13,6 +13,7 @@
#include "angband.h"
#include "messages.h"
+#include "hooks.h"
/*
* Converts stat num into a six-char (right justified) string
diff --git a/src/xtra2.c b/src/xtra2.c
index f437c6d1..84f3b540 100644
--- a/src/xtra2.c
+++ b/src/xtra2.c
@@ -16,6 +16,7 @@
#include <assert.h>
#include "quark.h"
+#include "hooks.h"
/*
* Invoke The Rush