diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-04-11 18:10:49 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-04-11 18:10:49 +0200 |
commit | c4db19005072f39faf67235d180d00eab6a4666f (patch) | |
tree | 90039d3890d58967996a132be68d8c914dc10b4f /src/gods.c | |
parent | 8c31b55cffc3d1d85b90126a9dd2ba6526723fcd (diff) |
Lua: Gods: Refactor HOOK_FOLLOW_GOD code to C
Diffstat (limited to 'src/gods.c')
-rw-r--r-- | src/gods.c | 29 |
1 files changed, 25 insertions, 4 deletions
@@ -44,6 +44,30 @@ void abandon_god(int god) } /* + * Check if god may be followed by player + */ +static bool_ may_follow_god(int god) +{ + if (god == GOD_MELKOR) + { + int i; + + /* Check if player has wielded The One Ring */ + for (i = INVEN_WIELD; i < INVEN_TOTAL; i++) + { + if (p_ptr->inventory[i].name1 == ART_POWER) + { + msg_print("The One Ring has corrupted " + "you, and you are rejected."); + return FALSE; + } + } + } + /* Default is to allow */ + return TRUE; +} + +/* * Get a religion */ void follow_god(int god, bool_ silent) @@ -56,7 +80,7 @@ void follow_god(int god, bool_ silent) } /* Are we allowed ? */ - if (process_hooks(HOOK_FOLLOW_GOD, "(d,s)", god, "ask")) + if (!may_follow_god(god)) return; if (p_ptr->pgod == GOD_NONE) @@ -69,9 +93,6 @@ void follow_god(int god, bool_ silent) s_info[SKILL_UDUN].hidden = FALSE; if (!silent) msg_print("You feel the dark powers of Melkor in you. You can now use the Udun skill."); } - - /* Anything to be done? */ - process_hooks(HOOK_FOLLOW_GOD, "(d,s)", god, "done"); } } |