diff options
author | Bardur Arantsson <bardur@scientician.net> | 2013-03-24 18:04:40 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2013-09-27 14:46:40 +0200 |
commit | fb0511aaa96c7a6089f39508703a8e0479b709f1 (patch) | |
tree | e13d144f8614d143b9a856b59fa46b4f3293ceef | |
parent | 1014b3342b9a61a5477b06b566271b5216edbbe3 (diff) |
Split fireproofing quest from plots.c
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/bldg.c | 1 | ||||
-rw-r--r-- | src/externs.h | 2 | ||||
-rw-r--r-- | src/plots.c | 9 | ||||
-rw-r--r-- | src/plots.h | 5 | ||||
-rw-r--r-- | src/q_fireprof.c | 7 | ||||
-rw-r--r-- | src/q_fireprof.h | 15 | ||||
-rw-r--r-- | src/tables.c | 1 |
8 files changed, 30 insertions, 12 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a7ae81ef..ea4206e1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,7 +10,7 @@ SET(SRCS 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 melee1.c melee2.c messages.c modules.c - q_god.c q_library.c + q_god.c q_library.c q_fireprof.c object1.c object2.c randart.c squeltch.cc traps.c monster1.c monster2.c monster3.c xtra1.c xtra2.c skills.c powers.c gods.c @@ -15,6 +15,7 @@ #include "angband.h" #include "q_library.h" +#include "q_fireprof.h" /* hack as in leave_store in store.c */ static bool_ leave_bldg = FALSE; diff --git a/src/externs.h b/src/externs.h index 97e886a0..11bdc3f3 100644 --- a/src/externs.h +++ b/src/externs.h @@ -573,6 +573,8 @@ 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, ...); diff --git a/src/plots.c b/src/plots.c index 6399c436..376cd8d6 100644 --- a/src/plots.c +++ b/src/plots.c @@ -205,6 +205,12 @@ char* get_next_arg_str(char *fmt) } } } +object_type* get_next_arg_obj() { + object_type *o_ptr = param_pile[get_next_arg_pile_pos++].o_ptr; + assert(o_ptr != NULL); + return o_ptr; +} + /* Actually process the hooks */ int process_hooks_restart = FALSE; @@ -395,6 +401,3 @@ bool_ quest_null_hook(int q) /*************************** Bounty Quest *************************/ #include "q_bounty.c" - -/************************* Fireproofing Quest *********************/ -#include "q_fireprof.c" diff --git a/src/plots.h b/src/plots.h index a0b96189..211fdbb3 100644 --- a/src/plots.h +++ b/src/plots.h @@ -53,11 +53,6 @@ extern bool_ quest_bounty_drop_item(); extern bool_ quest_bounty_get_item(); extern bool_ quest_bounty_describe(FILE *fff); -/******* Plot Fireproof Quest *********/ -extern void quest_fireproof_building(bool_ *paid, bool_ *recreate); -extern bool_ quest_fireproof_init_hook(int q); -extern bool_ quest_fireproof_describe(FILE *fff); - /******* Plot God Quest **************/ extern bool_ quest_god_describe(FILE *); extern bool_ quest_god_init_hook(int q); diff --git a/src/q_fireprof.c b/src/q_fireprof.c index 3afa348f..e252af4f 100644 --- a/src/q_fireprof.c +++ b/src/q_fireprof.c @@ -1,4 +1,6 @@ -#undef cquest +#include "q_fireprof.h" +#include "quark.h" + #define cquest (quest[QUEST_FIREPROOF]) #define print_hook(fmt,...) do { fprintf(hook_file, fmt, ##__VA_ARGS__); } while (0) @@ -379,8 +381,7 @@ void quest_fireproof_building(bool_ *paid, bool_ *recreate) static bool_ fireproof_get_hook(char *fmt) { - object_type *o_ptr = param_pile[0].o_ptr; - assert(o_ptr != NULL); + object_type *o_ptr = get_next_arg_obj(); /* check that player is in the quest, haven't picked up the * item already, and check that it's the real item and not another one diff --git a/src/q_fireprof.h b/src/q_fireprof.h new file mode 100644 index 00000000..eb6a048c --- /dev/null +++ b/src/q_fireprof.h @@ -0,0 +1,15 @@ +#pragma once + +#include "angband.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern void quest_fireproof_building(bool_ *paid, bool_ *recreate); +extern bool_ quest_fireproof_init_hook(int q); +extern bool_ quest_fireproof_describe(FILE *fff); + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/src/tables.c b/src/tables.c index bffc0fb2..af3e2764 100644 --- a/src/tables.c +++ b/src/tables.c @@ -12,6 +12,7 @@ #include "angband.h" #include "q_library.h" +#include "q_fireprof.h" |