diff options
author | Bardur Arantsson <bardur@scientician.net> | 2014-12-19 01:38:43 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2014-12-23 12:07:55 +0100 |
commit | ad7d95740f774249168d3059672c69dada680127 (patch) | |
tree | 540200342b7aa7e3d71c068485605e3395085021 /src | |
parent | 5633ea7c94d1f2eec8b712071548d0879b315ac6 (diff) |
Update HOOK_BUILD_ROOM1 to new-style hook
Diffstat (limited to 'src')
-rw-r--r-- | src/generate.cc | 5 | ||||
-rw-r--r-- | src/q_rand.cc | 12 | ||||
-rw-r--r-- | src/q_thrain.cc | 18 | ||||
-rw-r--r-- | src/types.h | 6 |
4 files changed, 25 insertions, 16 deletions
diff --git a/src/generate.cc b/src/generate.cc index d215ea4e..55abf670 100644 --- a/src/generate.cc +++ b/src/generate.cc @@ -6782,7 +6782,10 @@ bool_ level_generate_dungeon() } /* Ugly */ - process_hooks(HOOK_BUILD_ROOM1, "(d,d)", y, x); + { + struct hook_build_room1_in in = { y, x }; + process_hooks_new(HOOK_BUILD_ROOM1, &in, NULL); + } /* Build some rooms */ for (i = 0; i < DUN_ROOMS; i++) diff --git a/src/q_rand.cc b/src/q_rand.cc index 290301d9..cb0fa42c 100644 --- a/src/q_rand.cc +++ b/src/q_rand.cc @@ -456,9 +456,12 @@ static bool_ quest_random_gen_hero_hook(const char *fmt) return (FALSE); } -static bool_ quest_random_gen_hook(const char *fmt) +static bool_ quest_random_gen_hook(void *, void *in_, void *) { - s32b x, y, bx0, by0; + struct hook_build_room1_in *in = static_cast<struct hook_build_room1_in *>(in_); + s32b bx0 = in->x; + s32b by0 = in->y; + s32b x, y; int xstart; int ystart; int y2, x2, yval, xval; @@ -472,9 +475,6 @@ static bool_ quest_random_gen_hook(const char *fmt) if (quest[QUEST_RANDOM].data[1]) return (FALSE); if (is_randhero(dun_level)) return (FALSE); - by0 = get_next_arg(fmt); - bx0 = get_next_arg(fmt); - /* Pick a room size */ get_map_size(format("qrand%d.map", random_quests[dun_level].type), &ysize, &xsize); @@ -620,7 +620,7 @@ bool_ quest_random_init_hook(int q_idx) add_hook_new(HOOK_NEW_LEVEL, quest_random_turn_hook, "rand_new_lvl", NULL); add_hook_new(HOOK_LEVEL_REGEN, quest_random_turn_hook, "rand_regen_lvl", NULL); add_hook (HOOK_LEVEL_END_GEN, quest_random_gen_hero_hook, "rand_gen_hero"); - add_hook (HOOK_BUILD_ROOM1, quest_random_gen_hook, "rand_gen"); + add_hook_new(HOOK_BUILD_ROOM1, quest_random_gen_hook, "rand_gen", NULL); add_hook_new(HOOK_FEELING, quest_random_feeling_hook, "rand_feel", NULL); add_hook_new(HOOK_CHAR_DUMP, quest_random_dump_hook, "rand_dump", NULL); return (FALSE); diff --git a/src/q_thrain.cc b/src/q_thrain.cc index d81dc2b3..f4e96a2b 100644 --- a/src/q_thrain.cc +++ b/src/q_thrain.cc @@ -90,9 +90,12 @@ static bool_ quest_thrain_death_hook(void *, void *in_, void *) return (FALSE); } -static bool_ quest_thrain_gen_hook(const char *fmt) +static bool_ quest_thrain_gen_hook(void *, void *in_, void *) { - s32b x, y, bx0, by0; + struct hook_build_room1_in *in = static_cast<struct hook_build_room1_in *>(in_); + s32b bx0 = in->x; + s32b by0 = in->y; + s32b x, y; int xstart; int ystart; int y2, x2, yval, xval; @@ -103,9 +106,6 @@ static bool_ quest_thrain_gen_hook(const char *fmt) if (cquest.data[1]) return (FALSE); if ((cquest.status < QUEST_STATUS_TAKEN) || (cquest.status >= QUEST_STATUS_FINISHED)) return (FALSE); - by0 = get_next_arg(fmt); - bx0 = get_next_arg(fmt); - /* Pick a room size */ get_map_size("thrain.map", &ysize, &xsize); @@ -228,10 +228,10 @@ bool_ quest_thrain_init_hook(int q) if ((cquest.status >= QUEST_STATUS_UNTAKEN) && (cquest.status < QUEST_STATUS_FINISHED)) { add_hook_new(HOOK_LEVEL_REGEN, quest_thrain_turn_hook, "thrain_regen_lvl", NULL); - add_hook_new(HOOK_NEW_LEVEL, quest_thrain_turn_hook, "thrain_new_lvl", NULL); - add_hook (HOOK_BUILD_ROOM1, quest_thrain_gen_hook, "thrain_gen"); - add_hook_new(HOOK_FEELING, quest_thrain_feeling_hook, "thrain_feel", NULL); - add_hook_new(HOOK_MONSTER_DEATH, quest_thrain_death_hook, "thrain_death", NULL); + add_hook_new(HOOK_NEW_LEVEL, quest_thrain_turn_hook, "thrain_new_lvl", NULL); + add_hook_new(HOOK_BUILD_ROOM1, quest_thrain_gen_hook, "thrain_gen", NULL); + add_hook_new(HOOK_FEELING, quest_thrain_feeling_hook, "thrain_feel", NULL); + add_hook_new(HOOK_MONSTER_DEATH, quest_thrain_death_hook, "thrain_death", NULL); } return (FALSE); } diff --git a/src/types.h b/src/types.h index f82ef006..b2f40124 100644 --- a/src/types.h +++ b/src/types.h @@ -2237,6 +2237,12 @@ struct hook_wild_gen_in { bool_ small; }; +typedef struct hook_build_room1_in hook_build_room1_in; +struct hook_build_room1_in { + s32b y; + s32b x; +}; + typedef struct hook_chardump_in hook_chardump_in; struct hook_chardump_in { FILE *file; |