diff options
author | Bardur Arantsson <bardur@scientician.net> | 2014-12-18 23:46:28 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2014-12-23 12:07:54 +0100 |
commit | 752611806d109d182227c22354bd380899ba5d67 (patch) | |
tree | bdf9d58d8b65fed83266d3d94b9cb8892e8b635e /src | |
parent | 471e7819c6af3b3513770d0784aed22cb5597da7 (diff) |
Update HOOK_IDENTIFY to new-style hook
Diffstat (limited to 'src')
-rw-r--r-- | src/q_narsil.cc | 23 | ||||
-rw-r--r-- | src/q_one.cc | 13 | ||||
-rw-r--r-- | src/spells2.cc | 8 |
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); } |