diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-02-23 09:11:56 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-02-23 09:11:56 +0100 |
commit | a07a80ac3cf4cd61a91f25092342142cc68894b1 (patch) | |
tree | 22519a159fcca6e1043c6f78db941a43cd0bd0ee /src/spells3.cc | |
parent | 9688ede57bcd87f51d94a2888f86da9fea37263a (diff) |
Simplify spell_type_for_each to spell_type_get_schools
Diffstat (limited to 'src/spells3.cc')
-rw-r--r-- | src/spells3.cc | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/spells3.cc b/src/spells3.cc index 4cabf892..9050cab9 100644 --- a/src/spells3.cc +++ b/src/spells3.cc @@ -2884,20 +2884,6 @@ casting_result tulkas_whirlwind() return cast(fire_ball(GF_ATTACK, 0, 1, 1)); } -static bool_ check_school_is_udun(void *data, s32b school_idx) -{ - int *count = (int *) data; - - if ((school_idx == SCHOOL_UDUN) || - (school_idx == SCHOOL_MELKOR)) - { - (*count)++; - } - - /* Keep going */ - return TRUE; -} - /* Return the number of Udun/Melkor spells in a given book */ int udun_in_book(s32b sval, s32b pval) { @@ -2912,7 +2898,14 @@ int udun_in_book(s32b sval, s32b pval) /* Go through spells */ for (auto spell_idx : school_book->spell_idx_list->v) { spell_type *spell = spell_at(spell_idx); - spell_type_school_foreach(spell, check_school_is_udun, &count); + for (auto school_idx : spell_type_get_schools(spell)) + { + if ((school_idx == SCHOOL_UDUN) || + (school_idx == SCHOOL_MELKOR)) + { + count++; + } + } } return count; |