diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-04-11 17:38:55 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-04-11 17:38:55 +0200 |
commit | f802db8cbf123d07c8a373b0cfc4188de34f386e (patch) | |
tree | 6525525c9ca95ec2a109d82785ac406c7e4c044a /src/gods.c | |
parent | 5a310053e1ed6331155e4c4a3a645291c0a95650 (diff) |
Lua: Gods: Move Theme god definitions to C
Diffstat (limited to 'src/gods.c')
-rw-r--r-- | src/gods.c | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -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; } |