- fixed a bug in reading spelllists

- fixed elven-limit on greatbow
- fixed a crashbug
This commit is contained in:
Enno Rehling 2010-01-19 08:04:27 +00:00
parent 4717bae622
commit 1494507f4a
6 changed files with 15 additions and 6 deletions

View File

@ -211,7 +211,7 @@ int FactionSpells(void)
return rules_factionspells;
}
void read_spellist(struct spell_list ** slistp, struct storage * store)
void read_spellist(struct spell_list ** slistp, magic_t mtype, struct storage * store)
{
for (;;) {
spell * sp;
@ -224,7 +224,7 @@ void read_spellist(struct spell_list ** slistp, struct storage * store)
} else {
store->r_tok_buf(store, spname, sizeof(spname));
if (strcmp(spname, "end")==0) break;
sp = find_spell(M_NONE, spname);
sp = find_spell(mtype, spname);
}
if (sp!=NULL) {
add_spell(slistp, sp);
@ -272,7 +272,7 @@ read_mage(attrib * a, struct storage * store)
}
}
}
read_spellist(&mage->spells, store);
read_spellist(&mage->spells, mage->magietyp, store);
return AT_READ_OK;
}

View File

@ -383,7 +383,7 @@ extern int FactionSpells(void);
extern struct spell_list ** get_spelllist(struct sc_mage * mage, struct faction * f);
extern void write_spelllist(const struct spell_list * slist, struct storage * store);
extern void read_spellist(struct spell_list ** slistp, struct storage * store);
extern void read_spellist(struct spell_list ** slistp, magic_t mtype, struct storage * store);
extern double MagicPower(void);
#ifdef __cplusplus

View File

@ -1298,7 +1298,7 @@ readfaction(struct storage * store)
read_groups(store, f);
f->spellbook = NULL;
if (store->version>=REGIONOWNER_VERSION) {
read_spellist(&f->spellbook, store);
read_spellist(&f->spellbook, f->magiegebiet, store);
}
return f;
}

View File

@ -975,11 +975,11 @@ transfermen(unit * u, unit * u2, int n)
sn->level = (unsigned char)level;
sn->weeks = (unsigned char)weeks;
assert(sn->weeks>0 && sn->weeks<=sn->level*2+1);
assert(u2->number!=0 || (sn->level==sv->level && sn->weeks==sv->weeks));
} else if (sn) {
remove_skill(u2, sk);
sn = NULL;
}
assert(u2->number!=0 || (sn->level==sv->level && sn->weeks==sv->weeks));
}
a = a_find(u->attribs, &at_effect);
while (a && a->type==&at_effect) {

View File

@ -3,6 +3,7 @@ require "eressea.eternath"
require "eressea.wedding-jadee"
require "eressea.ponnuki"
require "eressea.items"
require "eressea.rules"
-- require "eressea.10years"
require "eressea.xmas2004"
require "eressea.xmas2005"

View File

@ -0,0 +1,8 @@
function item_canuse(u, iname)
local race = u.race
if iname=="greatbow" then
-- only elves use greatbow
return race=="elf"
end
return true
end