summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2015-03-07 16:55:41 +0100
committerBardur Arantsson <bardur@scientician.net>2015-03-07 16:55:41 +0100
commit3e87db451cf70fc70ef4eab5ff2b525d48c4cc43 (patch)
treee0c59555cd3fc0df1b5266a1776c1fcee0148445 /src
parent3f0def9ba628f6555a29517479acbd33c80e0097 (diff)
Moved lua_get_new_bounty_monster() to q_bounty.cc
This is where it rightly belongs. Also remove the lua_ prefix and make it static.
Diffstat (limited to 'src')
-rw-r--r--src/externs.h2
-rw-r--r--src/lua_bind.cc63
-rw-r--r--src/q_bounty.cc56
3 files changed, 55 insertions, 66 deletions
diff --git a/src/externs.h b/src/externs.h
index b48c3a9a..07232813 100644
--- a/src/externs.h
+++ b/src/externs.h
@@ -519,8 +519,6 @@ extern void get_target(int dir, int *y, int *x);
extern void get_map_size(const char *name, int *ysize, int *xsize);
extern void load_map(const char *name, int *y, int *x);
-extern int lua_get_new_bounty_monster(int lev);
-
extern char *lua_input_box(cptr title, int max);
extern char lua_msg_box(cptr title);
diff --git a/src/lua_bind.cc b/src/lua_bind.cc
index 97b9029f..f7d60bc5 100644
--- a/src/lua_bind.cc
+++ b/src/lua_bind.cc
@@ -217,69 +217,6 @@ void load_map(const char *name, int *y, int *x)
}
/*
- * Finds a good random bounty monster
- * Im too lazy to write it in lua since the lua API for monsters is not very well yet
- */
-
-/*
- * Hook for bounty monster selection.
- */
-static bool_ lua_mon_hook_bounty(int r_idx)
-{
- monster_race* r_ptr = &r_info[r_idx];
-
-
- /* Reject uniques */
- if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE);
-
- /* Reject those who cannot leave anything */
- if (!(r_ptr->flags9 & RF9_DROP_CORPSE)) return (FALSE);
-
- /* Accept only monsters that can be generated */
- if (r_ptr->flags9 & RF9_SPECIAL_GENE) return (FALSE);
- if (r_ptr->flags9 & RF9_NEVER_GENE) return (FALSE);
-
- /* Reject pets */
- if (r_ptr->flags7 & RF7_PET) return (FALSE);
-
- /* Reject friendly creatures */
- if (r_ptr->flags7 & RF7_FRIENDLY) return (FALSE);
-
- /* Accept only monsters that are not breeders */
- if (r_ptr->flags4 & RF4_MULTIPLY) return (FALSE);
-
- /* Forbid joke monsters */
- if (r_ptr->flags8 & RF8_JOKEANGBAND) return (FALSE);
-
- /* Accept only monsters that are not good */
- if (r_ptr->flags3 & RF3_GOOD) return (FALSE);
-
- /* The rest are acceptable */
- return (TRUE);
-}
-
-int lua_get_new_bounty_monster(int lev)
-{
- int r_idx;
-
- /*
- * Set up the hooks -- no bounties on uniques or monsters
- * with no corpses
- */
- get_mon_num_hook = lua_mon_hook_bounty;
- get_mon_num_prep();
-
- /* Set up the quest monster. */
- r_idx = get_mon_num(lev);
-
- /* Undo the filters */
- get_mon_num_hook = NULL;
- get_mon_num_prep();
-
- return r_idx;
-}
-
-/*
* Some misc functions
*/
char *lua_input_box(cptr title, int max)
diff --git a/src/q_bounty.cc b/src/q_bounty.cc
index dbd57df7..836c8a61 100644
--- a/src/q_bounty.cc
+++ b/src/q_bounty.cc
@@ -9,6 +9,60 @@
#define bounty_quest_monster (cquest.data[0])
+static bool_ lua_mon_hook_bounty(int r_idx)
+{
+ monster_race* r_ptr = &r_info[r_idx];
+
+ /* Reject uniques */
+ if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE);
+
+ /* Reject those who cannot leave anything */
+ if (!(r_ptr->flags9 & RF9_DROP_CORPSE)) return (FALSE);
+
+ /* Accept only monsters that can be generated */
+ if (r_ptr->flags9 & RF9_SPECIAL_GENE) return (FALSE);
+ if (r_ptr->flags9 & RF9_NEVER_GENE) return (FALSE);
+
+ /* Reject pets */
+ if (r_ptr->flags7 & RF7_PET) return (FALSE);
+
+ /* Reject friendly creatures */
+ if (r_ptr->flags7 & RF7_FRIENDLY) return (FALSE);
+
+ /* Accept only monsters that are not breeders */
+ if (r_ptr->flags4 & RF4_MULTIPLY) return (FALSE);
+
+ /* Forbid joke monsters */
+ if (r_ptr->flags8 & RF8_JOKEANGBAND) return (FALSE);
+
+ /* Accept only monsters that are not good */
+ if (r_ptr->flags3 & RF3_GOOD) return (FALSE);
+
+ /* The rest are acceptable */
+ return (TRUE);
+}
+
+static int get_new_bounty_monster(int lev)
+{
+ int r_idx;
+
+ /*
+ * Set up the hooks -- no bounties on uniques or monsters
+ * with no corpses
+ */
+ get_mon_num_hook = lua_mon_hook_bounty;
+ get_mon_num_prep();
+
+ /* Set up the quest monster. */
+ r_idx = get_mon_num(lev);
+
+ /* Undo the filters */
+ get_mon_num_hook = NULL;
+ get_mon_num_prep();
+
+ return r_idx;
+}
+
static bool_ bounty_item_tester_hook(object_type *o_ptr)
{
if ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval2 == bounty_quest_monster))
@@ -34,7 +88,7 @@ bool_ quest_bounty_drop_item()
if (cquest.status == QUEST_STATUS_UNTAKEN)
{
cquest.status = QUEST_STATUS_TAKEN;
- bounty_quest_monster = lua_get_new_bounty_monster(3 + (p_ptr->lev * 3) / 2);
+ bounty_quest_monster = get_new_bounty_monster(3 + (p_ptr->lev * 3) / 2);
monster_race_desc(mdesc, bounty_quest_monster, 0);
snprintf(msg, sizeof(msg), "You must bring me back %s corpse.", mdesc);