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/spell_type.cc | |
parent | 9688ede57bcd87f51d94a2888f86da9fea37263a (diff) |
Simplify spell_type_for_each to spell_type_get_schools
Diffstat (limited to 'src/spell_type.cc')
-rw-r--r-- | src/spell_type.cc | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/spell_type.cc b/src/spell_type.cc index 9b5fba28..eef93e6d 100644 --- a/src/spell_type.cc +++ b/src/spell_type.cc @@ -46,7 +46,7 @@ struct spell_type range_type mana_range; - int school_idxs_count; + size_t school_idxs_count; s32b school_idxs[3]; public: @@ -357,19 +357,14 @@ s16b spell_type_random_type(spell_type *spell) return spell->random_type; } -bool_ spell_type_school_foreach(spell_type *spell, bool_ (*callback)(void *data, s32b school_idx), void *data) +std::vector<s32b> const spell_type_get_schools(spell_type *spell) { - int i; - - for (i = 0; i < spell->school_idxs_count; i++) + std::vector<s32b> school_idxs; + for (size_t i = 0; i < spell->school_idxs_count; i++) { - if (!callback(data, spell->school_idxs[i])) - { - return FALSE; - } + school_idxs.push_back(spell->school_idxs[i]); } - - return TRUE; + return school_idxs; } bool_ spell_type_inertia(spell_type *spell, s32b *difficulty, s32b *delay) |