From d598babbb1093429ff11a6ea3825cac514332e7f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 26 Feb 2006 14:08:19 +0000 Subject: [PATCH] http://eressea.upb.de/mantis/view.php?id=845 - Vertraute haben keine Zauber, korrektur-routine. --- src/eressea/korrektur.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index 3b63d3499..d9dd90faf 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -836,6 +837,9 @@ fix_familiars(void) if (u->race->init_familiar && u->race->maintenance==0) { /* this is a familiar */ unit * mage = get_familiar_mage(u); + equipment * eq; + char fname[64]; + if (mage==0) { log_error(("%s is a %s familiar with no mage for faction %s\n", unitid(u), racename(lang, u, u->race), @@ -846,8 +850,30 @@ fix_familiars(void) factionid(u->faction))); } if (has_skill(u, SK_MAGIC) && !is_mage(u)) { + log_error(("%s is a familiar with magic skill, but did not have a mage-attribute\n", + unitid(u))); create_mage(u, M_GRAU); } + + snprintf(fname, sizeof(fname), "initfamiliar_%s", u->race->_name[0]); + eq = get_equipment(fname); + if (eq) { + spell_list * sp = eq->spells; + + if (sp!=NULL) { + sc_mage * m = get_mage(u); + if (m==NULL) { + log_error(("%s is a %s-familiar with spells, but did not have a mage-attribute\n", + unitid(u), racename(lang, u, u->race))); + create_mage(u, M_GRAU); + } else { + while (sp) { + add_spell(m, sp->data); + sp = sp->next; + } + } + } + } } } }