diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/monster2.cc | 7 | ||||
-rw-r--r-- | src/q_main.cc | 16 | ||||
-rw-r--r-- | src/types.h | 5 |
3 files changed, 18 insertions, 10 deletions
diff --git a/src/monster2.cc b/src/monster2.cc index 1a63e8a8..6cb9a19a 100644 --- a/src/monster2.cc +++ b/src/monster2.cc @@ -2179,9 +2179,12 @@ s16b place_monster_one(int y, int x, int r_idx, int ego, bool_ slp, int status) } /* Are we allowed to continue ? */ - if (process_hooks(HOOK_NEW_MONSTER, "(d)", r_idx)) { - return 0; + struct hook_new_monster_in in = { r_idx }; + if (process_hooks_new(HOOK_NEW_MONSTER, &in, NULL)) + { + return 0; + } } /* Ego Uniques are NOT to be created */ diff --git a/src/q_main.cc b/src/q_main.cc index 17651da2..0efd41c9 100644 --- a/src/q_main.cc +++ b/src/q_main.cc @@ -11,10 +11,10 @@ static void quest_describe(int q_idx) } } -static bool_ quest_main_monsters_hook(const char *fmt) +static bool_ quest_main_monsters_hook(void *, void *in_, void *) { - s32b r_idx; - r_idx = get_next_arg(fmt); + struct hook_new_monster_in *in = static_cast<struct hook_new_monster_in *>(in_); + s32b r_idx = in->r_idx; /* Sauron */ if (r_idx == 860) @@ -103,8 +103,8 @@ bool_ quest_morgoth_init_hook(int q_idx) { add_hook(HOOK_MONSTER_DEATH, quest_morgoth_hook, "morgort_death"); } - add_hook_new(HOOK_CHAR_DUMP, quest_morgoth_dump_hook, "morgoth_dump", NULL); - add_hook (HOOK_NEW_MONSTER, quest_main_monsters_hook, "main_new_monster"); + add_hook_new(HOOK_CHAR_DUMP, quest_morgoth_dump_hook, "morgoth_dump", NULL); + add_hook_new(HOOK_NEW_MONSTER, quest_main_monsters_hook, "main_new_monster", NULL); return (FALSE); } @@ -157,8 +157,8 @@ bool_ quest_sauron_init_hook(int q_idx) { add_hook(HOOK_MONSTER_DEATH, quest_sauron_hook, "sauron_death"); } - add_hook(HOOK_NEW_MONSTER, quest_main_monsters_hook, "main_new_monster"); - add_hook(HOOK_MONSTER_DEATH, quest_sauron_resurect_hook, "sauron_resurect_death"); + add_hook_new(HOOK_NEW_MONSTER, quest_main_monsters_hook, "main_new_monster", NULL); + add_hook (HOOK_MONSTER_DEATH, quest_sauron_resurect_hook, "sauron_resurect_death"); return (FALSE); } @@ -191,6 +191,6 @@ bool_ quest_necro_init_hook(int q_idx) { add_hook(HOOK_MONSTER_DEATH, quest_necro_hook, "necro_death"); } - add_hook(HOOK_NEW_MONSTER, quest_main_monsters_hook, "main_new_monster"); + add_hook_new(HOOK_NEW_MONSTER, quest_main_monsters_hook, "main_new_monster", NULL); return (FALSE); } diff --git a/src/types.h b/src/types.h index c090477f..d3f1f599 100644 --- a/src/types.h +++ b/src/types.h @@ -2264,6 +2264,11 @@ struct hook_stair_out { bool_ allow; }; +typedef struct hook_new_monster_in hook_new_monster_in; +struct hook_new_monster_in { + s32b r_idx; +}; + typedef struct hook_new_monster_end_in hook_new_monster_end_in; struct hook_new_monster_end_in { monster_type *m_ptr; |