diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-05-07 14:05:46 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-05-07 14:05:46 +0000 |
commit | cfda69d1ae94baf5e41b318ffd00dd227f8ddf69 (patch) | |
tree | 8bf2606134d56b1a58e1206d2d7331fe3a0518db /crawl-ref/source/spl-util.cc | |
parent | fa0e36a06cd154cc1d529dd7645ae47fab8af000 (diff) | |
download | crawl-ref-cfda69d1ae94baf5e41b318ffd00dd227f8ddf69.tar.gz crawl-ref-cfda69d1ae94baf5e41b318ffd00dd227f8ddf69.zip |
Spell power strings now reflect power caps.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1413 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-util.cc')
-rw-r--r-- | crawl-ref/source/spl-util.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index 40eb6f662d..61988ccd19 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -49,7 +49,7 @@ static int spell_list[NUM_SPELLS]; #define SPELLDATASIZE (sizeof(spelldata)/sizeof(struct spell_desc)) -static struct spell_desc *seekspell(int spellid); +static struct spell_desc *seekspell(spell_type spellid); static bool cloud_helper(int (*func)(int, int, int, cloud_type, kill_category), int x, int y, int pow, cloud_type ctype, kill_category ); @@ -61,24 +61,22 @@ static bool cloud_helper(int (*func)(int, int, int, cloud_type, kill_category), // all this does is merely refresh the internal spell list {dlb}: void init_spell_descs(void) { - unsigned int x = 0; - - for (x = 0; x < NUM_SPELLS; x++) - spell_list[x] = -1; + for (int i = 0; i < NUM_SPELLS; i++) + spell_list[i] = -1; // can only use up to SPELLDATASIZE _MINUS ONE_, or the // last entry tries to set spell_list[SPELL_NO_SPELL] // which corrupts the heap. - for (x = 0; x < SPELLDATASIZE - 1; x++) - spell_list[spelldata[x].id] = x; + for (unsigned int i = 0; i < SPELLDATASIZE - 1; i++) + spell_list[spelldata[i].id] = i; - for (x = 0; x < NUM_SPELLS; x++) + for (int i = 0; i < NUM_SPELLS; i++) { - if (spell_list[x] == -1) - spell_list[x] = spell_list[SPELL_NO_SPELL]; + if (spell_list[i] == -1) + spell_list[i] = spell_list[SPELL_NO_SPELL]; } - return; // return value should not matter here {dlb} + return; } // end init_spell_descs() int get_spell_slot_by_letter( char letter ) @@ -807,7 +805,7 @@ int spell_type2skill(unsigned int spelltype) */ //jmf: simplified; moved init code to top function, init_spell_descs() -static struct spell_desc *seekspell(int spell) +static struct spell_desc *seekspell(spell_type spell) { return (&spelldata[spell_list[spell]]); } @@ -824,3 +822,8 @@ static bool cloud_helper(int (*func)(int, int, int, cloud_type, kill_category), return false; } + +int spell_power_cap(spell_type spell) +{ + return seekspell(spell)->power_cap; +} |