diff --git a/src/gamecode/items.c b/src/gamecode/items.c index 4849ce144..8c6ec2688 100644 --- a/src/gamecode/items.c +++ b/src/gamecode/items.c @@ -124,12 +124,12 @@ use_antimagiccrystal(unit * u, const struct item_type *itype, int amount, assert(sp); /* Reduziert die Stärke jedes Spruchs um effect */ - effect = sp->level; + effect = 5; /* Hält Sprüche bis zu einem summierten Gesamtlevel von power aus. * Jeder Zauber reduziert die 'Lebenskraft' (vigour) der Antimagiezone * um seine Stufe */ - force = sp->level * 20; /* Stufe 5 =~ 100 */ + force = effect * 20; /* Stufe 5 =~ 100 */ /* Regionszauber auflösen */ while (*ap && force > 0) { diff --git a/src/gamecode/report.c b/src/gamecode/report.c index 221b50f19..72e5e4ab1 100644 --- a/src/gamecode/report.c +++ b/src/gamecode/report.c @@ -280,14 +280,10 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang) WARN_STATIC_BUFFER(); } } else { - if (costtyp == SPC_LEVEL || costtyp == SPC_LINEAR) { - itemanz *= sp->level; - } - bytes = - snprintf(bufp, size, "%d %s", itemanz, LOC(lang, resourcename(rtype, - itemanz != 1))); - if (wrptr(&bufp, &size, bytes) != 0) + bytes = snprintf(bufp, size, "%d %s", itemanz, LOC(lang, resourcename(rtype, itemanz != 1))); + if (wrptr(&bufp, &size, bytes) != 0) { WARN_STATIC_BUFFER(); + } } *bufp = 0; rparagraph(F, buf, 2, 2, '-'); diff --git a/src/gamecode/xmlreport.c b/src/gamecode/xmlreport.c index fc4666f37..33a740a76 100644 --- a/src/gamecode/xmlreport.c +++ b/src/gamecode/xmlreport.c @@ -165,6 +165,7 @@ static xmlNodePtr xml_inventory(report_context * ctx, item * items, unit * u) return node; } +#ifdef TODO /*spellbooks */ static xmlNodePtr xml_spells(report_context * ctx, quicklist * slist, int maxlevel) { @@ -183,6 +184,7 @@ xml_spells(report_context * ctx, quicklist * slist, int maxlevel) } return node; } +#endif static xmlNodePtr xml_skills(report_context * ctx, unit * u) { @@ -342,6 +344,7 @@ static xmlNodePtr xml_unit(report_context * ctx, unit * u, int mode) xmlAddChild(node, xml_skills(ctx, u)); } +#ifdef TODO /*spellbooks */ /* spells */ if (is_mage(u)) { sc_mage *mage = get_mage(u); @@ -350,6 +353,7 @@ static xmlNodePtr xml_unit(report_context * ctx, unit * u, int mode) xmlAddChild(node, xml_spells(ctx, slist, effskill(u, SK_MAGIC))); } } +#endif } /* faction information w/ visibiility */ diff --git a/src/kernel/magic.c b/src/kernel/magic.c index 881ba67f0..1f6bb42ee 100644 --- a/src/kernel/magic.c +++ b/src/kernel/magic.c @@ -438,7 +438,7 @@ void show_new_spells(faction * f, int level, const spellbook *book) */ void pick_random_spells(faction * f, int level, spellbook * book, int num_spells) { - spell *commonspells[MAXSPELLS]; + spellbook_entry *commonspells[MAXSPELLS]; int qi, numspells = 0; quicklist *ql; @@ -448,9 +448,8 @@ void pick_random_spells(faction * f, int level, spellbook * book, int num_spells for (qi = 0, ql = book->spells; ql; ql_advance(&ql, &qi, 1)) { spellbook_entry * sbe = (spellbook_entry *) ql_get(ql, qi); - spell * sp = sbe->sp; if (sbe->level <= level) { - commonspells[numspells++] = sp; + commonspells[numspells++] = sbe; } } @@ -461,20 +460,20 @@ void pick_random_spells(faction * f, int level, spellbook * book, int num_spells for (i = 0; i < num_spells; ++i) { int maxspell = numspells; int spellno = -1; - spell *sp = 0; - while (!sp && maxspell>0) { + spellbook_entry *sbe = 0; + while (!sbe && maxspell>0) { spellno = rng_int() % maxspell; - sp = commonspells[spellno]; - if (sp->level>f->max_spelllevel) { + sbe = commonspells[spellno]; + if (sbe->level>f->max_spelllevel) { commonspells[spellno] = commonspells[--maxspell]; - commonspells[maxspell] = sp; - sp = 0; - } else if (f->spellbook && spellbook_get(f->spellbook, sp)) { + commonspells[maxspell] = sbe; + sbe = 0; + } else if (f->spellbook && spellbook_get(f->spellbook, sbe->sp)) { commonspells[spellno] = commonspells[--numspells]; if (maxspell>numspells) { maxspell = numspells; } - sp = 0; + sbe = 0; } } @@ -482,7 +481,7 @@ void pick_random_spells(faction * f, int level, spellbook * book, int num_spells if (!f->spellbook) { f->spellbook = create_spellbook(0); } - spellbook_add(f->spellbook, sp, f->max_spelllevel); + spellbook_add(f->spellbook, sbe->sp, sbe->level); commonspells[spellno] = commonspells[--numspells]; } } @@ -948,7 +947,7 @@ cancast(unit * u, const spell * sp, int level, int range, struct order * ord) return false; } /* reicht die Stufe aus? */ - if (eff_skill(u, SK_MAGIC, u->region) < sp->level) { + if (eff_skill(u, SK_MAGIC, u->region) < level) { /* die Einheit ist nicht erfahren genug für diesen Zauber */ cmistake(u, ord, 169, MSG_MAGIC); return false; diff --git a/src/kernel/spell.h b/src/kernel/spell.h index 5a4df26e9..eb08a44f3 100644 --- a/src/kernel/spell.h +++ b/src/kernel/spell.h @@ -36,9 +36,6 @@ extern "C" { struct spell_component *components; spell_f cast; fumble_f patzer; - - /* this is not so much the spell's data, but the school's studying data */ - int level; /* Stufe des Zaubers */ } spell; int use_item_power(struct region *r, struct unit *u); diff --git a/src/kernel/spellbook.c b/src/kernel/spellbook.c index 14482742a..16e88b101 100644 --- a/src/kernel/spellbook.c +++ b/src/kernel/spellbook.c @@ -56,14 +56,15 @@ int spellbook_foreach(spellbook *sb, int (*callback)(spellbook_entry *, void *), spellbook_entry * spellbook_get(spellbook *sb, const struct spell * sp) { - quicklist *ql; - int qi; + if (sb) { + quicklist *ql; + int qi; - assert(sb); - for (qi = 0, ql = sb->spells; ql; ql_advance(&ql, &qi, 1)) { - spellbook_entry *sbe = (spellbook_entry *) ql_get(ql, qi); - if (sp==sbe->sp) { - return sbe; + for (qi = 0, ql = sb->spells; ql; ql_advance(&ql, &qi, 1)) { + spellbook_entry *sbe = (spellbook_entry *) ql_get(ql, qi); + if (sp==sbe->sp) { + return sbe; + } } } return 0;