summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/q_narsil.cc23
-rw-r--r--src/q_one.cc13
-rw-r--r--src/spells2.cc8
3 files changed, 16 insertions, 28 deletions
diff --git a/src/q_narsil.cc b/src/q_narsil.cc
index e050a551..cd0e5b4b 100644
--- a/src/q_narsil.cc
+++ b/src/q_narsil.cc
@@ -69,23 +69,17 @@ static bool_ quest_narsil_dump_hook(void *, void *in_, void *)
return (FALSE);
}
-static bool_ quest_narsil_identify_hook(const char *fmt)
+static bool_ quest_narsil_identify_hook(void *, void *in_, void *)
{
+ struct hook_identify_in *in = static_cast<struct hook_identify_in *>(in_);
+
if (cquest.status == QUEST_STATUS_UNTAKEN)
{
- int i;
- object_type *o_ptr;
- s32b item;
-
- item = get_next_arg(fmt);
-
- o_ptr = get_object(item);
-
- if (o_ptr->name1 == ART_NARSIL)
+ if (in->o_ptr->name1 == ART_NARSIL)
{
cquest.status = QUEST_STATUS_TAKEN;
- for (i = 0; i < 5; i++)
+ for (int i = 0; i < 5; i++)
{
if (quest[QUEST_NARSIL].desc[i][0] != '\0')
{
@@ -94,7 +88,7 @@ static bool_ quest_narsil_identify_hook(const char *fmt)
}
add_hook_new(HOOK_MOVE, quest_narsil_move_hook, "narsil_move", NULL);
- del_hook(HOOK_IDENTIFY, quest_narsil_identify_hook);
+ del_hook_new(HOOK_IDENTIFY, quest_narsil_identify_hook);
process_hooks_restart = TRUE;
}
}
@@ -108,7 +102,10 @@ bool_ quest_narsil_init_hook(int q_idx)
{
add_hook_new(HOOK_MOVE, quest_narsil_move_hook, "narsil_move", NULL);
}
- if (cquest.status == QUEST_STATUS_UNTAKEN) add_hook(HOOK_IDENTIFY, quest_narsil_identify_hook, "narsil_id");
+ if (cquest.status == QUEST_STATUS_UNTAKEN)
+ {
+ add_hook_new(HOOK_IDENTIFY, quest_narsil_identify_hook, "narsil_id", NULL);
+ }
add_hook_new(HOOK_CHAR_DUMP, quest_narsil_dump_hook, "narsil_dump", NULL);
return (FALSE);
}
diff --git a/src/q_one.cc b/src/q_one.cc
index ea6b93fc..20022100 100644
--- a/src/q_one.cc
+++ b/src/q_one.cc
@@ -192,18 +192,13 @@ static bool_ quest_one_die_hook(const char *fmt)
return (FALSE);
}
-static bool_ quest_one_identify_hook(const char *fmt)
+static bool_ quest_one_identify_hook(void *, void *in_, void *)
{
- s32b item;
-
- item = get_next_arg(fmt);
+ struct hook_identify_in *in = static_cast<struct hook_identify_in *>(in_);
+ object_type *o_ptr = in->o_ptr;
if (cquest.status == QUEST_STATUS_TAKEN)
{
- object_type *o_ptr;
-
- o_ptr = get_object(item);
-
if ((o_ptr->name1 == ART_POWER) && (!object_known_p(o_ptr)))
{
cmsg_print(TERM_YELLOW, "You finally found the One Ring, source of Sauron's power, and key to");
@@ -351,7 +346,7 @@ bool_ quest_one_init_hook(int q_idx)
add_hook (HOOK_MONSTER_DEATH, quest_one_death_hook, "one_death");
add_hook_new(HOOK_DROP, quest_one_drop_hook, "one_drop", NULL);
add_hook (HOOK_WIELD, quest_one_wield_hook, "one_wield");
- add_hook (HOOK_IDENTIFY, quest_one_identify_hook, "one_id");
+ add_hook_new(HOOK_IDENTIFY, quest_one_identify_hook, "one_id", NULL);
}
if (cquest.status == QUEST_STATUS_UNTAKEN)
{
diff --git a/src/spells2.cc b/src/spells2.cc
index cbb55ecd..4a93b518 100644
--- a/src/spells2.cc
+++ b/src/spells2.cc
@@ -372,12 +372,8 @@ void identify_hooks(int i, object_type *o_ptr, identify_mode mode)
}
/* Process the appropriate hooks */
- process_hooks(HOOK_IDENTIFY, "(d,s)", i, mode_s);
-
- {
- hook_identify_in in = { o_ptr, mode };
- process_hooks_new(HOOK_IDENTIFY, &in, NULL);
- }
+ hook_identify_in in = { o_ptr, mode };
+ process_hooks_new(HOOK_IDENTIFY, &in, NULL);
}