diff options
author | Bardur Arantsson <bardur@scientician.net> | 2014-12-18 00:00:35 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2014-12-18 00:00:35 +0100 |
commit | 76d1d3f63fef965ba0a2d5ccea3408ad36e9ce4c (patch) | |
tree | 08b7758fc22456584b6fb3477c30bf569e79d500 /src/spells3.cc | |
parent | d34f472970e6a9fa2257a63ed40d021fc2c6f045 (diff) |
Remove all uses of sglib
Diffstat (limited to 'src/spells3.cc')
-rw-r--r-- | src/spells3.cc | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/spells3.cc b/src/spells3.cc index 69b05aad..056d3de6 100644 --- a/src/spells3.cc +++ b/src/spells3.cc @@ -3,6 +3,7 @@ #include <assert.h> #include "spell_type.h" +#include "spell_idx_list.hpp" #include <vector> @@ -2960,8 +2961,6 @@ int udun_in_book(s32b sval, s32b pval) { int count = 0; school_book_type *school_book; - spell_idx_list *spell_idx = NULL; - struct sglib_spell_idx_list_iterator it; random_book_setup(sval, pval); @@ -2969,11 +2968,8 @@ int udun_in_book(s32b sval, s32b pval) school_book = school_books_at(sval); /* Go through spells */ - for (spell_idx = sglib_spell_idx_list_it_init(&it, school_book->spell_idx_list); - spell_idx != NULL; - spell_idx = sglib_spell_idx_list_it_next(&it)) - { - spell_type *spell = spell_at(spell_idx->i); + 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); } @@ -2983,23 +2979,16 @@ int udun_in_book(s32b sval, s32b pval) int levels_in_book(s32b sval, s32b pval) { int levels = 0; - school_book_type *school_book; - spell_idx_list *spell_idx = NULL; - struct sglib_spell_idx_list_iterator it; random_book_setup(sval, pval); /* Get the school book */ - school_book = school_books_at(sval); + school_book_type *school_book = school_books_at(sval); /* Parse all spells */ - for (spell_idx = sglib_spell_idx_list_it_init(&it, school_book->spell_idx_list); - spell_idx != NULL; - spell_idx = sglib_spell_idx_list_it_next(&it)) + for (auto spell_idx : school_book->spell_idx_list->v) { - s32b s = spell_idx->i; - spell_type *spell = spell_at(s); - + spell_type *spell = spell_at(spell_idx); levels += spell_type_skill_level(spell); } |