rerun with default_locale in case spellname not found

This commit is contained in:
Enno Rehling 2002-10-27 10:04:06 +00:00
parent bb38c8c86a
commit 13be7184aa

View file

@ -594,7 +594,7 @@ find_spellbyname(unit *u, char *name, const struct locale * lang)
{ {
spell_ptr *spt; spell_ptr *spt;
sc_mage * m = get_mage(u); sc_mage * m = get_mage(u);
spell * sp; spell * sp = NULL;
spell_names * sn; spell_names * sn;
if (!m) return NULL; if (!m) return NULL;
@ -605,11 +605,12 @@ find_spellbyname(unit *u, char *name, const struct locale * lang)
sn = get_spellnames(lang, m->magietyp); sn = get_spellnames(lang, m->magietyp);
if (findtoken(&sn->names, name, (void**)&sp)!=E_TOK_NOMATCH) break; if (findtoken(&sn->names, name, (void**)&sp)!=E_TOK_NOMATCH) break;
} }
if (mtype==MAXMAGIETYP) return NULL;
} }
if (sp!=NULL) {
for (spt = m->spellptr; spt; spt = spt->next) { for (spt = m->spellptr; spt; spt = spt->next) {
if (sp->id==spt->spellid) return sp; if (sp->id==spt->spellid) return sp;
}
} }
if (lang==default_locale) return NULL; if (lang==default_locale) return NULL;
return find_spellbyname(u, name, default_locale); return find_spellbyname(u, name, default_locale);