diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-04-09 10:17:39 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-04-09 10:17:51 +0200 |
commit | b89a8b18c480f6c96b5f8ba1f67a29c45ab2007d (patch) | |
tree | 84f2e9f45e1e064b7d1de68cb5de538f5272cc1a /src | |
parent | d497a80b25bb612d63daa70582fca5eeaa708fec (diff) |
Lua: God quests: Move HOOK_CHAR_DUMP code to C
Diffstat (limited to 'src')
-rw-r--r-- | src/plots.h | 1 | ||||
-rw-r--r-- | src/q_god.c | 33 | ||||
-rw-r--r-- | src/quest.pkg | 1 |
3 files changed, 35 insertions, 0 deletions
diff --git a/src/plots.h b/src/plots.h index 27cf25f0..4631d3cd 100644 --- a/src/plots.h +++ b/src/plots.h @@ -78,3 +78,4 @@ extern void quest_god_set_god_dungeon_attributes_mandos(); extern void quest_god_level_end_gen_hook(); extern void quest_god_player_level_hook(int gained); extern bool_ quest_god_get_hook(int o_idx); +extern void quest_god_char_dump(); diff --git a/src/q_god.c b/src/q_god.c index bc2920a9..a83deb40 100644 --- a/src/q_god.c +++ b/src/q_god.c @@ -1,6 +1,8 @@ #include "angband.h" #include <assert.h> +#define print_hook(fmt,...) do { fprintf(hook_file, fmt, ##__VA_ARGS__); } while (0) + /* d_idx of the god_quest (Lost Temple) dungeon */ #define DUNGEON_GOD 30 #define CHANCE_OF_GOD_QUEST 21 @@ -888,3 +890,34 @@ bool_ quest_god_get_hook(int item) return FALSE; } + +void quest_god_char_dump() +{ + if (get_quests_given() > 0) + { + int relics = get_relics_found(); + char relics_text[128]; + cptr append_text = ""; + + snprintf(relics_text, sizeof(relics_text), "%d", relics); + + if (relics == MAX_NUM_GOD_QUESTS()) + { + strcpy(relics_text, "all"); + append_text = " and pleased your god"; + } + else + { + if (relics == 0) + { + strcpy(relics_text, "none"); + } + if (get_status() == QUEST_STATUS_FAILED) + { + append_text = " and failed in your quest"; + } + } + + print_hook("\n You found %s of the relic pieces%s.", relics_text, append_text); + } +} diff --git a/src/quest.pkg b/src/quest.pkg index dc5a91fc..fb2f3b84 100644 --- a/src/quest.pkg +++ b/src/quest.pkg @@ -177,3 +177,4 @@ extern void quest_god_set_god_dungeon_attributes_mandos(); extern void quest_god_level_end_gen_hook(); extern void quest_god_player_level_hook(int gained); extern bool quest_god_get_hook(int o_idx); +extern void quest_god_char_dump(); |