summaryrefslogtreecommitdiff
path: root/src/gods.c
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-04-11 18:10:49 +0200
committerBardur Arantsson <bardur@scientician.net>2012-04-11 18:10:49 +0200
commitc4db19005072f39faf67235d180d00eab6a4666f (patch)
tree90039d3890d58967996a132be68d8c914dc10b4f /src/gods.c
parent8c31b55cffc3d1d85b90126a9dd2ba6526723fcd (diff)
Lua: Gods: Refactor HOOK_FOLLOW_GOD code to C
Diffstat (limited to 'src/gods.c')
-rw-r--r--src/gods.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/gods.c b/src/gods.c
index 56b1380b..170f56b3 100644
--- a/src/gods.c
+++ b/src/gods.c
@@ -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");
}
}