summaryrefslogtreecommitdiff
path: root/src/gods.c
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-05-30 07:03:38 +0200
committerBardur Arantsson <bardur@scientician.net>2012-05-30 07:06:04 +0200
commitfbc40366c8a50a695fcb913c5f25d717330e9672 (patch)
treeb5b2b8d508ce70c6bb4b0c6ce58bb0be77bf275f /src/gods.c
parent77fcd7e02c87167002b8294a47c6cc37a0c960b3 (diff)
Lua: Add god_at() for safe indexing of deity_info
Diffstat (limited to 'src/gods.c')
-rw-r--r--src/gods.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gods.c b/src/gods.c
index 170f56b3..f940e21a 100644
--- a/src/gods.c
+++ b/src/gods.c
@@ -147,6 +147,23 @@ int wisdom_scale(int max)
}
/*
+ * Get deity info for a given god index.
+ * Returns NULL for the "atheist" god.
+ */
+deity_type *god_at(byte god_idx)
+{
+ assert(god_idx >= 0);
+ assert(god_idx < MAX_GODS);
+
+ if (god_idx == 0)
+ {
+ return NULL;
+ }
+
+ return &deity_info[god_idx];
+}
+
+/*
* Check if god is enabled for the current module
*/
bool_ god_enabled(struct deity_type *deity)