diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-05-30 07:03:38 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-05-30 07:06:04 +0200 |
commit | fbc40366c8a50a695fcb913c5f25d717330e9672 (patch) | |
tree | b5b2b8d508ce70c6bb4b0c6ce58bb0be77bf275f /src/gods.c | |
parent | 77fcd7e02c87167002b8294a47c6cc37a0c960b3 (diff) |
Lua: Add god_at() for safe indexing of deity_info
Diffstat (limited to 'src/gods.c')
-rw-r--r-- | src/gods.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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) |