forked from github/server
find_spellbyname sucht auch in fremden gebieten.
This commit is contained in:
parent
eb214fee16
commit
bb38c8c86a
|
@ -577,22 +577,36 @@ init_spellnames(const struct locale * lang, magic_t mtype)
|
||||||
return spellnames = sn;
|
return spellnames = sn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static spell_names *
|
||||||
|
get_spellnames(const struct locale * lang, magic_t mtype)
|
||||||
|
{
|
||||||
|
spell_names * sn = spellnames;
|
||||||
|
while (sn) {
|
||||||
|
if (sn->mtype==mtype && sn->lang==lang) break;
|
||||||
|
sn=sn->next;
|
||||||
|
}
|
||||||
|
if (!sn) return init_spellnames(lang, mtype);
|
||||||
|
return sn;
|
||||||
|
}
|
||||||
|
|
||||||
spell *
|
spell *
|
||||||
find_spellbyname(unit *u, char *name, const struct locale * lang)
|
find_spellbyname(unit *u, char *name, const struct locale * lang)
|
||||||
{
|
{
|
||||||
spell_names * sn = spellnames;
|
|
||||||
spell_ptr *spt;
|
spell_ptr *spt;
|
||||||
sc_mage * m = get_mage(u);
|
sc_mage * m = get_mage(u);
|
||||||
spell * sp;
|
spell * sp;
|
||||||
|
spell_names * sn;
|
||||||
|
|
||||||
if (!m) return NULL;
|
if (!m) return NULL;
|
||||||
while (sn) {
|
sn = get_spellnames(lang, m->magietyp);
|
||||||
if (sn->mtype==m->magietyp && sn->lang==lang) break;
|
if (findtoken(&sn->names, name, (void**)&sp)==E_TOK_NOMATCH) {
|
||||||
sn=sn->next;
|
magic_t mtype;
|
||||||
}
|
for(mtype=0;mtype!=MAXMAGIETYP;++mtype) {
|
||||||
if (!sn) sn = init_spellnames(lang, m->magietyp);
|
sn = get_spellnames(lang, m->magietyp);
|
||||||
if (findtoken(&sn->names, name, (void**)&sp)==E_TOK_NOMATCH) return NULL;
|
if (findtoken(&sn->names, name, (void**)&sp)!=E_TOK_NOMATCH) break;
|
||||||
|
}
|
||||||
|
if (mtype==MAXMAGIETYP) return 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;
|
||||||
|
|
|
@ -188,8 +188,6 @@ typedef int (*cspell_f) (struct fighter*, int, int, struct spell * sp);
|
||||||
/* zauber-patzer: */
|
/* zauber-patzer: */
|
||||||
typedef void (*pspell_f) (castorder *);
|
typedef void (*pspell_f) (castorder *);
|
||||||
|
|
||||||
extern spell spelldaten[];
|
|
||||||
|
|
||||||
/* besondere Spruchtypen */
|
/* besondere Spruchtypen */
|
||||||
#define FARCASTING (1<<0) /* ZAUBER [struct region x y] */
|
#define FARCASTING (1<<0) /* ZAUBER [struct region x y] */
|
||||||
#define SPELLLEVEL (1<<1) /* ZAUBER [STUFE x] */
|
#define SPELLLEVEL (1<<1) /* ZAUBER [STUFE x] */
|
||||||
|
|
|
@ -268,5 +268,6 @@ typedef struct wall_data {
|
||||||
|
|
||||||
extern struct attrib_type at_cursewall;
|
extern struct attrib_type at_cursewall;
|
||||||
extern struct attrib_type at_unitdissolve;
|
extern struct attrib_type at_unitdissolve;
|
||||||
|
extern struct spell spelldaten[];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue