summaryrefslogtreecommitdiff
path: root/src/gods.c
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-04-11 17:38:55 +0200
committerBardur Arantsson <bardur@scientician.net>2012-04-11 17:38:55 +0200
commitf802db8cbf123d07c8a373b0cfc4188de34f386e (patch)
tree6525525c9ca95ec2a109d82785ac406c7e4c044a /src/gods.c
parent5a310053e1ed6331155e4c4a3a645291c0a95650 (diff)
Lua: Gods: Move Theme god definitions to C
Diffstat (limited to 'src/gods.c')
-rw-r--r--src/gods.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/gods.c b/src/gods.c
index b8b8fd3a..56b1380b 100644
--- a/src/gods.c
+++ b/src/gods.c
@@ -125,15 +125,38 @@ int wisdom_scale(int max)
return (i * max) / 37;
}
+/*
+ * Check if god is enabled for the current module
+ */
+bool_ god_enabled(struct deity_type *deity)
+{
+ int i;
+
+ for (i = 0; deity->modules[i] != -1; i++)
+ {
+ if (deity->modules[i] == game_module_idx)
+ {
+ return TRUE;
+ }
+ }
+ /* Not enabled */
+ return FALSE;
+}
+
/* Find a god by name */
int find_god(cptr name)
{
int i;
- for (i = 0; i < max_gods; i++)
+ for (i = 0; i < MAX_GODS; i++)
{
- /* The name matches */
- if (streq(deity_info[i].name, name)) return (i);
+ /* The name matches and god is "enabled" for the
+ current module. */
+ if (god_enabled(&deity_info[i]) &&
+ streq(deity_info[i].name, name))
+ {
+ return (i);
+ }
}
return -1;
}