diff --git a/src/gamecode/creport.c b/src/gamecode/creport.c index 705b862fb..cfd718985 100644 --- a/src/gamecode/creport.c +++ b/src/gamecode/creport.c @@ -38,7 +38,6 @@ without prior permission by the authors of Eressea. #include #include #include -#include #include #include #include diff --git a/src/kernel/reports.c b/src/kernel/reports.c index 6a7e4c81d..a7244d213 100644 --- a/src/kernel/reports.c +++ b/src/kernel/reports.c @@ -28,7 +28,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include @@ -38,6 +37,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include +#include #include #include @@ -700,32 +701,33 @@ bufunit(const faction * f, const unit * u, int indent, int mode, char *buf, } if (u->faction == f || telepath_see) { - sc_mage *m = get_mage(u); + spellbook *book = unit_get_spellbook(u); - if (m != NULL) { - quicklist *ql = m->spells; - int qi, t = effskill(u, SK_MAGIC); - int bytes = - snprintf(bufp, size, ". Aura %d/%d", get_spellpoints(u), - max_spellpoints(u->region, u)); - if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) + if (book) { + quicklist *ql = book->spells; + int qi, header, maxlevel = effskill(u, SK_MAGIC); + int bytes = snprintf(bufp, size, ". Aura %d/%d", get_spellpoints(u), max_spellpoints(u->region, u)); + if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) { WARN_STATIC_BUFFER(); + } - for (dh = 0, qi = 0; ql; ql_advance(&ql, &qi, 1)) { - spell *sp = (spell *) ql_get(ql, qi); - if (sp->level > t) - continue; - if (!dh) { - bytes = snprintf(bufp, size, ", %s: ", LOC(f->locale, "nr_spells")); - dh = 1; - } else { - bytes = (int)strlcpy(bufp, ", ", size); + for (header = 0, qi = 0; ql; ql_advance(&ql, &qi, 1)) { + spellbook_entry * sbe = (spellbook_entry *) ql_get(ql, qi); + if (sbe->level <= maxlevel) { + if (!header) { + bytes = snprintf(bufp, size, ", %s: ", LOC(f->locale, "nr_spells")); + header = 1; + } else { + bytes = (int)strlcpy(bufp, ", ", size); + } + if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) { + WARN_STATIC_BUFFER(); + } + bytes = (int)strlcpy(bufp, spell_name(sbe->sp, f->locale), size); + if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) { + WARN_STATIC_BUFFER(); + } } - if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); - bytes = (int)strlcpy(bufp, spell_name(sp, f->locale), size); - if (bytes < 0 || wrptr(&bufp, &size, bytes) != 0) - WARN_STATIC_BUFFER(); } for (i = 0; i != MAXCOMBATSPELLS; ++i) {