diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-04-08 17:52:16 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-04-08 18:19:35 +0200 |
commit | 1a33c8c5f7eb8d36642c59c37284cc8f06c3e102 (patch) | |
tree | d3419f5386e4aa663afcc9ccd35a8ec2223b0aa6 /src | |
parent | 61da8b12362ed22ca3c1d82ebec953035cd2f8d9 (diff) |
Lua: Library quest: Move more generation code to C
Diffstat (limited to 'src')
-rw-r--r-- | src/plots.h | 2 | ||||
-rw-r--r-- | src/q_library.c | 23 | ||||
-rw-r--r-- | src/util.pkg | 2 |
3 files changed, 24 insertions, 3 deletions
diff --git a/src/plots.h b/src/plots.h index 702bb55e..da8a6cd2 100644 --- a/src/plots.h +++ b/src/plots.h @@ -54,7 +54,7 @@ extern bool_ quest_bounty_get_item(); extern bool_ quest_bounty_describe(FILE *fff); /******* Plot Library Quest *******/ -extern void quest_library_gen_hook(); +extern bool_ quest_library_gen_hook(); extern void quest_library_building(bool_ *paid, bool_ *recreate); /******* Plot Fireproof Quest *********/ diff --git a/src/q_library.c b/src/q_library.c index 6bb8baaa..d7a098cd 100644 --- a/src/q_library.c +++ b/src/q_library.c @@ -7,6 +7,11 @@ #define MONSTER_IRON_GOLEM 367 #define MONSTER_MITHRIL_GOLEM 464 +static int LIBRARY_QUEST() +{ + return get_lua_int("LIBRARY_QUEST"); +} + static s16b library_quest_place_random(int minY, int minX, int maxY, int maxX, int r_idx) { int y = randint(maxY - minY + 1) + minY; @@ -214,8 +219,22 @@ void library_quest_fill_book() screen_load(); } -void quest_library_gen_hook() +bool_ quest_library_gen_hook() { + /* Only if player doing this quest */ + if (p_ptr->inside_quest != LIBRARY_QUEST()) + { + return FALSE; + } + + { + int y = 2; + int x = 2; + load_map("library.map", &y, &x); + dungeon_flags2 = DF2_NO_GENO; + } + + /* Generate monsters */ library_quest_place_nrandom( 4, 4, 14, 37, MONSTER_LICH, damroll(4,2)); @@ -239,6 +258,8 @@ void quest_library_gen_hook() library_quest_place_nrandom( 10, 10, 37, 67, MONSTER_MITHRIL_GOLEM, 1); + + return TRUE; } static int get_status() diff --git a/src/util.pkg b/src/util.pkg index 0be3cb8b..49924e7f 100644 --- a/src/util.pkg +++ b/src/util.pkg @@ -2473,7 +2473,7 @@ extern void lite_spot(int y, int x); extern bool drop_text_left(byte c, cptr s, int y, int o); extern bool drop_text_right(byte c, cptr s, int y, int o); -extern void quest_library_gen_hook(); +extern bool quest_library_gen_hook(); /** * Mimicry |