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/q_god.c | |
parent | d497a80b25bb612d63daa70582fca5eeaa708fec (diff) |
Lua: God quests: Move HOOK_CHAR_DUMP code to C
Diffstat (limited to 'src/q_god.c')
-rw-r--r-- | src/q_god.c | 33 |
1 files changed, 33 insertions, 0 deletions
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); + } +} |